Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Create secret manager secrets with lables that don't have keys

In this Secret Manager documentation, it says label values can be empty, and I was able to create labels without values on the UI console.

How do I do this with gcloud or Terraform? When I create resource "google_secret_manager_secret" with Terraform passing label like below it doesn't create label at all.

resource "google_secret_manager_secret" "secret-with-empty-value-label" {
secret_id="test-secret"
labels={key=""}
replication {auto {}}
}
2 1 258
1 REPLY 1

Hello @zyang71  ,Welcome on Google Cloud Community.

It might be possible that provider does not allow to create empty labels, like via UI. You can always report an issue here: https://github.com/hashicorp/terraform-provider-google/issues

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost