-
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_appautoscaling_target: Support updating max_capacity, min_capacity, and role_arn attributes #2542
Conversation
…ity, and role_arn attributes
} | ||
|
||
if d.HasChange("role_arn") { | ||
input.RoleARN = aws.String(d.Get("role_arn").(string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the role_arn update in tests so that we ensure it's all ok?
Seems rather good for me otherwise :)
* Add role_arn attribute testing * Add update ValidationException retrying for IAM eventual consistency
@Ninir updated! Thanks for noticing that. I changed the test to actually update the IAM role and it triggered an IAM eventual consistency issue, which is now fixed with retries:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the test.
One thing that I'd consider is to repurpose the existing resourceAwsAppautoscalingTargetCreate
method (call it resourceAwsAppautoscalingTargetPut
or something like that) instead of adding a new one since they seem to be doing the same thing.
It's not only going to be shorter/cleaner, but should address some confusions I noticed in the current Update
implementation. It seems we'd be wiping existing max_capacity
and/or min_capacity
and/or role_arn
if it's not being changed in a single update call.
Let me know what you think.
@@ -74,8 +72,8 @@ func resourceAwsAppautoscalingTargetCreate(d *schema.ResourceData, meta interfac | |||
_, err = conn.RegisterScalableTarget(&targetOpts) | |||
|
|||
if err != nil { | |||
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "ValidationException" { | |||
log.Printf("[DEBUG] Retrying creation of Application Autoscaling Scalable Target due to possible issues with IAM: %s", awsErr) | |||
if isAWSErr(err, "ValidationException", "Unable to assume IAM role") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 More precise matching, yey
Given the large amount of headache with the newly forced IAM service roles, I'm going to resubmit this PR, likely without |
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! |
The RegisterScalableTarget API call supports updating attributes on existing targets.
Closes #240 and potentially #968