I'm using Terraform to launch my cloud environments.
It seems that even minor configuration change affects many of the resources behind the scenes.
For example, In cases where I create AWS instances - a small change will lead to auto-generation of all the instances:
-/+ aws_instance.DC (new resource required)
id: "i-075deb0aaa57c2d" => <computed> (forces new resource) <----- How can we avoid that?
ami: "ami-01e306baaaa0a6f65" => "ami-01e306baaaa0a6f65"
arn: "arn:aws:ec2:ap-southeast-2:857671114786:instance/i-075deb0aaa57c2d" => <computed>
associate_public_ip_address: "false" => <computed>
availability_zone: "ap-southeast-2a" => <computed>
.
.
My question is related specifically to AWS as the provider:
How can we avoid the destruction/creation of resources each time?
Maybe a relevant flag in Terraform?
Related threads:
Terraform > ipv6_address_count: "" => "0" (forces new resource)
terraform > forces new resource on security group
Edit:
Diving inside the plan output it seems that there was a change in one of the resources:
security_groups.#: "0" => "1" (forces new resource)
security_groups.837544107: "" => "sg-0892062659392afa9" (forces new resource)
Question is still relevant from the perspective of how to avoid the re-creation.
forces new resource
. – Adrianlifecycle
block to specify attributes that you do not want to force a new resource. – Adrian