Terraform Tests effect on existing resources.

0

Hi. I want to utilize terraform test to do a pre-validation before deployments. However, I would like to know if using terraform test will affect my existing resources.

If using terraform test creates ephemeral resources, will it be created on my account and what name would it be using once it's created?

질문됨 3달 전102회 조회
1개 답변
1
수락된 답변

Hello.

When you set "command" to "apply" in the "run" block, AWS resources are actually created.
https://developer.hashicorp.com/terraform/language/tests

If using terraform test creates ephemeral resources, will it be created on my account and what name would it be using once it's created?

I tried it with an S3 bucket and it uses the resource name defined in Terraform code.
It looks like the resource is created within my AWS account.

profile picture
전문가
답변함 3달 전
profile picture
전문가
검토됨 3달 전
  • Thanks for trying that out. What would happen then if the resource is already existing when you run the test. Would it "run" and update the existing resource and then revert once test is done?

  • When I tested an S3 bucket, when there was a resource with the same name, an error occurred like when creating a normal S3 bucket. I think an error will probably occur for AWS resources that cannot be created if the resource name is duplicated. Therefore, if you do not want to affect existing AWS resources, I think it is better to set "command" to "plan" in the "run" block.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