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

Can the Regex for importing aws_appautoscaling_policy be relaxed to allow / symbols. #8306

Closed
kave opened this issue Apr 12, 2019 · 4 comments · Fixed by #8397
Closed

Can the Regex for importing aws_appautoscaling_policy be relaxed to allow / symbols. #8306

kave opened this issue Apr 12, 2019 · 4 comments · Fixed by #8397
Labels
bug Addresses a defect in current functionality.
Milestone

Comments

@kave
Copy link

kave commented Apr 12, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.13
+ provider.aws v2.6.0
+ provider.cloudflare v1.12.0
+ provider.datadog v1.7.0
+ provider.template v2.1.1

Affected Resource(s)

  • aws_appautoscaling_policy

Panic Output

Error: module.data_global.module.sisyphus_autoscaling_usw2.aws_appautoscaling_policy.dynamodb_table_read_policy (import id: dynamodb/table/sisyphus_userroles_with_team/dynamodb:table:ReadCapacityUnits/dynamodb:table:ReadCapacityUnits/table/sisyphus_userroles_with_team): 1 error(s) occurred:

* import module.data_global.module.test_autoscaling_usw2.aws_appautoscaling_policy.dynamodb_table_read_policy result: test: aws_appautoscaling_policy.dynamodb_table_read_policy: Failed to read scaling policy: Error retrieving scaling policies: ValidationException: 1 validation error detected: Value 'table' at 'scalableDimension' failed to satisfy constraint: Member must satisfy enum value set: [dynamodb:table:ReadCapacityUnits, dynamodb:index:ReadCapacityUnits, rds:cluster:ReadReplicaCount, elasticmapreduce:instancefleet:SpotCapacity, appstream:fleet:DesiredCapacity, dynamodb:index:WriteCapacityUnits, elasticmapreduce:instancefleet:OnDemandCapacity, rds:cluster:Capacity, dynamodb:table:WriteCapacityUnits, custom-resource:ResourceType:Property, sagemaker:variant:DesiredInstanceCount, ec2:spot-fleet-request:TargetCapacity, elasticmapreduce:instancegroup:InstanceCount, ecs:service:DesiredCount]

Expected Behavior

  • it should have imported successfully

Actual Behavior

the required id <service-namespace>/<resource-id>/<scalable-dimension>/<policy-name> doesn't validate correctly if policy-name also includes /

Steps to Reproduce

  • terraform import module.data_global.module.sisyphus_autoscaling_usw2.aws_appautoscaling_policy.dynamodb_table_read_policy dynamodb/table/test/dynamodb:table:ReadCapacityUnits/DynamoDBReadCapacityUtilization:table/test
@jdecarli
Copy link
Contributor

jdecarli commented Apr 21, 2019

I'm facing exactly the same issue.

According to the documentation, the name of the policy of a DynamoDB table will always be in a format similar to: DynamoDBReadCapacityUtilization:table/tableName Which means the issue takes part of the policy name as a scaling policy.

I found the code is treating dynamoDB target resource id as ECS/RDS (with no slashes (/) in the policy name), and it interpolates in a wrong way. This might work for ECS and RDS scaling, but it fails for DynamoDB.

Also I would propose a couple of changes to the defect:

  • There's no regex, I might change the title of the bug to something like Importing aws_appautoscaling_policy fails for DynamoDB policy
  • Adding the label:bug
  • Adding the label:service/applicationautoscaling

I sent pull request #8397 that fixes this issue. Let's see if it's accepted :-)

@nywilken
Copy link
Contributor

The fix to the aws_appautoscaling_policy resource has been merged and will be released with version 2.20.0 of the Terraform AWS provider.

@nywilken
Copy link
Contributor

The fix to the aws_appautoscaling_policy resource, has been released in version 2.20.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this resource, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 2, 2019

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 Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants