Terraform CLI and Terraform AWS Provider Version
Terraform v0.15.5
provider registry.terraform.io/hashicorp/aws v3.38.0
Affected Resource(s)
aws_instance
root_block_device
Terraform Configuration Files
resource "aws_instance" "ec2_server1" {
ami = module.ami.ami1
instance_type = "t3.large"
subnet_id = "az1"
key_name = "key1
root_block_device {
volume_type = "gp3"
iops = 3000
throughput = 125
volume_size = 20
tags = {
"Name" = "server1"
"Environment" = "Sandbox"
"Project" = "admin_projet"
"Application" = "admin_test"
"localapp" = "local1"
"external" = "external1"
}
}
tags = {
"Name" = "server1"
"Project" = "admin_projet"
"localapp" = "local1"
"external" = "external1"
"Application" = "admin_test"
"Platform" = "Linux"
"Environment" = "Sandbox"
"Patching" = "yes"
"Power" = "24/7"
}
lifecycle {
ignore_changes = [ami, user_data, key_name]
}
}
Debug Output
~ resource "aws_instance" "ec2_server1" {
id = "i-0ex5xsdsdsjhsisdb"
tags = {
"Name" = "server1"
"Project" = "admin_projet"
"local" = "local1"
"external" = "external1"
"Application" = "admin_test"
"Platform" = "Linux"
"Environment" = "Sandbox"
"Patching" = "yes"
"Power" = "24/7"
}
~ root_block_device {
~ tags = {
+ "Name" = "server1"
+ "Environment" = "Sandbox"
+ "Project" = "admin_projet"
+ "Application" = "admin_test"
+ "local" = "local1"
+ "external" = "external1"
}
(8 unchanged attributes hidden)
}
(5 unchanged blocks hidden)
}
Actual Behavior
terraform plan output show all tags on root_block_device as new changes every time I run terraform plan even if these tags were already added to root_block_device by the first plan/apply.
Expected Behavior
If a tag was already applied to root_block_device terraform should not show this tag as new add tag on plan output for each plan.
Steps to Reproduce
- terraform plan; terraform apply : The root_block_device volume will be created correctly with all tags in tfe file.
- terraform plan again. terraform plan output show all tags on root_block_device as new changes with + sign