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

[Any Resource?] - [BUG] - Error when replacing an old wait condition id with a new wait condition id in DependsOn

Open
#2,220 0 comments 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::CloudWatch::Alarm

### Resource Name

_No response_

### Issue Description

I tried working around #1097 by randomly generating a wait condition:
```
const DbInstanceWaitCondition = `DbInstanceWaitCondition${randomstring.generate(
{ length: 12 }
)}`
```

And then using it like so in my JS that generates the template:

[DbInstanceWaitCondition]: {
Type: 'AWS::CloudFormation::WaitCondition',
CreationPolicy: {
ResourceSignal: {
Count: 1,
Timeout:
CreationTimeout === undefined
? 'PT15M'
: CreationTimeout ?? undefined,
},
},
},
DiskUsageHighAlarm: {
Type: 'AWS::CloudWatch::Alarm',
DependsOn: [DbInstanceWaitCondition],
Properties: {
AlarmDescription: { 'Fn::Sub': '${AWS::StackName} Disk Usage High' },
AlarmActions: [{ Ref: 'ServiceMonitoringSNSTopicArn' }],
ComparisonOperator: 'GreaterThanThreshold',

### Expected Behavior

I can update a stack with a new wait condition logical resource id without any problems

### Observed Behavior

On update, I sometimes get buggy circular dependency errors:
```
CloudFormationServiceException [ValidationError]: Circular dependency between resources: [DiskUsageHighAlarm]
```

There are no references to DiskUsageHighAlarm anywhere in the template (only one result when I search for it), so there's no way it could be depending on itself.

### Test Cases

- Create a stack with a wait condition named `WaitConditionA` and another resource that depends on `WaitConditionA`
- Signal `WaitConditionA` and wait for the stack to update
- replace `WaitConditionA` with `WaitConditionB` in the template
- Update the stack with the new template

### Other Details

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Test Cases in the issue and reproduce the update from WaitConditionA to WaitConditionB, checking whether CloudFormation reports a circular dependency on DiskUsageHighAlarm. Done means the stack update completes without the false self-dependency error; the payload names no repository files or tests to inspect.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.