Skip to content

(cloudfront): the auto generated name of cache policy must be unique in the account #13629

@zxkane

Description

@zxkane

Deploying the same application in different regions, the second deployment failed with error message Internal error reported from downstream service during operation 'AWS::CloudFront::CachePolicy'. It’s caused by the generated name of CachePolicy are same for multiple deployments.

Reproduction Steps

Create an app with a distribution like below,

      new Distribution(this, 'Distribution', {
        defaultBehavior: {
          origin: new S3Origin(websiteBucket),
          viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
          allowedMethods: AllowedMethods.ALLOW_GET_HEAD,
          cachePolicy: new CachePolicy(this, 'defaultCachePolicy', {
            defaultTtl: Duration.days(7),
            minTtl: Duration.seconds(0),
            maxTtl: Duration.days(30),
            enableAcceptEncodingGzip: true,
            enableAcceptEncodingBrotli: true,
          }),
        },
        defaultRootObject: 'index.html',
      });
    }

What did you expect to happen?

The auto generated name of policy name is unique in the account, it might depend on the region and name of stack.

What actually happened?

Environment

  • CDK CLI Version : 1.91.0
  • Framework Version:
  • Node.js Version:
  • OS :
  • Language (Version):

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-cloudfrontRelated to Amazon CloudFrontbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions