cdklabs / cdklabs/cdk-ssm-documents

print(): maxAttempts step attribute not set, maxAttempts receives timeoutInSeconds value

Open
#38 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
30
Forks
9
Avg merge
1d 16m
Merged PRs (30d)
7

Description

1. When setting just maxAttempts for a step, the step attribute is not set when printing the document content.\
```python
default_values = {
"max_attempts": 1
}
# Define your steps...
describe_snapshot = ssm.AwsApiStep(
self,
f"{id}describeSnapshot",
name="describeSnapshot",
description="Describe the provided snapshot id",
service="ec2",
pascal_case_api="DescribeSnapshots",
api_params={"SnapshotIds": ["{{ SnapshotId }}"]},
outputs=[
ssm.Output(
name="VolumeId",
output_type=ssm.DataTypeEnum.STRING,
selector="$.Snapshots[0].VolumeId",
),
ssm.Output(
name="State",
output_type=ssm.DataTypeEnum.STRING,
selector="$.Snapshots[0].State",
),
],
is_end=False,
**default_values
)
```

produces:

```yaml
...
mainSteps:
- description: Describe the provided snapshot id
name: describeSnapshot
action: aws:executeAwsApi
inputs:
Service: ec2
Api: DescribeSnapshots
SnapshotIds:
- '{{ SnapshotId }}'
outputs:
- Name: VolumeId
Selector: $.Snapshots[0].VolumeId
Type: String
- Name: State
Selector: $.Snapshots[0].State
Type: String
....
```

2. When setting timeoutInSeconds for a step, maxAttempts is set:

In Python:
```python
default_values = {
"timeout_seconds": 100
}
# Define your steps...
describe_snapshot = ssm.AwsApiStep(
self,
f"{id}describeSnapshot",
name="describeSnapshot",
description="Describe the provided snapshot id",
service="ec2",
pascal_case_api="DescribeSnapshots",
api_params={"SnapshotIds": ["{{ SnapshotId }}"]},
outputs=[
ssm.Output(
name="VolumeId",
output_type=ssm.DataTypeEnum.STRING,
selector="$.Snapshots[0].VolumeId",
),
ssm.Output(
name="State",
output_type=ssm.DataTypeEnum.STRING,
selector="$.Snapshots[0].State",
),
],
is_end=False,
**default_values
)
```

produces:

```yaml
...
mainSteps:
- description: Describe the provided snapshot id
name: describeSnapshot
action: aws:executeAwsApi
inputs:
Service: ec2
Api: DescribeSnapshots
SnapshotIds:
- '{{ SnapshotId }}'
outputs:
- Name: VolumeId
Selector: $.Snapshots[0].VolumeId
Type: String
- Name: State
Selector: $.Snapshots[0].State
Type: String
maxAttempts: 100
....
```

Contributor guide

Open the contributing guide

Research direction

Reproduce both Python examples and inspect the print() serialization path for step attributes. Verify that max_attempts is emitted and that timeout_seconds does not populate maxAttempts; add regression coverage for both cases and confirm the generated YAML matches the inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.