terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

Add deletion_protection attribute to google_project resource

Open linouk23 opened this issue 2 years ago • 1 comments

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

Did we consider adding deletion_protection attribute (similar to google_bigquery_table resource to prevent users from accidentally deleting the project?

image

image

New or Affected Resource(s)

Potential Terraform Configuration

resource "google_project" "my_project" {
  name       = "My Project"
  project_id = "your-project-id"
  org_id     = "1234567"
  # new deletion_protection attribute that defaults to true
}

linouk23 avatar Aug 08 '22 01:08 linouk23

Note: There's a built-in GCP resource to add addtl deletion protection past Terraform's plan stage / lifecycle rule, https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/resource_manager_lien.

It's still opt-in, so an opt-out deletion_protection is still valuable, but less so that for some other resources w/o addtl protections.

rileykarson avatar Aug 08 '22 17:08 rileykarson

Agree with @rileykarson that while liens are useful if deletion is attempted outside of TF, removing lien definition together with project definition from a .tf file will cause TF to happily nuke both.

Hence having opt-out deletion_protection option will be useful.

haizaar avatar Aug 18 '23 06:08 haizaar