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

GCP connector - Allow force_destroy on resources in apply stage #33649

Closed
tenstriker opened this issue Aug 8, 2023 · 2 comments
Closed

GCP connector - Allow force_destroy on resources in apply stage #33649

tenstriker opened this issue Aug 8, 2023 · 2 comments
Labels
enhancement new new issue not yet triaged

Comments

@tenstriker
Copy link

tenstriker commented Aug 8, 2023

Terraform Version

Latest

Use Cases

Currently terraform doesn't allow to replace a gcs bucket or a bigquery dataset if bucket or dataset is non empty. It raises an error that force_destroy must be set in order to delete gcs bucket. This is a nice guard. However, to really delete and create new bucket or bigquery dataset it seems I have to do these steps:

  1. first set force_destory flag, apply it
  2. delete the resources by removing from tf config script
  3. recreate resource with desired new configuration

Above causes me 3 code changes and 3 deployments to replace a resources.
Could this flow a simpler as.

  1. set force_destory flag to true, apply it (internally first owner the flag and destroy the resource, create a new resource with the new config on new config set force_destroy to false again)
    (if force_destroy is not set then raise an error just like it raises today)

Above means I can only deliberately (non unknowingly) replace the resource but in one code change and in one deployment.

Attempted Solutions

Refer use case

Proposal

Refer use case

References

No response

@tenstriker tenstriker added enhancement new new issue not yet triaged labels Aug 8, 2023
@jbardin
Copy link
Member

jbardin commented Aug 8, 2023

Hi @tenstriker,

Thanks for filing the issue. Terraform cannot change how force_destroy is handled, that is an attribute of the resource and the behavior is enforced solely by the provider.

Any general solution to Terraform controlling destroy policies would be covered by issue #24658. There is no clear design yet that is either more flexible than the current prevent_destroy mechanism, or could avoid the two-step process you mentioned

Thanks!

@jbardin jbardin closed this as completed Aug 8, 2023
@jbardin jbardin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2023
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 Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants