On this article, we are going to check out methods to use tags with Terraform. We’ll clarify what they’re and why you may use them with some use case examples, earlier than transferring on to some sensible examples of methods to tag sources on AWS. Let’s get to the good things!
Tags in Terraform are key-value pairs related to cloud sources, permitting you to categorize and arrange these sources for higher administration, price allocation, and automation. The keys could be something you select, so long as they don’t battle with any reserved keys out of your cloud supplier.
What’s the distinction between tags and tags_all in Terraform?
Tags are applied in a different way relying on the cloud supplier you’re utilizing. Nevertheless, Terraform itself provides methods to set and handle tags constantly throughout suppliers utilizing the tags
attribute of a useful resource.
The tags_all
is a read-only attribute that lets you reference tags from different elements of your code. For instance, when you had an azure VNET known as instance that you simply wished to reference the tags on, you can use azurerm_virtual_network.instance.tags_all.