I can create a Google Cloud Storage Bucket using the Terraform resource google_storage_bucket.
But I am unable to find an example with the labels argument, or find a syntax that works.
The following passes terraform plan:
resource "google_storage_bucket" "report_staging" {
name = "some-unique-name"
labels = {
key = "env"
value = "dev"
}
}
but gives a 400 error on terraform apply
╷
│ Error: googleapi: Error 400: Invalid argument., invalid
│
│ with module.ndpe_project.google_storage_bucket.report_staging,
│ on ....main.tf line 130, in resource "google_storage_bucket" "report_staging":
│ 130: resource "google_storage_bucket" "report_staging" {
I believe the above syntax would actually create two keys called 'key' and 'value'. This will also pass the plan stage.:
labels = {
environment = local.env
created_by = "me"
}
}