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

r/aws_autoscaling_group_tag: new resource for tagging existing ASGs #20009

Closed
wants to merge 1 commit into from

Conversation

jbg
Copy link
Contributor

@jbg jbg commented Jun 30, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Related issues

Relates #13643
Relates #9061
Relates aws/containers-roadmap#724

Background

This PR allows tagging of ASGs created implicitly by other resources. For example, tagging the ASGs created by EKS node groups:

resource "aws_autoscaling_group_tag" "eks_node_group_autoscaler_node_template_capacity_type" {
  for_each = toset(
    [for asg in flatten(
      [for resources in aws_eks_node_group.node_group.resources: resources.autoscaling_groups]
    ): asg.name]
  )

  asg_name = each.value
  tag {
    key = "k8s.io/cluster-autoscaler/node-template/label/eks.amazonaws.com/capacityType"
    value = "SPOT"
    propagate_at_launch = false
  }
}

Output from acceptance testing

$ AWS_PROFILE=terraform-test make testacc TESTARGS='-run=TestAccAWSAutoscalingGroupTag'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAutoscalingGroupTag -timeout 180m
=== RUN   TestAccAWSAutoscalingGroupTag_basic
=== PAUSE TestAccAWSAutoscalingGroupTag_basic
=== RUN   TestAccAWSAutoscalingGroupTag_disappears
=== PAUSE TestAccAWSAutoscalingGroupTag_disappears
=== RUN   TestAccAWSAutoscalingGroupTag_Value
=== PAUSE TestAccAWSAutoscalingGroupTag_Value
=== CONT  TestAccAWSAutoscalingGroupTag_basic
=== CONT  TestAccAWSAutoscalingGroupTag_Value
=== CONT  TestAccAWSAutoscalingGroupTag_disappears
--- PASS: TestAccAWSAutoscalingGroupTag_basic (72.00s)
--- PASS: TestAccAWSAutoscalingGroupTag_disappears (79.74s)
--- PASS: TestAccAWSAutoscalingGroupTag_Value (113.01s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	114.407s

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. provider Pertains to the provider itself, rather than any interaction with AWS. service/autoscaling Issues and PRs that pertain to the autoscaling service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. labels Jun 30, 2021
@jbg jbg force-pushed the f-aws_autoscaling_group_tag branch from 44b399f to 2bbbad4 Compare June 30, 2021 07:50
@github-actions github-actions bot added provider Pertains to the provider itself, rather than any interaction with AWS. service/autoscaling Issues and PRs that pertain to the autoscaling service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jun 30, 2021
@jbg jbg force-pushed the f-aws_autoscaling_group_tag branch from 2bbbad4 to c907ffe Compare June 30, 2021 07:54
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @jbg 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@ewbankkit
Copy link
Contributor

Relates: #13783.

@jbg jbg force-pushed the f-aws_autoscaling_group_tag branch from c907ffe to a3f6714 Compare July 12, 2021 02:12
@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Jul 12, 2021
@jbg jbg force-pushed the f-aws_autoscaling_group_tag branch from 5cb61ff to 5377524 Compare July 12, 2021 02:29
@sergkondr
Copy link

Hello! Do you have any updates on that? The impossibility of adding tags to node-group-created autoscaling-group is a very frustrating thing and it prevents us to use cluster autoscaler in EKS.

@jbg
Copy link
Contributor Author

jbg commented Aug 24, 2021

Haven't had any feedback, but that seems fairly normal for PRs on this repo

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Aug 24, 2021
@ewbankkit
Copy link
Contributor

@jbg Thanks for the contribution 🎉 👏.
In order to get this merged for this week's release I used your commits and fixed some formatting errors in #20674.
I also changed the asg_name argument to autoscaling_group_name to match other resources.

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/autoscaling Issues and PRs that pertain to the autoscaling service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants