Tagging in Terraform on AWS — Merging maps and inline tags!

Jack Roper
May 12, 2020

How to use a terraform map of tags and combine it with an inline tag?

For example, we have a tag called Name, for an AWS Elastic IP.

Name = ${var.host}-cluster_ip

We also have a definition of local values as follows:

Define the tags in the resource as follows to combine the 2…

tags = “${merge(map(“Name”, “${var.host}-cluster_ip”,), local.extra_tags)}”

--

--

Jack Roper

A blog about DevOps & Cloud Tech. Specializing in Terraform, Kubernetes, Azure & Azure DevOps! ☁️