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

Add deletion_protection argument to google_secret_manager_secret #13661

Closed
Revyy opened this issue Feb 6, 2023 · 4 comments
Closed

Add deletion_protection argument to google_secret_manager_secret #13661

Revyy opened this issue Feb 6, 2023 · 4 comments

Comments

@Revyy
Copy link

Revyy commented Feb 6, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

The accidental deletion of secret manager secrets can be very disruptive if the secret is used by a production service.
Terraforms lifecycle { prevent_destroy=true } solves this issue in a blunt way but it is not really useable if you use terraform modules to provide a unified way of creating secrets across the organisation.

It would be very useful to have an option to set the deletion_protection argument for google_secret_manager_secret similarly to how you can do it for the google_sql_database_instance resource. This would allow us to prevent accidental deletions while still providing a good developer experience with terraform modules.

New or Affected Resource(s)

  • google_secret_manager_secret

Potential Terraform Configuration

resource "google_secret_manager_secret" "secret-basic" {
  secret_id = "secret"

  labels = {
    label = "my-label"
  }

  replication {
    user_managed {
      replicas {
        location = "us-central1"
      }
      replicas {
        location = "us-east1"
      }
    }
  }
  deletion_protection = true
}

References

@rileykarson rileykarson self-assigned this Feb 6, 2023
@rileykarson rileykarson added this to the Backlog milestone Feb 6, 2023
@rileykarson
Copy link
Collaborator

I'm not sure that we want to apply clientside deletion_protection to this resource. Deletion of most production resources with Terraform will be destructive and we've applied the deletion_protection field to database resources, generally, where deleted resources can mean permanently lost customer data rather than a resolvable disruption. It's a heavy-handed solution compared to using lifecycle.prevent_destroy (which is admittedly difficult to use w/ modules) since it means we permanently make destruction of the resource much more difficult.

That's not to say this this is wholly out of consideration, or that we don't think it's a valid request- I'll leave the issue open in our "Backlog" milestone to allow discussion / for it to collect addtl input from other users. Our stance for resources outside of databases is that this needs to be solved at the Terraform Core level, and we'd filed hashicorp/terraform#24658 to track that feedback (and have emphasized it as a priority through internal channels several times!)

@melinath
Copy link
Collaborator

melinath commented Sep 7, 2023

Marking forward/exempt since this is currently in backlog.

@rileykarson rileykarson removed their assignment Sep 18, 2023
@rileykarson
Copy link
Collaborator

Closing based on #13661 (comment) + no new feedback.

Copy link

github-actions bot commented Aug 1, 2024

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 Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants