1 Answer
- Newest
- Most votes
- Most comments
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.
Relevant content
- asked 3 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a month ago
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.