Skip to content

hmcts/terraform-module-common-tags

Repository files navigation

terraform-module-common-tags

A Terraform module to reference common tags.

Tagging policy documentation

Usage

This example shows usage of the module by passing only required values.

module "tags" {
  source      = "git::https://github.com/hmcts/terraform-module-common-tags.git?ref=master"
  environment = var.env
  product     = var.product
  builtFrom   = var.builtFrom
}

expiresAfter

In the Sandbox environment resources must be tagged with an end date after which they are no longer needed. They will then be automatically deleted after this date.

By default a tag will be added as now() + 30 days.

You can customise this by setting an explicit date:

module "tags" {
  source      = "git::https://github.com/hmcts/terraform-module-common-tags.git?ref=master"
  environment = var.env
  product     = var.product
  builtFrom   = var.builtFrom
  expiresAfter = "2023-01-01" # YYYY-MM-DD
}

Or by setting it to never expire with a date far into the future:

module "tags" {
  source      = "git::https://github.com/hmcts/terraform-module-common-tags.git?ref=master"
  environment = var.env
  product     = var.product
  builtFrom   = var.builtFrom
  expiresAfter = "3000-01-01" # never expire
}

Inputs

Name Description Type Default Required
autoShutdown Enable auto shutdown of resource bool false no
startupMode Enable start-up of resource by demand string always no
builtFrom Name of the GitHub repository this application is being built from. string n/a yes
environment Name of the environment to deploy the resource. string n/a yes
expiresAfter Expiry date of the resource. Valid format 'YYYY-MM-DD'. string "0000-00-00" no
product Name of the product. string n/a yes

Outputs

Name Description
common_tags Returns a mapping of tags to assign.