Open xpac1985 opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
This doesn't help with your ignore_tags
issue, but the default_tags
on root_block_device
is a long-standing bug: https://github.com/hashicorp/terraform-provider-aws/issues/19890
Edit: but apparently, it's been fixed in 5.39.0 of the provider?
This doesn't help with your
ignore_tags
issue, but thedefault_tags
onroot_block_device
is a long-standing bug: #19890Edit: but apparently, it's been fixed in 5.39.0 of the provider?
...was, as it seems :D
Edit: yay, respond to the notification email and don't see the edit... :D
I'm not sure this is working as intended. When I apply with default_tags set I get the following changes on one of my EC2 instances. After apply the changes and the same changes show up again on next plan/apply. (version 5.47.0)
~ root_block_device {
~ tags = {
+ "SystemID" = "security-gym"
+ "Team" = "Secure Development"
# (1 unchanged element hidden)
}
# (10 unchanged attributes hidden)
}
I am getting a perpetual change for tags when using default tags, this breaks our drift detection mechanism as it always shows change.
root_block_device {
volume_size = each.value.root_volume_size
volume_type = each.value.root_volume_type
delete_on_termination = each.value.root_volume_delete_on_instance_termination
encrypted = true
kms_key_id = var.kms_key_id
tags = {
owner = var.owner
terraformed = true
repo = var.repo
product = var.product
env = var.env
type = "root"
}
}
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.47.0"
}
}
provider "aws" {
region = "my-region"
assume_role {
role_arn = "role-arn"
session_name = "my-session"
}
default_tags {
tags = local.tags
}
}
~ root_block_device {
~ tags = {
+ "env" = "prod"
+ "owner" = "my@email.com"
+ "product" = "my-product"
"repo" = "my-repo"
+ "terraformed" = "true"
"type" = "root"
}
# (10 unchanged attributes hidden)
}
Terraform Core Version
1.6.0
AWS Provider Version
5.20.0
Affected Resource(s)
aws_instance
Expected Behavior
My aws provider is configured with
default_tags
andignore_tags
settings. I would expect a root volume auto-created while deploying an aws_instance to inherit thedefault_tags
, and on a subsequent run to not remove tags that are mentioned inignore_tags
.Actual Behavior
The root_block_device lacks the
default_tags
. On a subsequentterraform plan
, terraform shows theignore_tags
as tags it is going to remove.Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Have terraform create the
aws_instance
. Notice that the auto-created block device has no tags attached. Manually add tagmyspecialtag
with any value to the block device. Runterraform plan
, see how terraform does not ignore that tag, but schedules it for deletion.Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
This bug was already filed in January 2021 in #17257 but incorrectly closed as fixed, it still exists today.
Would you like to implement a fix?
No