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

terraform lifecycle ignore_changes should not be static or should otherwise support conditional ignore lists #33063

Closed
flebotany opened this issue Apr 21, 2023 · 3 comments
Labels
duplicate issue closed because another issue already tracks this problem

Comments

@flebotany
Copy link

          Per https://github.com/hashicorp/terraform/issues/33031#issuecomment-1507532309, this issue as written no longer describes a problem that is fully relevant in modern Terraform (circa 2023). I will quote the full comment here for posterity:

Thanks for compiling these issues. The original issue #3116 is probably no longer relevant as written -- interpolation is possible and used within lifecycle, but how it's used depends on each individual feature of a resource's lifecycle. Asking for interpolation for lifecycle in general is not going to effectively change anything.

It seems you are mostly concerned with prevent_destroy specifically, and one reason that has not changed is because it cannot do what the majority of users want it to do regardless of the ability to interpolate the value. Controlling how something is destroyed from the config doesn't work when that configuration can be removed entirely. If better control over the ability to destroy a resource is what you're after, #22544 covers this (and already shows a lot of support), but I think #24658 is probably where users should indicate their support for a more useful feature in general (or with the individual provider issues where that is applicable, since absolute control can only ever be applied outside of Terraform).

Since there is no specific bug to address here, I'm going to close the issue. If you have other concerns about enhancements which are not addressed by existing issues already, we can handle those individually in separate issues.

To follow up with the modern ancestors of this issue, please see the following:

References

Originally posted by @crw in #3116 (comment)

This missed the original issue I followed (#22546) which was about variable scope in lifecycle ignore_changes, which was closed as a dupe of this and not apparently reopened.

@flebotany flebotany changed the title Per https://github.com/hashicorp/terraform/issues/33031#issuecomment-1507532309, this issue as written no longer describes a problem that is fully relevant in modern Terraform (circa 2023). I will quote the full comment here for posterity: terraform lifecycle ignore_changes should not be static or should otherwise support conditional ignore lists Apr 21, 2023
@flebotany
Copy link
Author

Use case: I want to lifecycle ignore_changes for ami/image_id attributes in AWS except for canary regions/availability-zones without duplicating my module

@jbardin
Copy link
Member

jbardin commented Apr 21, 2023

Hi @flebotany,

Thanks for filing the issue. It is a known limitation that ignore_changes isn't going to be able to solve, since it is derived from static references it cannot dynamically alter the plan for a resource. There are a number of related issues already, so I'll link these together for now and we can see about combining them into a more actionable problem statement:

#29394
#29596
#26372
#26359
#24908
#5666

Thanks!

@jbardin jbardin closed this as completed Apr 21, 2023
@crw crw added the duplicate issue closed because another issue already tracks this problem label Apr 21, 2023
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate issue closed because another issue already tracks this problem
Projects
None yet
Development

No branches or pull requests

3 participants