= Cloud/Terraform/Tags = * How to design handling cloud tags for modules ? * Goals: * Enforce some tags * Extend tags for specific components, VM, Nic, Disk etc. * Plan: * Split tags into * tags_ << Start with tags so they all group together. * tags_required << Enforce with a TF object * tags_additional << Optional additional for ALL * tags_vm << Optional additional for VM's * tags_volume << Optional additional for volume * Example {{{ variable "tags_required" { description = "EC2 instance standard tags" type = object({ owner = string application = string # description = "Mercury AWS standard tag. Tag value to be assigned to tag key Application." cost_code = string # description = "Mercury AWS standard tag. Tag value to be assigned to tag key CostCode." cost_code_sub = string # description = "Mercury AWS standard tag. Tag value to be assigned to tag key CostCode-Sub." business_unit = string # description = "Mercury AWS standard tag. Tag value to be assigned to tag key BusUnit." aws_region = string environment = string }) } variable "tags_additional" { description = "Additional taggs appended to tags in tf-mod-common-tags. (=additional_tags)" type = map(string) default = {} } variable "tags_vm" { description = "EC2 instance custom tags. (= custom_tags)" type = map(string) default = {} } variable "tags_volume" { description = "Additional tags just for EBS volumes (=custom_volume_tags)" type = map(string) default = {} } }}} === Ignore tag changes === * All {{{ lifecycle { ignore_changes = [tags, ] } }}} * Specific tag {{{ lifecycle { ignore_changes = [tags.backup_date, ] } }}} ---- CategoryTerraform