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

Cloud Spanner resources could document the lifecycle argument #6898

Closed
rakyll opened this issue Jul 31, 2020 · 5 comments · Fixed by GoogleCloudPlatform/magic-modules#3812, #6928 or hashicorp/terraform-provider-google-beta#2330

Comments

@rakyll
Copy link

rakyll commented Jul 31, 2020

Similar to https://www.terraform.io/docs/providers/google/r/bigtable_table.html, google_spanner_instance and google_spanner_database could document the availability of the lifecycle argument to prevent accidental destructions.

@edwardmedia
Copy link
Contributor

@rakyll below is the API that is behind the resource. Which attribute do you refer to?
https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.databases

@rakyll
Copy link
Author

rakyll commented Jul 31, 2020

@edwardmedia, sorry that I was not specific enough.

I was wondering if we can suggest the following Terraform's prevent_destroy for Cloud Spanner resources as well?

lifecycle {
    prevent_destroy = true
}

An example from BigTable:

resource "google_bigtable_instance" "instance" {
  name = "tf-instance"

  cluster {
    cluster_id   = "tf-instance-cluster"
    zone         = "us-central1-b"
    num_nodes    = 3
    storage_type = "HDD"
  }

  lifecycle {
    prevent_destroy = true
  }
}

@ghost ghost removed the waiting-response label Jul 31, 2020
@edwardmedia
Copy link
Contributor

@rakyll lifecycle block is a Terraform feature. It should be available for all resources. Can you try it in Spanner to see if that works?

https://www.terraform.io/docs/configuration/resources.html#lifecycle-lifecycle-customizations

@rakyll
Copy link
Author

rakyll commented Jul 31, 2020

It works as expected, we should document it as a good practice the way BigTable does.

@ghost
Copy link

ghost commented Sep 3, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.