Skip to content

Ignore drift, enforce changes #37839

@hobbyhorse

Description

@hobbyhorse

Terraform Version

Terraform v1.9.1
on darwin_arm64

Use Cases

There will be other applications of the idea, but in our case we need to be able to scale resources outside of terraform, and have terraform ignore the scaling that we did. This is easy enough with the ignore_changes lifecycle, but we also want terraform to make scaling changes if we update the terraform code to scale.

So, if we scaled via the AWS console, then ignore it. If we scale via the code, perform it.

The normal argument would be that all changes should be via terraform as that is the pattern it was designed for, but our terraform pipelines are wrapped in layers of approvals and checks which mean that they are much too slow for certian scenarios. However, we do not want whatever scaling we do outside of terraform to be reversed unless we specifically change the resource numbers/sizes in terraform.

Attempted Solutions

We have attempted ignore_changes but it applies to every kind of change, not just drift.

Proposal

I would like a new lifecycle option ignore_drift which does what it says on the can. Ignore drift, but enforce code changes. This should be possible based on what I understand about the state, but I could be wrong.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions