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 Likes

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

1 Like