Skip to content

danielbmeireles/terratag-poc-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terratag PoC and Demo

Description

This is a PoC/demo repository for Terratag. Terratag is a CLI tool allowing for tags to be applied across an entire set of Terraform or Terragrunt files.

Problem statement

Developers and operators need a way to apply tags to resources in Terraform configurations in a consistent and easy way. This is important for cost tracking, security, and compliance reasons.

Goals

  • Demonstrate the use of Terratag to apply tags to Terraform resources.
  • Show how Terratag can be used to apply tags to resources that do not have tags declared in the Terraform code.
  • Show how Terratag can be used to apply tags to resources that have tags declared in the Terraform code.
  • Show how Terratag can be used to apply tags to resources using a JSON file as input.

Demo instructions

For the demo, we will be using a simple Terraform configuration that creates a Linux VM and a storage container in Azure.

The vm.tf contains no tags declared in the Terraform code. The st.tf contains tags declared in the form of tag = var.tags notation. The var.tags variable is defined in the variables.tf file and has a default value of {"managed-by" = "terraform"}.

The tags.json file contains the tags that will be applied to the resources in the Terraform configuration. Terratag does not support JSON files as an input natively, but we can use the following sintax to achieve this behavior:

terratag -tags="$(< tags.json)"

Terraform documentation

Providers

Name Version
azurerm 4.21.1

Resources

Name Type
azurerm_linux_virtual_machine.vm resource
azurerm_network_interface.nic resource
azurerm_resource_group.rg resource
azurerm_storage_account.st resource
azurerm_storage_container.stc resource
azurerm_subnet.snet resource
azurerm_virtual_network.vnet resource

Inputs

Name Description Type Default Required
tags A map of tags to add to all resources map(string)
{
"managed-by": "terraform"
}
no

License

This code is distributed under the terms of the MIT license. For more information, see the LICENSE file.

About

This is a PoC/demo repository for Terratag. Terratag is a CLI tool allowing for tags to be applied across an entire set of Terraform or Terragrunt files.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages