Skip to content

Commit

Permalink
Merge pull request #4 from bishopb/expand-common-tags
Browse files Browse the repository at this point in the history
feat: expand common tags
  • Loading branch information
bishopb authored Dec 29, 2022
2 parents f840119 + 8660276 commit 278f0e5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/deploy-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/terraform/tags.common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -20,5 +20,7 @@ locals {
Project = var.project
Component = var.component
ImageTag = var.image_tag
Repository = var.repository
Product = var.product
}
}
16 changes: 15 additions & 1 deletion lib/terraform/variables.common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}

0 comments on commit 278f0e5

Please sign in to comment.