-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
r/aws_instance: volume_tags works incorrectly with aws_volume_attachment resources #12225
Comments
Sorry, when will this requirement be released? |
@klebediev Thank you for your continued help on this issue! I've been discussing design with the PR when really that conversation is better with the issue. Also, I apologize for being unclear in my understanding of your fix. I understand it better now. As always, correct me if I'm wrong. The Tag Problem CurrentlyWhen running a new instance, the AWS API allows a blanket tagging of any volumes created with the launch. For Terraform, this translates to any However, there is configuration overlap between A Fix:
|
Thank you for detailed analysis @YakDriver ! Concerns/sidenotes/questions:
|
@klebediev Thank you for helping to think through any potential issues with I agree that I don't like the way that AWS has implemented this feature. They want it to be convenient at launch time to tag a bunch of resources but that convenience creates problems down the road. Since we are opening design, feel free to throw out any ideas you might have (even half-baked ones) for how we can move ahead. Ideas
|
All approaches seem to have inevitable drawbacks (because of AWS API).
resource "aws_instance" "test" {
volume_tags = {
Name = "test-tag-1"
}
root_block_device {
volume_type = "standard"
volume_size = "100"
}
ebs_block_device {
device_name = "/dev/sdb"
volume_size = "9"
}
} If state is actual for both volumes then on @YakDriver WDYT? |
Just to provide some alternative implementation considerations, it may be desirable to have resource "aws_instance" "test" {
# ... other configuration ...
root_block_device {
volume_type = "standard"
volume_size = "100"
tags = {
Purpose = "OS"
}
}
ebs_block_device {
device_name = "/dev/sdb"
volume_size = "9"
tags = {
Purpose = "Widgets Data"
}
}
ebs_block_device {
device_name = "/dev/sdc"
volume_size = "9"
tags = {
Purpose = "Cogs Data"
}
}
} While being the most verbose, it provides the greatest configuration flexibility for practitioners while removing any ambiguity about the desired tagging state of all the various block devices. It should also represent a hopefully easier implementation, as the associated volume ID will be with each configuration block. The verbosity issue can be solved via variables, locals, Another consideration that achieves the same end goal and exists today would be to recommend the newer Aside from these though is one caveat to any implementation outside the usage of the |
@bflad
Not sure what was the reason why |
Although less than ideal, the shortest path to getting people up and running feels like Then we could set up a design issue to get a better plan in place. |
@klebediev We have discussed the design internally and have come up with this:
By keeping By adding Are you interested in modifying your PR along these lines? We understand people have other priorities but also want to give you the first opportunity. Let me know! |
@YakDriver working on this in #15474 |
#15474 is ready for review |
In conclusion, will this bug be fixed? |
@terachan-in-git work is in progress. |
FYI: As of (recent) updates aws_instance resources that have never specified volume_tags are now constantly fighting with additional aws_ebs_volumes over whether those volumes should or should not have tags. The old behaviour of not specifying volume_tags in the instance resource and having them separately in aws_ebs_volume tags blocks needs to be restored. |
I'm seeing this also. I opened an issue today with an example: #17074. It was marked as a duplicate to #5609, but I believe this is a separate issue. Until recently, we never saw this issue on instances that didn't define `volume_tags. It's much more pervasive now. |
I think it may be separate, since all the others involve explicit use of |
resource/aws_instance: Add `tags` parameter to `root_block_device`, `ebs_block_device` blocks (#12225)
This has been released in version 3.24.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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! |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
After first
terraform apply
:root EBS device should have tags:
attached EBS device tags:
Subsequent
terraform plan
shouldn't show any changes.Actual Behavior
After first apply volume tags are correct, but subsequent
terraform apply/plan
shows changes:Note that attached EBS Volume comes up in
aws_instance
resource state.Steps to Reproduce
terraform apply
terraform plan
The text was updated successfully, but these errors were encountered: