aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

[AWS::ApplicationAutoScaling::ScalingPolicy] - [BUG] - CCAPI get-resource fails with NotFound error

Open
#2,090 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

### Name of the resource

AWS::ApplicationAutoScaling::ScalingPolicy

### Resource Name

_No response_

### Issue Description

This was originally reported in [pulumi-aws-native](https://github.com/pulumi/pulumi-aws-native/issues/1637) which uses CloudControl API.

Deployments fail when trying to perform a `get-resource` on a ScalingPolicy.

### Expected Behavior

`get-resource` returns successfully.

### Observed Behavior

Comand fails with

```console
An error occurred (ResourceNotFoundException) when calling the GetResource operation: AWS::ApplicationAutoScaling::ScalingPolicy Handler returned status FAILED: null (HandlerErrorCode: NotFound, RequestToken: 94c5255d-6b2d-4059-9c28-190207d5853c)
```

### Test Cases

1. Create a dynamodb table
```console
aws cloudcontrol create-resource --desired-state "{\"AttributeDefinitions\":[{\"AttributeName\":\"leaseKey\",\"AttributeType\":\"S\"}],\"KeySchema\":[{\"AttributeName\":\"leaseKey\",\"KeyType\":\"HASH\"}],\"ProvisionedThroughput\":{\"ReadCapacityUnits\":1,\"WriteCapacityUnits\":1},\"TableName\":\"kcl-table-0994f2d\"}" --type-name AWS::DynamoDB::Table
```

2. Create a ScalableTarget
```console
aws cloudcontrol create-resource --desired-state "{\"MaxCapacity\":50,\"MinCapacity\":1,\"ResourceId\":\"table/kcl-table-0994f2d\",\"ScalableDimension\":\"dynamodb:table:ReadCapacityUnits\",\"ServiceNamespace\":\"dynamodb\"}" --type-name AWS::ApplicationAutoScaling::ScalableTarget
```

3. Create a ScalingPolicy
```console
aws cloudcontrol create-resource --desired-state "{\"PolicyName\":\"DynamoDBReadCapacityUtilization:table/kcl-table-0994f2d\",\"PolicyType\":\"TargetTrackingScaling\",\"ResourceId\":\"table/kcl-table-0994f2d\",\"ScalableDimension\":\"dynamodb:table:ReadCapacityUnits\",\"ServiceNamespace\":\"dynamodb\",\"TargetTrackingScalingPolicyConfiguration\":{\"PredefinedMetricSpecification\":{\"PredefinedMetricType\":\"DynamoDBReadCapacityUtilization\"},\"ScaleInCooldown\":300,\"ScaleOutCooldown\":30,\"TargetValue\":85}}" --type-name AWS::ApplicationAutoScaling::ScalingPolicy
```

4. Get the identifier of the ScalingPolicy
```console
identifier=$(aws cloudcontrol list-resources --type-name AWS::ApplicationAutoScaling::ScalingPolicy --resource-model '{"ServiceNamespace": "dynamodb"}' --query 'ResourceDescriptions[0].Identifier' --output text)
```

5. Try to `get-resource`
```console
aws cloudcontrol get-resource --type-name AWS::ApplicationAutoScaling::ScalingPolicy --identifier $identifier
```

### Other Details

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the documented sequence with the AWS Cloud Control API: create the DynamoDB table, ScalableTarget, and ScalingPolicy, then run list-resources and get-resource for AWS::ApplicationAutoScaling::ScalingPolicy. Start by tracing the get-resource handling for this resource type and compare it with creation and listing; done means get-resource returns successfully instead of ResourceNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.