Skip to content

GoogleCloudPlatform/terraform-google-tags

Repository files navigation

terraform-google-tags

Description

This Terraform module makes it easier to create tags and bind them to different resources/services for your Google Cloud environment.

Usage

Basic usage of this module is as follows:

module "tags" {
  source  = "GoogleCloudPlatform/tags/google"
  version = "~> 0.1"

  tag_for         = "project"
  project_number  = "9999999999999"
  key             = "key1"
  key_description = "first key"
  value_specs = [{
    value       = "value1"
    description = "first value"
    tag_binding = { "global" : ["//cloudresourcemanager.googleapis.com/projects/99999999999"],
                    "us-central1" : ["//run.googleapis.com/projects/9999999999999/locations/us-central1/services/hello1"] }
    }, {
    value       = "value2"
    description = "second value"
    tag_binding = { "us-central1" : ["//run.googleapis.com/projects/9999999999999/locations/us-central1/services/hello1"] }
    }, {
    value       = "value3"
    description = "third value"
    tag_binding = {}
    }
  ]
}

Inputs

Name Description Type Default Required
key Key for Tags string n/a yes
key_description Description for the Key string "" no
key_purpose Purpose specification for the Key string "" no
key_purpose_data Purpose Data specification for the key map(string) {} no
org_id Organization ID string "" no
project_number Project Number string "" no
tag_for Tags Created for organization or project string "organization" no
value_specs Value specifications
list(object({
value = string
description = string
tag_binding = map(list(string))
}))
[] no

Outputs

Name Description
key_id Key ID
key_name Key Name
key_namespaced_name Key Namespaced Name
tag_binding_ids List of Tag Binding Ids
tag_binding_location_ids List of Tag Binding Location Ids
tag_binding_location_names List of Tag Binding Location Names
tag_binding_names List of Tag Binding Names
value_ids List of Value Ids
value_names List of Value Names
value_namespaced_names List of Value Namespaced Names

TAGs IAM

Use TAGs IAM modules tag_keys and tag_values for IAM bindings.

Requirements

These sections describe requirements for using this module.

Software

The following dependencies must be available:

APIs

APIs to enabled:

  • Resource Manager API: cloudresourcemanager.googleapis.com

Contributing

Refer to the contribution guidelines for information on contributing to this module.

Security Disclosures

Please see our security disclosure process.