From 260cc3036c3e374e5b44ab56543a46ba31e05d75 Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 12 Jun 2024 16:54:01 +0200 Subject: [PATCH] #77 Delete prevent destroy because it is better to use the option in the module caller. --- terraform/google_cloud_storage_bucket/main.tf | 15 +-------------- .../google_cloud_storage_bucket/variables.tf | 6 ------ 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/terraform/google_cloud_storage_bucket/main.tf b/terraform/google_cloud_storage_bucket/main.tf index f5d28f9..40afda2 100644 --- a/terraform/google_cloud_storage_bucket/main.tf +++ b/terraform/google_cloud_storage_bucket/main.tf @@ -13,10 +13,6 @@ resource "google_storage_bucket" "bucket" { default_kms_key_name = var.use_encryption ? google_kms_crypto_key.bucket_key[0].id : "" } - lifecycle { - prevent_destroy = var.prevent_destroy - } - uniform_bucket_level_access = true } @@ -25,10 +21,6 @@ resource "google_kms_key_ring" "bucket_keyring" { name = var.key_ring_name location = var.location project = var.project - - lifecycle { - prevent_destroy = var.prevent_destroy - } } resource "google_kms_crypto_key" "bucket_key" { @@ -37,10 +29,5 @@ resource "google_kms_crypto_key" "bucket_key" { name = var.key_name key_ring = google_kms_key_ring.bucket_keyring[0].id rotation_period = var.key_rotation_period - - purpose = var.key_purpose - - lifecycle { - prevent_destroy = var.prevent_destroy - } + purpose = var.key_purpose } diff --git a/terraform/google_cloud_storage_bucket/variables.tf b/terraform/google_cloud_storage_bucket/variables.tf index 22ebf54..bad9688 100644 --- a/terraform/google_cloud_storage_bucket/variables.tf +++ b/terraform/google_cloud_storage_bucket/variables.tf @@ -60,9 +60,3 @@ variable "use_encryption" { type = bool default = true } - -variable "prevent_destroy" { - type = bool - description = "Indicates if a terraform destroy can destroy the bucket and keys if exists. If this value is true you should delete them manually before running a terraform destroy." - default = false -} \ No newline at end of file