Adjust AWS tag keys to use only GitLab specific keys and not default keys
The current behavior is to use the Name tag and leveraging that for the dynamic inventory. Many customers are leveraging this tag within their automation and the resource naming convention may not align with their requirements.
I propose we change the Name tag to gitlab_node_name. With this approach all tag keys used for GET will be standardized and with start with gitlab_.
In the documentation and the examples, we can adjust the dynamic inventory:
hostnames:
- tag:gitlab_node_name
We can also give the user the option to set the Name tag to the same value. We can put this option as default true as to not break anyones current automation.
tags = merge({
Name = var.add_name_tag ? local.instance_names[count.index] : null
gitlab_node_name = local.instance_names[count.index]
gitlab_node_prefix = var.prefix
gitlab_node_type = var.node_type
gitlab_node_level = var.label_secondaries == true ? (count.index == 0 ? "${var.node_type}-primary" : "${var.node_type}-secondary") : null
gitlab_node_geo_site = var.geo_site
gitlab_geo_deployment = var.geo_deployment
gitlab_geo_full_role = var.geo_site == null ? null : (count.index == 0 ? "${var.geo_site}-${var.node_type}-primary" : "${var.geo_site}-${var.node_type}-secondary")
}, var.custom_tags)
Optionally, to prevent customer owned automation that does interact with the Name tag from being overwritten with follow on apply, we could either add tags to the lifecycle>ignore_changes or add the Name tag specifically:
lifecycle {
ignore_changes = [
tags ## or tags["Name"]
]
}