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/autoscaling_group Add support for service linked roles #3812

Merged
merged 3 commits into from
Mar 23, 2018

Conversation

swestcott
Copy link
Contributor

Closes #3587

make testacc TEST=./aws TESTARGS='-run=TestAccAWSAutoScalingGroup_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSAutoScalingGroup_ -timeout 120m
=== RUN   TestAccAWSAutoScalingGroup_importBasic
--- PASS: TestAccAWSAutoScalingGroup_importBasic (224.38s)
=== RUN   TestAccAWSAutoScalingGroup_basic
--- PASS: TestAccAWSAutoScalingGroup_basic (328.20s)
=== RUN   TestAccAWSAutoScalingGroup_namePrefix
--- PASS: TestAccAWSAutoScalingGroup_namePrefix (100.43s)
=== RUN   TestAccAWSAutoScalingGroup_autoGeneratedName
--- PASS: TestAccAWSAutoScalingGroup_autoGeneratedName (67.28s)
=== RUN   TestAccAWSAutoScalingGroup_terminationPolicies
--- PASS: TestAccAWSAutoScalingGroup_terminationPolicies (158.46s)
=== RUN   TestAccAWSAutoScalingGroup_tags
--- PASS: TestAccAWSAutoScalingGroup_tags (321.11s)
=== RUN   TestAccAWSAutoScalingGroup_VpcUpdates
--- PASS: TestAccAWSAutoScalingGroup_VpcUpdates (154.30s)
=== RUN   TestAccAWSAutoScalingGroup_WithLoadBalancer
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer (259.30s)
=== RUN   TestAccAWSAutoScalingGroup_withPlacementGroup
--- PASS: TestAccAWSAutoScalingGroup_withPlacementGroup (201.79s)
=== RUN   TestAccAWSAutoScalingGroup_enablingMetrics
--- PASS: TestAccAWSAutoScalingGroup_enablingMetrics (220.74s)
=== RUN   TestAccAWSAutoScalingGroup_suspendingProcesses
--- PASS: TestAccAWSAutoScalingGroup_suspendingProcesses (289.77s)
=== RUN   TestAccAWSAutoScalingGroup_withMetrics
--- PASS: TestAccAWSAutoScalingGroup_withMetrics (127.91s)
=== RUN   TestAccAWSAutoScalingGroup_serviceLinkedRoleARN
--- PASS: TestAccAWSAutoScalingGroup_serviceLinkedRoleARN (64.32s)
=== RUN   TestAccAWSAutoScalingGroup_ALB_TargetGroups
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (199.96s)
=== RUN   TestAccAWSAutoScalingGroup_initialLifecycleHook
--- PASS: TestAccAWSAutoScalingGroup_initialLifecycleHook (305.06s)
=== RUN   TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (386.35s)
=== RUN   TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier
--- PASS: TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier (99.87s)
=== RUN   TestAccAWSAutoScalingGroup_emptyAvailabilityZones
--- PASS: TestAccAWSAutoScalingGroup_emptyAvailabilityZones (106.33s)
PASS
ok    github.com/terraform-providers/terraform-provider-aws/aws 3615.562s

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Mar 16, 2018
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/autoscaling Issues and PRs that pertain to the autoscaling service. labels Mar 16, 2018
@bflad bflad added this to the v1.12.0 milestone Mar 16, 2018
@jwieringa
Copy link
Contributor

Thank you for the PR, this option is an option that I need as well.

