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

Make it possible to state rm certain resources during destroy via the lifecycle{} block #34679

Closed
spkane opened this issue Feb 14, 2024 · 2 comments
Labels
duplicate issue closed because another issue already tracks this problem enhancement

Comments

@spkane
Copy link

spkane commented Feb 14, 2024

Terraform Version

All || N/A

Use Cases

The core idea is to create a way to tell Terraform to remove a resource from the state file during a destroy workflow instead of contacting the owning API to delete the object.

This would make it possible to handle nested objects, like kubernetes_namespace resources, that exist inside a Kubernetes cluster, which you will destroy in the same workflow, but you do not need Terraform to remove via the owning API.

Attempted Solutions

Hashicorp would recommend that people use a single Terraform workflow to spin up a k8s cluster and then install things into that cluster in another Terraform workflow.

However, there are many times that at least some bootstrapping will occur in the initial Terraform workflow. This fix would allow users to quickly identify resources that need not be destroyed via their API.

Proposal

lifecycle { 
  # This would cause Terraform to remove the resource from the state file instead of calling the owning API to delete.
  state_only_destroy = true
}

References

No response

@spkane spkane added enhancement new new issue not yet triaged labels Feb 14, 2024
@jbardin
Copy link
Member

jbardin commented Feb 14, 2024

Duplicate of #15485

Also related to #34439 and possible new features of removed blocks.

@jbardin jbardin closed this as completed Feb 14, 2024
@crw crw added duplicate issue closed because another issue already tracks this problem and removed new new issue not yet triaged labels Feb 16, 2024
Copy link

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 Mar 18, 2024
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 enhancement
Projects
None yet
Development

No branches or pull requests

3 participants