Using Variables in AWS Tags with Terraform
I’ve been working to deepen my Terraform skills recently, and one avenue I’ve been using to help in this area is expanding my use of Terraform modules. If you’re unfamiliar with the idea of Terraform modules, you can liken them to Ansible roles: a re-usable abstraction/function that is heavily parameterized and can be called/invoked as needed. Recently I wanted to add support for tagging AWS instances in a module I was building, and I found out that you can’t use variable interpolation in the normal way for AWS tags. Here’s a workaround I found in my research and testing.
Normally, variable interpolation in Terraform would allow one to do something like this (this is taken from the aws_instance resource):
tags {
Name = "${var.name}-${count.index}"
role = "${var.role}"
}
This approach works, creating tags whose keys are “Name” and “role” and whose values are the interpolated variables. (I am, in fact, using this exact snippet of code in some of my Terraform modules.) Given that this works, I decided to extend it in a way that would allow the code calling the module to supply both the key as well as the value, thus providing more flexibility Continue reading


The initial release of the SevOne SD-WAN Monitoring software will give insights into Cisco-Viptela SD-WAN environments, but it will soon be extended to support other SD-WAN vendors.