Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ignoring changes to a resource, if it already exists. #2437

Closed
joekhoobyar opened this issue Jun 23, 2015 · 8 comments
Closed

Support ignoring changes to a resource, if it already exists. #2437

joekhoobyar opened this issue Jun 23, 2015 · 8 comments

Comments

@joekhoobyar
Copy link
Contributor

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.

@cdelorme
Copy link

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
}

@mikerahmati
Copy link

👍 ran into this as well

@berset
Copy link

berset commented Jul 30, 2015

👍 same here, very annoying when terraform kills the aws_route_table.route's for example.

@josh-padnick
Copy link

👍 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!

@ilijaljubicic
Copy link

+1 for this

@pmoust
Copy link
Contributor

pmoust commented Oct 15, 2015

#2525 should have this case covered

@radeksimko
Copy link
Member

@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"]
    }
}

@ghost
Copy link

ghost commented Apr 30, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants