Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Google Cloud Data Catalog Tag Template Module

This module allows managing Data Catalog Tag Templates.

Simple Tag Template

module "data-catalog-tag-template" {
  source     = "./fabric/modules/data-catalog-tag-template"
  project_id = "my-project"
  region     = "europe-west1"
  tag_templates = {
    demo_var = {
      display_name = "Demo Tag Template"
      fields = {
        source = {
          display_name = "Source of data asset"
          is_required  = true
          type = {
            primitive_type = "STRING"
          }
        }
      }
    }
  }
}
# tftest modules=1 resources=1

Tag Template with IAM

The module conforms to our standard IAM interface and implements the iam, iam_bindings and iam_bindings_additive variables.

module "data-catalog-tag-template" {
  source     = "./fabric/modules/data-catalog-tag-template"
  project_id = "my-project"
  region     = "europe-west1"
  tag_templates = {
    demo_var = {
      display_name = "Demo Tag Template"
      is_required  = true
      fields = {
        source = {
          display_name = "Source of data asset"
          type = {
            primitive_type = "STRING"
          }
        }
      }
      iam = {
        "roles/datacatalog.tagTemplateOwner" = [
          "group:data-governance@example.com"
        ]
        "roles/datacatalog.tagTemplateUser" = [
          "group:data-product-eng@example.com"
        ]
      }
    }
  }
}
# tftest modules=1 resources=3

Factory

Similarly to other modules, a rules factory (see Resource Factories) is also included here to allow tag template management via descriptive configuration files.

Factory configuration is done via a single optional attribute in the factory_config_path variable specifying the path where tag template files are stored.

Factory tag templates are merged with rules declared in code, with the latter taking precedence if both use the same key.

The name of the file will be used as the tag_template_id field.

This is an example of a simple factory:

module "data-catalog-tag-template" {
  source     = "./fabric/modules/data-catalog-tag-template"
  project_id = "my-project"
  region     = "europe-west1"
  tag_templates = {
    demo_var = {
      display_name = "Demo Tag Template"
      fields = {
        source = {
          display_name = "Source of data asset"
          is_required  = true
          type = {
            primitive_type = "STRING"
          }
        }
      }
    }
  }
  factories_config = {
    tag_templates = "data"
  }
}
# tftest modules=1 resources=2 files=demo_tag
# tftest-file id=demo_tag path=data/demo.yaml

display_name: Demo Tag Template
fields:
  source:
      display_name: Source of data asset
      is_required: true
      type:
        primitive_type: STRING
  pii_type:
      display_name: PII type
      type:
        enum_type_values:
          - EMAIL
          - SOCIAL SECURITY NUMBER
          - NONE

Variables

name description type required default
project_id Id of the project where Tag Templates will be created. string
region Default region for tag templates. string
factories_config Paths to data files and folders that enable factory functionality. object({…}) {}
tag_templates Tag templates definitions in the form {TAG_TEMPLATE_ID => TEMPLATE_DEFINITION}. map(object({…})) {}

Outputs

name description sensitive
data_catalog_tag_template_ids Data catalog tag template ids.
data_catalog_tag_templates Data catalog tag templates.