bflad
bflad previously requested changes Mar 23, 2018
"service_linked_role_arn": {
Type: schema.TypeString,
Optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you'll need to add Computed: true, for this new attribute as well since I'm getting all test failures with:

=== RUN   TestAccAWSAutoScalingGroup_ALB_TargetGroups
--- FAIL: TestAccAWSAutoScalingGroup_ALB_TargetGroups (78.41s)
    testing.go:518: Step 0 error: After applying this step, the plan was not empty:
        
        DIFF:
        
        UPDATE: aws_autoscaling_group.bar
          service_linked_role_arn: "arn:aws:iam::*******:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling" => ""

=== RUN   TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity
--- FAIL: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (336.79s)
    testing.go:518: Step 0 error: After applying this step, the plan was not empty:
        
        DIFF:
        
        UPDATE: aws_autoscaling_group.bar
          service_linked_role_arn: "arn:aws:iam::*******:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling" => ""

...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, interesting the tests pass for me both with and without Computed: true... I'll make the amendment in the moment.

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be related to if an AWS account has already had the service linked role automatically created by AWS. Running the acceptance tests again!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ha, here it is:

For existing EC2 Auto Scaling customers, EC2 Auto Scaling will add a default EC2 Auto Scaling service-linked role in your account and your existing Auto Scaling groups will be updated to use this role over the next few weeks.

https://aws.amazon.com/about-aws/whats-new/2018/02/amazon-ec2-auto-scaling-adds-support-for-service-linked-roles/

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Mar 23, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution! 😄 Let's get this into the release.

Test failure unrelated:

Tests failed: 1, passed: 17
=== RUN   TestAccAWSAutoScalingGroup_autoGeneratedName
--- PASS: TestAccAWSAutoScalingGroup_autoGeneratedName (54.98s)
=== RUN   TestAccAWSAutoScalingGroup_serviceLinkedRoleARN
--- PASS: TestAccAWSAutoScalingGroup_serviceLinkedRoleARN (56.05s)
=== RUN   TestAccAWSAutoScalingGroup_emptyAvailabilityZones
--- PASS: TestAccAWSAutoScalingGroup_emptyAvailabilityZones (60.97s)
=== RUN   TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier
--- PASS: TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier (90.47s)
=== RUN   TestAccAWSAutoScalingGroup_VpcUpdates
--- PASS: TestAccAWSAutoScalingGroup_VpcUpdates (98.07s)
=== RUN   TestAccAWSAutoScalingGroup_namePrefix
--- PASS: TestAccAWSAutoScalingGroup_namePrefix (108.25s)
=== RUN   TestAccAWSAutoScalingGroup_withMetrics
--- PASS: TestAccAWSAutoScalingGroup_withMetrics (114.73s)
=== RUN   TestAccAWSAutoScalingGroup_terminationPolicies
--- PASS: TestAccAWSAutoScalingGroup_terminationPolicies (147.11s)
=== RUN   TestAccAWSAutoScalingGroup_withPlacementGroup
--- PASS: TestAccAWSAutoScalingGroup_withPlacementGroup (151.24s)
=== RUN   TestAccAWSAutoScalingGroup_ALB_TargetGroups
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (166.40s)
=== RUN   TestAccAWSAutoScalingGroup_enablingMetrics
--- PASS: TestAccAWSAutoScalingGroup_enablingMetrics (181.19s)
=== RUN   TestAccAWSAutoScalingGroup_importBasic
--- PASS: TestAccAWSAutoScalingGroup_importBasic (211.20s)
=== RUN   TestAccAWSAutoScalingGroup_suspendingProcesses
--- PASS: TestAccAWSAutoScalingGroup_suspendingProcesses (244.18s)
=== RUN   TestAccAWSAutoScalingGroup_tags
--- PASS: TestAccAWSAutoScalingGroup_tags (264.98s)
=== RUN   TestAccAWSAutoScalingGroup_basic
--- PASS: TestAccAWSAutoScalingGroup_basic (301.56s)
=== RUN   TestAccAWSAutoScalingGroup_initialLifecycleHook
--- PASS: TestAccAWSAutoScalingGroup_initialLifecycleHook (317.43s)
=== RUN   TestAccAWSAutoScalingGroup_WithLoadBalancer
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer (327.29s)
=== RUN   TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity
--- FAIL: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (766.66s)
    testing.go:518: Step 0 error: Error applying: 2 error(s) occurred:
        
        * aws_autoscaling_group.bar: 1 error(s) occurred:
        
        * aws_autoscaling_group.bar: "tf-asg-20180323151034815600000003": Waiting up to 10m0s: Need at least 2 healthy instances in ELB, have 0. Most recent activity: {
          ActivityId: "e715894d-a5d1-ff7b-03fa-fa93241189c2",
          AutoScalingGroupName: "tf-asg-20180323151034815600000003",
          Cause: "At 2018-03-23T15:10:35Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 2.  At 2018-03-23T15:10:40Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 2.",
          Description: "Launching a new EC2 instance: i-0af1abc35a652a85c",
          Details: "{\"Subnet ID\":\"subnet-04cd014f\",\"Availability Zone\":\"us-west-2a\"}",
          EndTime: 2018-03-23 15:11:16 +0000 UTC,
          Progress: 100,
          StartTime: 2018-03-23 15:10:42.815 +0000 UTC,
          StatusCode: "Successful"
        }
        * aws_lb.test_lb: 1 error(s) occurred:
        
        * aws_lb.test_lb: Error creating Application Load Balancer: InvalidSubnet: VPC vpc-acb5ced5 has no internet gateway
            status code: 400, request id: 5531ce18-2eac-11e8-a765-295bf89d1c77

@bflad bflad merged commit cba739f into hashicorp:master Mar 23, 2018
bflad added a commit that referenced this pull request Mar 23, 2018
@bflad
Copy link
Contributor

bflad commented Mar 23, 2018

This has been released in version 1.12.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 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 Apr 7, 2020
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/autoscaling Issues and PRs that pertain to the autoscaling service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for new IAM roles on Auto Scaling groups
3 participants