-
Notifications
You must be signed in to change notification settings - Fork 48
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
When using Terratag with existing tags Terratag override my tags
See example
main.tf -
resource "aws_s3_bucket" "example" {
bucket = "my-tf-test-bucket"
tags = {
Name = "My bucket"
Environment = "Dev"
}
}
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
Terratag command -
> /opt/terratag -tags="{\"Name\":\"By Terratag\"}" -rename=false
Results with this file
resource "aws_s3_bucket" "example" {
bucket = "my-tf-test-bucket"
tags = merge({
"Name" = "My bucket"
"Environment" = "Dev"
}, local.terratag_added_main)
}
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
locals {
terratag_added_main = {"Name"="By Terratag"}
}
Plan results in
+ tags = {
+ "Environment" = "Dev"
+ "Name" = "By Terratag"
}
+ tags_all = {
+ "Environment" = "Dev"
+ "Name" = "By Terratag"
}
Describe the solution you'd like
Flag that enables a different behaviour of merging tags instead of overriding tags, meaning the plan will result in
+ tags = {
+ "Environment" = "Dev"
+ "Name" = "My bucket"
}
+ tags_all = {
+ "Environment" = "Dev"
+ "Name" = "My bucket"
}
As Name exists in our Terraform configuration
Describe alternatives you've considered
Additional context

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Done