-
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 gets confused when > 1 volume attached #729
Comments
👍 have the same issue |
+1 |
still seeing this in 0.10.8 |
+1 |
1 similar comment
+1 |
Still an issue as of terraform 0.11.1 |
Upgraded to version 0.11.1 and I am seeing this issue as well. |
+1 |
+1 version 0.11.1 still has this issue |
+1 |
+1 |
I can confirm I'm seeing the same behavior in 0.11.3, adding the ignore for volumes tags to the lifecycle fixes the problem for now |
I am still getting this problem
My code (simplified) looks like:
I find that the tag Hope that is a clear explanation - it would be great to get a fix on this! :) |
This issue comes up when you use the volume_tags inside aws_instance with the aws_ebs_volume tag option. If you use only the tag mode on an aws_ebs_volume, works like a charm. |
any solution with using volume_tags inside aws_instance, from not overriding ebs volume tags? No issues with EBS volume tagging. I want to give a tag to the instance root volume using volume_tags
|
@roberulloa My current use case is that I am using "volume_tags" to ensure the root volume of the instance is properly tagged, and then I am using aws_ebs_volume on a separately created volume to ensure that specific volume is properly tagged. I have not yet found a way to modify the root volume created by the aws_instance resource, and the instance's own ebs_block_device option does not appear to allow extra/alternate tags. |
+1! Seeing this exact behavior in version:
|
Confirming on:
provider "aws" {
max_retries = 3
region = "eu-central-1"
profile = "devops"
}
data "aws_ami" "amzn2_base" {
most_recent = true
filter {
name = "name"
values = ["amzn2-ami-hvm-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["137112412989"]
}
data "aws_vpc" "default" {
default = true
}
data "aws_subnet_ids" "default" {
vpc_id = "${data.aws_vpc.default.id}"
}
data "aws_subnet" "test" {
id = "${data.aws_subnet_ids.default.ids[0]}"
}
resource "aws_instance" "test" {
ami = "${data.aws_ami.amzn2_base.id}"
subnet_id = "${data.aws_subnet.test.id}"
instance_type = "t2.nano"
root_block_device {
volume_type = "gp2"
}
volume_tags {
Name = "test1"
}
}
resource "aws_ebs_volume" "test" {
type = "gp2"
size = "1"
encrypted = true
availability_zone = "${data.aws_subnet.test.availability_zone}"
tags {
Name = "test2"
}
}
resource "aws_volume_attachment" "test" {
instance_id = "${aws_instance.test.id}"
volume_id = "${aws_ebs_volume.test.id}"
device_name = "/dev/sdb"
} 21:22 n3ph@mag-xps ~/tmp/community_gardening_terraform ✔ terraform apply
data.aws_vpc.default: Refreshing state...
data.aws_ami.amzn2_base: Refreshing state...
data.aws_subnet_ids.default: Refreshing state...
data.aws_subnet.test: Refreshing state...
aws_instance.test: Refreshing state... (ID: i-064ce7c94874db85c)
aws_ebs_volume.test: Refreshing state... (ID: vol-037621e6930139f90)
aws_volume_attachment.test: Refreshing state... (ID: vai-2991852907)
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
~ aws_ebs_volume.test
tags.Name: "test1" => "test2"
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
aws_ebs_volume.test: Modifying... (ID: vol-037621e6930139f90)
tags.Name: "test1" => "test2"
aws_ebs_volume.test: Modifications complete after 1s (ID: vol-037621e6930139f90)
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
21:23 n3ph@mag-xps ~/tmp/community_gardening_terraform ✔ terraform apply
data.aws_vpc.default: Refreshing state...
data.aws_ami.amzn2_base: Refreshing state...
data.aws_subnet_ids.default: Refreshing state...
data.aws_subnet.test: Refreshing state...
aws_ebs_volume.test: Refreshing state... (ID: vol-037621e6930139f90)
aws_instance.test: Refreshing state... (ID: i-064ce7c94874db85c)
aws_volume_attachment.test: Refreshing state... (ID: vai-2991852907)
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
~ aws_instance.test
volume_tags.Name: "test2" => "test1"
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
aws_instance.test: Modifying... (ID: i-064ce7c94874db85c)
volume_tags.Name: "test2" => "test1"
aws_instance.test: Modifications complete after 3s (ID: i-064ce7c94874db85c)
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
21:23 n3ph@mag-xps ~/tmp/community_gardening_terraform ✔ |
+1 Getting this while trying to tag my root volume and data volumes |
same issue observed
aws_volume_attachment.sql101-data01-attach: Refreshing state... (ID: vai-1256441354) An execution plan has been generated and is shown below. Terraform will perform the following actions: ~ aws_instance.sql101 Plan: 0 to add, 1 to change, 0 to destroy. |
Same issue here with
Anyway I found a temporary work-around:
I am very well aware that this work-around will not work for everyone |
Same problem with
|
Hi @soar @gnalawade @justin-sunayu @n3ph @mda590 The issue will still exist until it’s fixed. There’s no need to add additional comments confirming it’s still present - if you’re affected, add a thumbs up reaction to the initial post in this thread instead. Comments that don’t include additional information such as troubleshooting, workarounds etc add noise for the subscribers and risk being locked by the maintainers. It also makes it more difficult to find discussion of the actual issue. Thanks! |
+1 |
In the meanwhile, year 2019,
Issue still there |
@morokin Add a plus one on the initial post in this thread instead - Hashicorp report on those to determine which features to work on. As I mentioned in my above comment that you -1'ed, your post just adds needless noise for others in the same position who are subscribed to this thread, and doesn't actually help the issue get fixed or prioritised. |
My suggestion is to add "tags" attribute to both "root_ebs_volume" and "ebs_block_device" while keeping the "volume_tags". This way "volume_tags" could be a fallback when no tags are defined in the previous elements (and to retain compatibility). If someone don't want all instance block devices tagged with "volume_tags" just suppress it and tag blocks individually. |
2 years. How long do we have to wait for this bug to be fixed? |
Just for reference to anyone wishing to fix this, the problem stems from the fact that when updating volume_tags in place, terraform sets tags on all volume IDs attached to the instance rather than only the volumes created from the original ec2.RunInstances used to create the instance. Terraform is already able to distinguish the root_block_device from other block devices but not distinguishing ebs_block_devices defined in an aws_instance versus a separate aws_ebs_volume resource. The ec2.RunInstances response does contain the volume IDs of the other block devices which could be used to differentiate an You can confirm this ambiguity with a
It would be pretty straightforward to use the readBlockDevicesFromInstance function to get the root_block_device's volume ID for setVolumeTags but that wouldnt solve the ambiguity with Personally I'm a fan of this partial fix. Thoughts? |
I just overwrote the name of all my kubernetes persistent EBS volumes due to this bug. Is there any plan to fix this? I think the suggestion @rifelpet is a perfect middle ground. Unless the provider makes root_volume_tags and ebs_volume_tags separated. |
+ another year. I just started using Terraform, and it's fantastic, but can we not get some traction on this? The suggestion by @bkmeneguello above seems like it would be easy to put in without breaking anything. In fact, it's what I tried to do intuitively at first before finding it didn't work. |
I think the proper way is to submit a PR, it should not be that hard. |
$ terraform version
Terraform v0.12.24
+ provider.aws v2.53.0 the problem still remains |
$ terraform --version
still wants to change tags on the non-root volume:
That apparently just 1 line changed pull request has still not been merged. |
Running into this now, still.
Having an option to just ignore all EBS volumes would be the best solution IMO. |
I think #15474 is a good way to fix this.
Then attach additional volumes with 'aws_volume_attachment' and tags on those volumes will not change. |
Just as a note, this is now an issue as of 0.14 (maybe 0.13, we came direct from 0.12) for people who have never set volume_tags. |
Confirmed the workaround no longer works in 0.14.4. |
I can get the old behavior by specifying tags in the aws_ebs_volume resource and putting ignore_changes = [ volume_tags ] into the aws_instance, but it feels like a hack. |
That hack is what I have been doing while waiting for #12226. It's been almost a year for a 1 line code fix.
…________________________________
From: Bevan Bennett <notifications@github.com>
Sent: Tuesday, January 12, 2021 1:11 PM
To: hashicorp/terraform-provider-aws <terraform-provider-aws@noreply.github.com>
Cc: Alan Brenner <alan.brenner@antuit.ai>; Comment <comment@noreply.github.com>
Subject: Re: [hashicorp/terraform-provider-aws] aws_instance.volume_tags gets confused when > 1 volume attached (#729)
I can get the old behavior by specifying tags in the aws_ebs_volume resource and putting ignore_changes = [ volume_tags ] into the aws_instance, but it feels like a hack.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#729 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIBRKJQ3XAWI53MPRN3DU6DSZSGEPANCNFSM4DPEFN6A>.
[email-signature-logo]<https://www.antuit.com?utm_campaign=email-signature&utm_source=antuit&utm_medium=email&utm_content=logo> [email-signature-linkedin] <https://www.linkedin.com/company/antuitai> [email-signature-twitter] <https://twitter.com/antuitAI>
[email-signature-banner]<https://www.antuit.com/email?utm_campaign=email-signature&utm_source=antuit&utm_medium=email&utm_content=banner>
“The information contained in this e-mail message or any attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it is strictly prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately delete the e-mail. Thank you.”
|
We have merged a fix to the Now that the fix is in place, if you find any problems with |
This is true, however; if I'm not mistaken issues tend to get closed if you don't comment. |
I am not using the
|
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 @FransUrbo as hashicorp/terraform#14107. It was migrated here as part of the provider split. The original body of the issue is below.
It seems the new
volume_tags
(thanx btw!) gets confused when there's more than one volume attached to an instance.Terraform Version
0.9.4
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
Nothing.
Actual Behavior
Every other time it modified the
aws_ebs_volume
tags and every other on theaws_instance
.Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: