diff --git a/lib/deploy-env.sh b/lib/deploy-env.sh index f479af3..59b3d6f 100644 --- a/lib/deploy-env.sh +++ b/lib/deploy-env.sh @@ -19,6 +19,10 @@ TF_VAR_project="${default_TF_VAR_project:-terraform-component}" # Provide a rough idea of who's making this change TF_VAR_user="${default_TF_VAR_user:-$(whoami)@$(hostname)}" +# Expose additional common tags +TF_VAR_repository="${default_TF_VAR_repository:-}" +TF_VAR_product="${default_TF_VAR_product:-}" + # Provide a means for all components to use a common backend. Because certain # values in our backend configuration are dynamic and Terraform does not # support variables in backend configuration, we set the entire configuration diff --git a/lib/terraform/tags.common.tf b/lib/terraform/tags.common.tf index f8b4cb8..6eda0f8 100644 --- a/lib/terraform/tags.common.tf +++ b/lib/terraform/tags.common.tf @@ -10,7 +10,7 @@ # @seealso https://support.hashicorp.com/hc/en-us/articles/4406026108435 locals { common_tags = { - # Note: to avoid CreatedAt being overwritten each deploy, add a lifecycle + # Note: to avoid Created values being overwritten each deploy, add a lifecycle # Note: block to every resource, like so: # Note: lifecycle { ignore_changes = [ tags["CreatedAt"], tags["CreatedBy"] ] } CreatedAt = timestamp() @@ -20,5 +20,7 @@ locals { Project = var.project Component = var.component ImageTag = var.image_tag + Repository = var.repository + Product = var.product } } diff --git a/lib/terraform/variables.common.tf b/lib/terraform/variables.common.tf index 351e278..c61ee20 100644 --- a/lib/terraform/variables.common.tf +++ b/lib/terraform/variables.common.tf @@ -14,7 +14,7 @@ variable "image_tag" { variable "project" { type = string - description = "The repository holding the terraform for this component" + description = "The business project implementing this component" sensitive = false nullable = false } @@ -25,3 +25,17 @@ variable "user" { sensitive = false nullable = false } + +variable "repository" { + type = string + description = "The source code repository where the component code can be found" + sensitive = false + nullable = false +} + +variable "product" { + type = string + description = "The product supported by the component" + sensitive = false + nullable = false +}