Skip to content

Commit

Permalink
#77 Delete prevent destroy because it is better to use the option in …
Browse files Browse the repository at this point in the history
…the module caller.
  • Loading branch information
nhinze23 committed Jun 12, 2024
1 parent 9d4165c commit 260cc30
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
15 changes: 1 addition & 14 deletions terraform/google_cloud_storage_bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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" {
Expand All @@ -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
}
6 changes: 0 additions & 6 deletions terraform/google_cloud_storage_bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 260cc30

Please sign in to comment.