Reputation: 766
Is it possible to require labels on creation of GCP resources, and if those labels aren't found, the resource either isn't created or is immediately terminated? I can't seem to find any documentation of this, and I'm thinking my best bet might be to create a Cloud Function that checks GCP resources to ensure they have the proper labels, otherwise it terminates them.
Upvotes: 1
Views: 1651
Reputation: 32
The labels are the easy way to group resources that are related or associated with others. For example you can label resources that are in production or in development and then you can search for resources that are in this states separately.
https://cloud.google.com/compute/docs/labeling-resources
You can use labels when you create a resource in GCP but you can’t force the usage of this labels because not all the products support the labels feature. You can have a look at the list of products that support the labels feature:
https://cloud.google.com/resource-manager/docs/creating-managing-labels#label_support
Upvotes: 1