Open ss-edward-tran opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Looking at the code https://github.com/jdecarli/terraform-provider-aws/blob/master/aws/resource_aws_appautoscaling_policy.go#L408 In the method resourceAwsAppautoscalingPolicyImport Can see that it allows for a '/' in the resource_id but not in the policy_name
Hope that helps
Is there any workaround @ss-edward-tran ?
I have the same issue - existing ECS auto-scaling policy_name
contain 3-element path: service/<ecs_cluster_name/<ecs_service_name>
in my case ECSServiceAverageMemoryUtilization:service/dev/mms-api
Any other way to avoid slashes in policy_name and import it in terraform state?
P.S. My terraform state show aws_appautoscaling_policy.mms-api
output doesn't contain exactly field named policy_name
. It has 'name', 'id', 'policy_type' but not expected parameter <service-namespace>/<resource-id>/<scalable-dimension>/<policy-name>
My playing around, it seems like the autoscaling policy, if you create another with the same attributes using terraform, it does not conflict with the existing, nor does it create a duplicate. It is like it simply overwrites it. Even to the point that if it was originally in a different tfstate and you import in a new, both states still work with it on a last run wins basis.
Description
I'm trying to import an AWS resource of type aws_appautoscaling_policy from an old terraform state to a new one. This is the aws_appautoscaling_policy id.
its id has 4 components:
ecs
service/sandbox/myservice
ecs:service:DesiredCount
ECSServiceAverageCPUUtilization:service/sandbox/myservice
The command that I used to import the resource is:
But I got this error
I think its because in the policy name it has 2
/
while it shouldn't. Thus, terraform can not parse the scalable_dimension correctly.Note:
Anyone has encountered this kind of issue before and how to fix it? Please let me know. Thank you.
I tried to add escape character from the import command like this but it didnt seem to work:
References
No response
Would you like to implement a fix?
None