It would be great if the lifecycle block supported ignoring changes to a resource, if it already existed. Something like ignore_updates = true. This would solve the problem with #2436, as well as many other situations where we want Terraform to create the infrastructure initially but we do not want it to _undo_ changes that are done to the infrastructure outside of it's control - for example, when instances are launched from an ASG and then the instance makes changes to infrastructure.
Our team has encountered these problems as well.
The current, known, high-availability models which describe a solution using dynamic routing tables or shared network interfaces conflict with the declarative behavior of terraform.
If resources created by terraform are manipulated outside of terraform, running changes through the terraform configuration will reset the state of those modified resources.
We effectively need a way to say "treat this resource imperatively", or "ignore this if it has been created". It might be worth investigating a lifecycle rule to accomplish this:
lifecycle {
ignore_updates = true
}
:+1: ran into this as well
:+1: same here, very annoying when terraform kills the aws_route_table.route's for example.
:+1: We're attempting to use Terraform with Mesos and would like to provision the Auto Scaling Groups with Terraform, but allow Mesos to alter their desired / min / max values after the fact. This feature would perfectly support that use case!
+1 for this
@pmoust Thanks for noticing. #2525 has been merged and will be part of the upcoming release. Closing.
Here's an example of how it works:
resource "aws_instance" "web" {
ami = "foo"
lifecycle {
ignore_changes = ["ami"]
}
}
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
@pmoust Thanks for noticing. #2525 has been merged and will be part of the upcoming release. Closing.
Here's an example of how it works: