diff --git a/README.md b/README.md index 2cc29f68..2fba9978 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ determining that location is as follows: | activate\_apis | The list of apis to activate within the project | `list(string)` |
[| no | | auto\_create\_network | Create the default network | `bool` | `false` | no | | billing\_account | The ID of the billing account to associate this project with | `string` | n/a | yes | +| bucket\_labels | A map of key/value label pairs to assign to the bucket (optional) | `map` | `{}` | no | | bucket\_location | The location for a GCS bucket to create (optional) | `string` | `"US"` | no | | bucket\_name | A name for a GCS bucket to create (in the bucket\_project project), useful for Terraform state (optional) | `string` | `""` | no | | bucket\_project | A project to create a GCS bucket (bucket\_name) in, useful for Terraform state (optional) | `string` | `""` | no | diff --git a/main.tf b/main.tf index 42a9d4c9..9dca2c96 100644 --- a/main.tf +++ b/main.tf @@ -55,6 +55,7 @@ module "project-factory" { bucket_name = var.bucket_name bucket_location = var.bucket_location bucket_versioning = var.bucket_versioning + bucket_labels = var.bucket_labels auto_create_network = var.auto_create_network disable_services_on_destroy = var.disable_services_on_destroy default_service_account = var.default_service_account diff --git a/modules/core_project_factory/main.tf b/modules/core_project_factory/main.tf index 7514874c..254a51f2 100644 --- a/modules/core_project_factory/main.tf +++ b/modules/core_project_factory/main.tf @@ -281,6 +281,7 @@ resource "google_storage_bucket" "project_bucket" { name = local.project_bucket_name project = var.bucket_project == local.base_project_id ? google_project.main.project_id : var.bucket_project location = var.bucket_location + labels = var.bucket_labels versioning { enabled = var.bucket_versioning diff --git a/modules/core_project_factory/variables.tf b/modules/core_project_factory/variables.tf index aadd0b91..ee3bbe01 100644 --- a/modules/core_project_factory/variables.tf +++ b/modules/core_project_factory/variables.tf @@ -169,6 +169,12 @@ variable "bucket_versioning" { default = false } +variable "bucket_labels" { + description = " A map of key/value label pairs to assign to the bucket (optional)" + type = map + default = {} +} + variable "auto_create_network" { description = "Create the default network" type = bool diff --git a/variables.tf b/variables.tf index 5f23bd95..a8151e70 100644 --- a/variables.tf +++ b/variables.tf @@ -169,6 +169,12 @@ variable "bucket_versioning" { default = false } +variable "bucket_labels" { + description = " A map of key/value label pairs to assign to the bucket (optional)" + type = map + default = {} +} + variable "auto_create_network" { description = "Create the default network" type = bool
"compute.googleapis.com"
]