Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

aws_route53_patterns: Use of deprecated aws_cloudfront.CloudFrontWebDistribution #31546

Open
1 task
brianfrantz opened this issue Sep 24, 2024 · 2 comments
Open
1 task
Labels
@aws-cdk/aws-route53-patterns bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@brianfrantz
Copy link

Describe the bug

After upgrading to CDK v2.158.0, I'm seeing deprecation warnings that I traced to use of the aws_route53_patterns.HttpsRedirect construct:

[WARNING] aws-cdk-lib.aws_cloudfront.CloudFrontWebDistribution is deprecated.
  Use `Distribution` instead
  This API will be removed in the next major release.

Appears that the HttpsRedirect construct needs to be updated to use Distribution instead of CloudFrontWebDistribution.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

2.147.3 (may be later - I upgraded from 2.147.3 straight to 2.158.0)

Expected Behavior

No changes and no deprecations after upgrading CDK version

Current Behavior

[WARNING] aws-cdk-lib.aws_cloudfront.CloudFrontWebDistribution is deprecated.
  Use `Distribution` instead
  This API will be removed in the next major release.

Reproduction Steps

Upgraded CDK project that included use of HttpsRedirect

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.158.0 (build 4b8714d)

Framework Version

No response

Node.js Version

v18.17.1

OS

MacOS

Language

TypeScript

Language Version

No response

Other information

No response

@brianfrantz brianfrantz added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 24, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 25, 2024
@khushail
Copy link
Contributor

khushail commented Sep 25, 2024

Hi @brianfrantz , thanks for reporting this.

Looking at the HttpsRedirectProps, the targetDomain is basically -

An alias record will be created that points to your CloudFront distribution. Root domain or sub-domain can be supplied.

checking the cdk code -

https://github.com/aws/aws-cdk/blob/c66f4e39ad8c7f614035472b14f670acceb2ecb9/packages/aws-cdk-lib/aws-route53-patterns/lib/website-redirect.ts#L94C1-L103C8

    domainNames.forEach((domainName) => {
      const hash = md5hash(domainName).slice(0, 6);
      const aliasProps = {
        recordName: domainName,
        zone: props.zone,
        target: RecordTarget.fromAlias(new CloudFrontTarget(redirectDist)),
      };
      new ARecord(this, `RedirectAliasRecord${hash}`, aliasProps);
      new AaaaRecord(this, `RedirectAliasRecordSix${hash}`, aliasProps);
    });

which is using deprecated CloudfrontWebdsitribution -

const redirectDist = new CloudFrontWebDistribution(this, 'RedirectDistribution', {

Hence the warning message. This should definitely be updated. I am marking this as P1 which means this would be on team's priority list for further action.

@khushail khushail added effort/small Small work item – less than a day of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Sep 25, 2024
@moelasmar moelasmar added p2 effort/medium Medium work item – several days of effort and removed p1 effort/small Small work item – less than a day of effort labels Sep 25, 2024
@gracelu0
Copy link
Contributor

gracelu0 commented Oct 8, 2024

Hi @brianfrantz , thanks for raising this issue. We will likely need to introduce the option to use the new Distribution construct under a feature flag similar to this PR for Certificate. This is to prevent breaking changes as there are a few differences in the default values set by each construct. I am working on a PR for this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/aws-route53-patterns bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

4 participants