Terraform imports existing aws resources when running terraform apply
#16758
Labels
enhancement
Requests to existing resources that expand the functionality or scope.
service/ec2
Issues and PRs that pertain to the ec2 service.
service/elbv2
Issues and PRs that pertain to the elbv2 service.
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v0.13.3
+terraform-provider-aws_v3.20.0_x5
Affected Resource(s)
Steps to Reproduce
Copy the configuration below to folders
x
andy
. Runterraform apply
in each folder and they both succeed and now manage the same resource. This is bad because the resource was not created in the second folder but is written to state. Any further changes toaws_lb.test
iny
folder will affect theaws_lb.test
originally created inx
folder.Terraform Configuration Files
Expected Behavior
When running
terraform apply
in the second folder, terraform should return an error reporting it cannot create a duplicate resource.Actual Behavior
Terraform reports it has created the aws load balancer and writes it to state.
Important Factoids
This looks due to the aws api operation being idempotent
https://docs.aws.amazon.com/sdk-for-go/api/service/elbv2/#ELBV2.CreateLoadBalancer
The text was updated successfully, but these errors were encountered: