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

unable to update cloudfront if referenced secret was deleted

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

Description

### Name of the resource

AWS::CloudFront::Distribution

### Resource Name

_No response_

### Issue Description

We have two stacks, one stack that creates a secret and a second stack that imports this secret to use its value in a cloudfront distribution.

Both stacks are deployed via cdk pipeline, first the stack that creates the secret and then the stack that imports it and uses it with cloudfront. The secret is shared via ssm parameter and the secret arn so that there is no dependency between the two stacks.
If we now delete the secret in the first stack and run the our cdk pipeline the update for the cloudfront distribution in the second stack fails, because its trying to get the secret value before removing the reference which of course does not work because the secret was already deleted in the first stack.

If this happens on production the stack cannot be updated and has to be deleted which of course is a no go.

### Expected Behavior

Cloudfront should delete any references to secrets without trying to access their value first.

### Observed Behavior

Cloudfront tries to access the secret value before removing it from cloudfront which fails if the secret was already deleted. this completly blocks the stack because you cannot update cloudfront anymore

### Test Cases

create two stacks, one with a secret the other with a cloudfront distribution that uses the secret somewhere (in our usecase as a defined header to send to the origin). then delete the secret from stack one and try deleting the reference in stack two from the cloudfront distribution

### Other Details

_No response_

Contributor guide

Open the contributing guide

Research direction

No repository files or tests are identified. Reproduce with two CloudFormation stacks using an AWS::CloudFront::Distribution and a secret shared through SSM, then delete the secret and remove its distribution reference; done means the CloudFront update succeeds without trying to read the deleted secret.

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.