My Name tag in AWS comes out to looking like the following:
var.myname-a9c1550bc09a6832
However, I want it to look like the following:
craigums-a9c1550bc09a6832.
Here is my locals.tf file:
locals {
common_tags = {
Name = “var.myname-${random_id.server.hex}”
}
}
Here is my variables.tf:
variable “myname” {
description = “Default Name tag for AWS Resources”
default = “craigums”
}
Here is my resource declaration in main.tf:
resource “aws_instance” “webserver” {
tags = merge(
local.common_tags,
map(
"Zoo", "AWS Zoofarm",
"RESOURCE", "webserver AMI",
)
)
The documentation for 13 doesn’t provide much guidance.
What am I doing wrong in the locals.tf or main.tf file?
Thanks,
Craig