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

Support EC2 Create Tags Resource #12500

Closed
e-moshaya opened this issue Mar 22, 2020 · 4 comments · Fixed by #8457
Closed

Support EC2 Create Tags Resource #12500

e-moshaya opened this issue Mar 22, 2020 · 4 comments · Fixed by #8457
Labels
new-resource Introduces a new resource. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@e-moshaya
Copy link

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

aws_spot_instance_request supports creating tags to the spot instance request but not the instance or the volumes. The tags do not get propagated as first thought. Amazon suggests tagging the instances manually using the cli aws ec2 create-tags --resources sir-08b93456 i-1234567890abcdef0 --tags Key=purpose,Value=test

It would be nice to introduce a new resource to create or overwrite tags on the fly in a similar fashion

New or Affected Resource(s)

  • aws_ec2_create_tags

Potential Terraform Configuration

resource "aws_ec2_create_tags" "spot_instance" {
  resources           = ["sir-08b93456", "i-1234567890abcdef0"]
  tags = {
    Name = "spot-instance"
  }
}

References

@e-moshaya e-moshaya added the enhancement Requests to existing resources that expand the functionality or scope. label Mar 22, 2020
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Mar 22, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 22, 2020
@ewbankkit
Copy link
Contributor

@bflad bflad added new-resource Introduces a new resource. and removed enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. labels Jun 13, 2020
@bflad bflad added this to the v2.67.0 milestone Jun 13, 2020
@bflad
Copy link
Contributor

bflad commented Jun 13, 2020

A new aws_ec2_tag resource for managing individual EC2 resource tags has been merged and will release with version 2.67.0 of the Terraform AWS Provider, later next week. This resource should only be used in cases where EC2 resources are created outside Terraform (e.g. AMIs), being shared via Resource Access Manager (RAM), or implicitly created by other means (e.g. Transit Gateway VPN Attachments).

# Example configuration in Terraform 0.12 and later syntax
resource "aws_ec2_transit_gateway" "example" {}

resource "aws_customer_gateway" "example" {
  bgp_asn    = 65000
  ip_address = "172.0.0.1"
  type       = "ipsec.1"
}

resource "aws_vpn_connection" "example" {
  customer_gateway_id = aws_customer_gateway.example.id
  transit_gateway_id  = aws_ec2_transit_gateway.example.id
  type                = aws_customer_gateway.example.type
}

resource "aws_ec2_tag" "example" {
  resource_id = aws_vpn_connection.example.transit_gateway_attachment_id
  key         = "Name"
  value       = "Hello World"
}

As with any Terraform 0.12.6 or later configuration, this resource can be combined with for_each support to manage multiple resource tags, if necessary.

Thanks to @joestump and others who made the implementation possible. 👍

@ghost
Copy link

ghost commented Jun 19, 2020

This has been released in version 2.67.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!

@ghost
Copy link

ghost commented Jul 13, 2020

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!

@ghost ghost locked and limited conversation to collaborators Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
3 participants