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

Provider does not tolerate destruction of resources outside of Terraform #366

Open
erikeckhardt opened this issue Aug 15, 2024 · 0 comments

Comments

@erikeckhardt
Copy link

Problem

In Terraform, if a resource that was created by Terraform and exists in the state file does NOT exist inside the cloud environment, providers are supposed to treat that as a CREATE operation instead of erroring out like so:

Error: elastic: Error 404 (Not Found): [my-es-domain-snapshots] missing [type=repository_missing_exception]

Even deleting the resources from my .tf source code (leaving the provider block in place) did not work, and that should have been treated as a NO-OP.

Solution

Tolerate resources not being present that are listed in the state file.

Specific example: if a repository can't be found, don't blow up. Just create the repository again (or do nothing if the resource is not in the .tf source).

Rationale

Mistakes happen. Cloud resources can be deleted. After such a deletion today for me in a non-prouction environment, the provider throwing this error meant I had to do tfstate surgery to remove the resources myself, and I also had to update the DynamoDb md5 fingerprint entry to match the new hash of the state file. These would be very painful in a production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant