-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_instance volume_tags conflict with aws_ebs_volume tags for attached volumes in a module #770
Comments
Am I the only one who feels that the whole idea behind volume_tags is conceptually deficient and will forever be bug-prone? It seems to me that root_block_device and ebs_block_device should instead have tags arguments. That would provide a clean, clear and more flexible way to achieve the same goal. Is it too late to re-design this feature? |
@morissm no, you aren't. This smells like something not very well designed. What I am not sure yet is where the wrong is, if it's something regarding terraform implementation itself, or it's something inherent to AWS resources internal design... |
@syquus Oh I'm not talking about the implementation but about the very design philosophy behind This argument conceptually impacts the configuration of multiple resources: the root volume, the This goes against the general design of Terraform where the configuration of each resource is solely determined by its arguments. Dependencies are expressed solely through interpolations made explicit in the config with no second order effects.
I don't have time to fix this myself but if it were me, I would not fix |
I agree to adding edit: I'm not sure why my comment unassigned @stack72. my apologies. |
I still see the issue |
Since this seems to be sitting around without a clear path forward, I'll share my workaround which I'm reasonably content with: resource "aws_instance" "foo" {
...
lifecycle {
ignore_changes = [
"ami",
"key_name",
# This prevents clobbering the tags of attached EBS volumes. See
# [this bug][1] in the AWS provider upstream.
#
# [1]: https://github.com/terraform-providers/terraform-provider-aws/issues/770
"volume_tags",
]
}
tags = "${merge(local.tags, map(
"Name", "${local.name_prefix}-foo",
"Role", "foo",
))}"
volume_tags = "${merge(local.tags, map(
"Name", "${local.name_prefix}-foo-rootfs",
"Role", "foo-rootfs",
))}" In addition, I avoid putting any EBS configuration other than the root block device into the instance resource itself, and tag This isn't so much a workaround as a way to tag root volumes and otherwise ignore the feature. My conclusions:
Just my 2¢. |
Still an issue for
|
I was hoping terraform 0.12's support for null resources would help address this, but unfortunately it does not. Even when set to null it flip-flops :( I for one vote for the removal of the feature or at least not affecting volumes attached by other means. |
This is a nightmare for trying to edit root volume options like Name, or even adding a tag for a lifecycle policy within AWS. I attempted to edit just the root device (all attached EBSs are really just Kubernetes Persistent Volumes) and I can't. This feel very broken, and I don't get why after 2+ years of reporting this that nothing has been done. |
Guys, any update on it? It's creates a real headache. |
We have merged a fix to the Now that the fix is in place, if you find any problems with |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @kojiromike as hashicorp/terraform#14462. It was migrated here as part of the provider split. The original body of the issue is below.
Terraform Version
0.9.5
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
The tag for
aws_ebs_volume.test
should consistently be "Name=>vol" according to thetags
specified in that resource.Actual Behavior
The "Name" tag switches back and forth between the value supplied by the
aws_ebs_volume
and theaws_instance.volume_tags
.Steps to Reproduce
After each subsequent
terraform plan/apply
, then I doaws --region us-west-2 ec2 describe-volumes --volume-ids "$volid" | jq -c '.Volumes[].Tags'
using the volume id grabbed from the first run:Run 1:
[{"Value":"test-vol","Key":"Name"}]
Run 2:
[{"Value":"test-instance","Key":"Name"}]
Important Factoids
This is so similar to #729 I almost requested that be reopened, but when I tried to reproduce it in a very simple case without a non-root module, I couldn't. But when I put some components in a module, the problem was evident.
The text was updated successfully, but these errors were encountered: