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

Feature request: prevent_changes lifecycle meta-argument #23646

Open
saiya opened this issue Dec 11, 2019 · 0 comments
Open

Feature request: prevent_changes lifecycle meta-argument #23646

saiya opened this issue Dec 11, 2019 · 0 comments

Comments

@saiya
Copy link

saiya commented Dec 11, 2019

Current Terraform Version

0.12.16

Use-cases

resource "aws_subnet" "something" {
  # After I create this, this attribute should not be changed. 
  cidr_block = $very_complecated_computation

  lifecycle {
    prevent_changes = [ "cidr_block" ]
  }
}

Attempted Solutions

When we operate large infrastructure with terraform, it is easy to make mistake. Especially when we write complicated expressions and/or use variables & data resources, it may result in unexpected value.

I know we can check plan to detect unexpected changes by visual inspection. But any human could make mistake. To prevent accidentally changing "important" attribute, I propose this feature.

Proposal

Add prevent_changes lifecycle meta-argument. It takes list of attribute names to reject any plan to change it.

Additional benefit of this proposal is user-friendly behavior. Take an above aws_subnet example, if I erroneously changes cidr_block, terraform not only changes aws_subnet but also changes massive resources that depends on the value of the changed attribute. Understanding root cause of the large plan is tough work. With the prevent_changes, we can easily understand the issue.

References

I quickly searched this repository but did not found any proposal / works related to this proposal.

@saiya saiya changed the title Feature request: prevent_changes Feature request: prevent_changes lifecycle meta-argument Dec 11, 2019
@bflad bflad added the lifecycle label Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants