Terraform: Support labels for google cloud resources

Created on 19 Oct 2015  ยท  9Comments  ยท  Source: hashicorp/terraform

According to http://googlecloudplatform.blogspot.nl/2015/10/using-labels-to-organize-Google-Cloud-Platform-resources.html you can now use key/value pairs to label your resources.

It seem to be tags that have key=value format, but if I try that I get the following error, so apparently it's handled differently through the gcloud api.

Reason: invalid, Message: Invalid value for field 'tags.items[0]': 'environment=prod'.  Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)'

Please add support for this as it will allow us to use this to label our resources for better cost reporting.

enhancement providegoogle-cloud

Most helpful comment

Regarding to official documentation of Google Cloud Platform labels are no more in beta
https://cloud.google.com/compute/docs/labeling-resources (see URL in example)

All 9 comments

Judging from the info in the article it's a replacement for tags, but tags that previously existed are shown as value-less keys, which first led me to believe it used the tags system, but it's separately set with

curl --request POST --header "Authorization: Bearer your-oauth-token" --header 'Content-Type: application/json' --data '{"labels": {"env": "canary"}, "labelFingerprint": "abcdefghij="}' https://www.googleapis.com/compute/alpha/projects/your-project-id/zones/your-zone/instances/your-instance/setLabels

Unfortunately this seems to only be available in the beta API. I'll have to see what might break if we move from v1 to beta.

Have you considered using the metadata instance attribute? It supports key value pairs and is documented here

I've tested using metadata for it, but it's not what they use below the covers and doesn't unlock the new features. I can wait for the feature to go out of beta though.

I'm asking the SetLabel team internally to see if they have an estimate for when it will leave beta.

  1. Any update on when this will reach GA?
  2. Will labels be available on all resource types?

Hey!

Any update on this? It would be a brilliant way for us to track costs across different deployments...

Regarding to official documentation of Google Cloud Platform labels are no more in beta
https://cloud.google.com/compute/docs/labeling-resources (see URL in example)

Hi

@lwander , can you remove the upstream label please ?

Labels update on resource need to provide right fingerprint. It would be great to have common functions, that we could use in resource and datasource files.

Thanks !

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franklinwise picture franklinwise  ยท  3Comments

shanmugakarna picture shanmugakarna  ยท  3Comments

larstobi picture larstobi  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

c4milo picture c4milo  ยท  3Comments