From e3a493d42ec80d443f2b6a103eb06a78bd887a79 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Fri, 22 Nov 2024 18:41:53 +0530 Subject: [PATCH] feat: allow setting state bucket name --- modules/bootstrap/gcp/tf-state-bucket.tf | 2 +- modules/bootstrap/gcp/variables.tf | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/bootstrap/gcp/tf-state-bucket.tf b/modules/bootstrap/gcp/tf-state-bucket.tf index 25d89989..b41e895c 100644 --- a/modules/bootstrap/gcp/tf-state-bucket.tf +++ b/modules/bootstrap/gcp/tf-state-bucket.tf @@ -1,5 +1,5 @@ resource "google_storage_bucket" "tf_state" { - name = "${local.name_prefix}-tf-state" + name = local.tf_state_bucket_name project = local.project location = local.tf_state_bucket_location versioning { diff --git a/modules/bootstrap/gcp/variables.tf b/modules/bootstrap/gcp/variables.tf index 04bf7482..5010e2e7 100644 --- a/modules/bootstrap/gcp/variables.tf +++ b/modules/bootstrap/gcp/variables.tf @@ -8,6 +8,9 @@ variable "tf_state_bucket_location" { variable "tf_state_bucket_force_destroy" { default = false } +variable "tf_state_bucket_name" { + default = "" +} variable "enable_services" { default = true } @@ -18,5 +21,6 @@ locals { name_prefix = var.name_prefix tf_state_bucket_location = var.tf_state_bucket_location tf_state_bucket_force_destroy = var.tf_state_bucket_force_destroy + tf_state_bucket_name = var.tf_state_bucket_name != "" ? var.tf_state_bucket_name : "${var.name_prefix}-tf-state" project = var.gcp_project }