-
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
aws_appautoscaling_target update detaches any aws_appautoscaling_policy's #240
Comments
Still an issue with terraform 0.9.8. |
I have same problem. I originally posted my case in issue terraform#8099. I post it here again, hope it can help you guys to reproduce the problem.
resource When I change the value of Why is it supposed to? Because in my practice, after |
Glad I found this. Noticed it today when dropping the min_capacity on our target. Checked the console later and noticed the policies were gone. Ran another |
We are also observing the same problem. |
A small workaround for this that appears to be working correctly for my situation is just leveraging the target-id in the name arg for the policy:
This seems to force a destroy and rebuild. |
@alexcallihan Awesome. Thank you very much. Can confirm that work-around works as well. |
I believe #968 is a duplicate of this issue. |
Verified that @alexcallihan workaround makes |
We just merged a change to the |
This has been released in terraform-provider-aws version 1.8.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
Using v1.8.0 of the AWS provider plugin. We noticed that our ECS service would consistently have the AWS service linked IAM role AWSServiceRoleForApplicationAutoScaling_ECSService regardless of the custom role we gave it in the aws_appautoscaling_target resource. Thereby it wasn't idempotent - Terraform would always try to change the IAM role in aws_appautoscaling_target. I could have used an "lifecycle_ignore" hook, so Terraform wouldn't manage the IAM role in the aws_appautoscaling_target . But rather than ignore it, this is what I came up with to fix the idempotency. Is there any gotchas anyone can think of ? data "aws_iam_role" "ecs_service_autoscaling" { resource "aws_appautoscaling_target" "service" { |
I'm seeing the same thing; every I can confirm your workaround solved it, but I'm not yet sure if it's side effect free 😄 |
This I think has already been raised. The role in question is a service linked role which AWS insist that your autoscaking service adopts |
Hi, This is still not working with Terraform 0.12 and unfortunately the above workaround from @alexcallihan doesn't seem to work anymore :( In a nutshell, I have an ECS service with an autoscaling target and a couple of policies. Let's say I make a change that forces the recreation of the service/target: the autoscaling policy is still in the state file but it doesnt get recreated after recreating the ECS service and target. When I look in AWS, the servioce is there but the autoscaling policies and the target are just gone. When I run terraform a second time, then they get recreated:
Any chance this could be looked into? Thanks! My version:
|
Hi folks 👋 If you would like to report potentially lingering issues, please file a new bug report following the issue template. |
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! |
This issue was originally opened by @charlesbjohnson as hashicorp/terraform#8484. It was migrated here as part of the provider split. The original body of the issue is below.
Hi there,
Updating an
aws_appautoscaling_target
(which always forces a new resource) does not trigger dependentaws_appautoscaling_policy
s to be recreated. As a result, updatingmin_capacity
ormax_capacity
causes all dependentaws_appautoscaling_policy
s to be deleted/detached, requiring a subsequentterraform apply
to reattach them.Terraform Version
v0.7.0+
Affected Resource(s)
aws_appautoscaling_target
aws_appautoscaling_policy
Terraform Configuration Files
Expected Behavior
The
aws_appautoscaling_target
would be updated and theaws_appautoscaling_policy
would still be attached.Actual Behavior
The
aws_appautoscaling_target
was deleted and re-created, but theaws_appautoscaling_policy
was lost in the process. A subsequentterraform apply
will add it back, but it either should not have been removed or it should also have been recreated along with theaws_appautoscaling_target
.Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
aws_appautoscaling_target.target.max_capacity
to3
terraform apply
(causes the policy detachment)terraform apply
(reattaches the policy)Important Factoids
According to the AWS docs, the
aws_appautoscaling_target
can be created as well as updated viaRegisterScalableTarget
. Perhaps this could be used instead of recreating theaws_appautoscaling_target
on update.The text was updated successfully, but these errors were encountered: