Skip to content
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

Better interaction between provider default_tags and aws_instance volume_tags #19188

Closed
acdha opened this issue Apr 30, 2021 · 5 comments · Fixed by #33769
Closed

Better interaction between provider default_tags and aws_instance volume_tags #19188

acdha opened this issue Apr 30, 2021 · 5 comments · Fixed by #33769
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Milestone

Comments

@acdha
Copy link
Contributor

acdha commented Apr 30, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

3.38.0 introduced the very handy provider-level default_tags which avoids a lot of tedious boilerplate. While migrating a large project, I noticed that EBS resources created by aws_instance do not use default_tags.

Obviously this could be resolved by changing volume_tags to inherit the default_tags values but I put this in as a feature request because it seems like a more generally useful situation would be making the provider's default_tags queryable in some way so it could be used for every resource type which has the concept of tags separate from the standard tags attribute — I'm pretty sure the same situation will arise with AWS Backup, for example — and it would be handy if you could reference the provider's configuration in something like merge(provider.aws.default_tags, var.extra_tags).

New or Affected Resource(s)

  • aws_instance

Potential Terraform Configuration

aws_instance {
  volume_tags = merge(provider.aws.default_tags, var.extra_tags)
}

References

@acdha acdha added the enhancement Requests to existing resources that expand the functionality or scope. label Apr 30, 2021
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Apr 30, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 30, 2021
@anGie44 anGie44 removed the needs-triage Waiting for first response or review from a maintainer. label May 4, 2021
@devopsrick
Copy link

I would argue that volume_tags should definitely inherit default_tags, if the idea behind default_tags is to replace the general use of tags on resources (except for overrides). Otherwise root ebs volumes of ec2 instances will not get tagged, while separate ebs volume will, and everything else.

@anGie44 anGie44 self-assigned this May 7, 2021
@jtdoepke
Copy link
Contributor

It should be documented that default_tags does not currently apply to aws_instance volume tags (and any resources with the same arguments like aws_spot_instance_request).

This note from the aws_instance documentation makes me think implementing default_tags here could be tricky:

NOTE:

Do not use volume_tags if you plan to manage block device tags outside the aws_instance configuration, such as using tags in an aws_ebs_volume resource attached via aws_volume_attachment. Doing so will result in resource cycling and inconsistent behavior.

@wedneyyuri
Copy link

Potential workaround where the provider is not available:

data "aws_default_tags" "example" {}
aws_instance {
  volume_tags = merge(aws_default_tags.example.default_tags, var.extra_tags)
}

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Sep 23, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2023
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2023
@YakDriver YakDriver reopened this Feb 29, 2024
@github-actions github-actions bot added this to the v5.39.0 milestone Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants