-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
ignore_changes assumes that the setting was originally created and set from within Terraform #26401
Comments
Hi @nexxai, In the next version of Terraform, setting The Looking at that resource's source in the provider, it appears |
@jbardin Maybe I did a bad job explaining what I'm looking for. In the example, |
Hi @nexxai, Thanks, I think see now what you're asking for, but unfortunately that's not something that Terraform is designed to handle. The root cause of the problem here is that the provider is modifying |
@jbardin And I get that what we're asking for wasn't the original intent, but what I don't get is why something like this couldn't be added? It may not have been designed or intended for that use originally, but as you can see in the comments of the multiple issues I referenced, it's not an unheard of request, and it doesn't seem like it should be that difficult to implement. If I was better at Go, I'd submit a PR myself, but the ask is simply an extra step before it diffs the currently known/managed state with the requested/declared state in the .tf file to say "if you see these entries, just knock them out of the array that you're about to compare". I realize PHP is mostly a joke to any "real" developer, but even in PHP, we would just The point of ignoring these changes is so that we can let Terraform continue on its way doing its Terraform thing without getting unnecessarily confused at things that it doesn't need to worry about. I am a huge Terraform evangelist and speak its praises to literally anyone who will listen, but there are some things that in certain cases it either can't handle (like a new feature that a particular provider doesn't yet support) or another business unit not wanting Terraform to touch a piece of their process for whatever reason. All we're looking for is a way to place nice with those BUs while we poke and prod at them to believe in the ways of Terraform and ditch their external tools and/or buy time until the relevant providers are updated to support Feature X. Is there any chance you'd reconsider? I know there are a lot of people (myself very much included) who would be very appreciative. |
@nexxai, I understand the frustration here, but the change really needs to happen on the provider side. There's shouldn't be a need for this type of behavior in the current I think there's a subtle difference in what you you're asking for and what is actually required here. If I understand correctly being able to ignore an individual map index which is not listed in the config should suffice to work around this problem. That specific change is likely to land in 0.14 in a follow up to the linked PR. This does not mean you will be able to ignore computed attributes (which should be the only way a provider can set state values), nor will it prevent this type of provider behavior from becoming an error in the future. |
So I've re-read the code in that PR a few times (as I said, I suck at Go) and I think it's going to be the nail in the coffin for what we're looking for, because at least in this specific case ( "app_settings": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
}, which if I understand your PR correctly, means that not only will it silently ignore the entry (as it would right now) but it will actually throw an error if we have: app_settings = {
this_setting_managed_by_terraform = true
}
lifecycle {
ignore_changes = [
app_settings["this_setting_managed_externally"]
]
} right? I really hope I'm reading that wrong, but I don't think I am. |
Having the attribute also be The |
@jbardin The stupid thing is that they not only operate the same way, behind the scenes, they're literally the same thing. I am going to submit a PR for that issue to make WRT your comment about the "feeling about an upcoming PR": is that hinting that it's soon? I'm not trying to rush things, I just need to know what I should be telling my boss; like whether I tell him "it's coming, maybe in the next month?" or "it's coming, maybe in the next 6 months" so he can make a determination on how we move forward. |
Oh man, that's perfect and exactly what we're looking for. I know on some of the providers' repos, they have general target dates for version releases; does this main repo have one somewhere that I can check out? |
Function Apps should have computed App Settings just like App Services do, since they are effectively two different offshoots of the same resource type behind the scenes. Also required as discussed in [this thread](hashicorp/terraform#26401 (comment))
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. |
Terraform Version
Terraform Configuration Files
Debug Output
n/a
Crash Output
n/a
Expected Behavior
Actual Behavior
Because Terraform did not create the setting, it is not being managed and so it cannot be ignored. As described here, it appears to be an issue with this line of code assuming that the setting was already being managed, when one of the main use cases for ignoring changes is to deal with configuration changes from systems outside of Terraform.
A suggestion here is to create and use placeholder values within the Terraform script, except that if these placeholders are used in modules where external systems may not touch all instances of that module, those placeholder values stick around which can cause their own problems, making this not a feasible solution.
Instead of assuming the change is "Managed", when detailing a specific change to ignore, Terraform should simply compare the list of changes to ignore (regardless of original creation source) and if it exists within that list, ignore it. There shouldn't be an assumption that a setting is being managed before subsequently ignoring it. Explaining that in English would basically be saying: "I need you to know about this thing so that you can not know about this thing." It's a contradiction.
Steps to Reproduce
terraform plan
orterraform apply
Additional Context
n/a
References
hashicorp/terraform-provider-azurerm#4321
The text was updated successfully, but these errors were encountered: