Skip to content

Message from CloudFormation about DNS zone mapping not using lazy: true. #31918

Closed
@nomike

Description

Describe the bug

Using this python class and these
parameters results in this
synthesized CloudFormation script.

The noteworthy parts are:

        HostedZoneId:
          Fn::FindInMap:
            - MappingCopyAWSCloudFrontPartitionHostedZoneIdMapc88b0307188360f6083c72a2a857503f8678fb10e7
            - Ref: AWS::Partition
            - zoneId

and

Mappings:
  MappingCopyAWSCloudFrontPartitionHostedZoneIdMapc88b0307188360f6083c72a2a857503f8678fb10e7:
    aws:
      zoneId: Z2FDTNDATAQYW2
    aws-cn:
      zoneId: Z3RFFRIM2A3IF5

According to this CloudFormation user guide, alias records pointing to CloudFront distributions need to use Z2FDTNDATAQYW2 as a hosted zone ID. From the variable naming I assume the mapping is included for a china specific workaround.

The problem with this is that it leads to the following message from CloudFormation:

[Info at /use1-pr-customer-api-public-route53-aliasrecord/MappingCopy-AWSCloudFrontPartitionHostedZoneIdMap-c88b0307188360f6083c72a2a857503f8678fb10e7] Consider making this CfnMapping a lazy mapping by providing `lazy: true`: either no findInMap was called or every findInMap could be immediately resolved without using Fn::FindInMap

Normally it would be clear what to do, but as the affected code is auto-generated and not written by me, it is not possible for me to provide that flag.

Regression Issue

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

Last Known Working CDK Version

No response

Expected Behavior

I would either expect CDK to provide lazy: true or at least the message not to be shown. As there is nothing I can do to get rid of it the message is just spam and doesn't help me at all.

Current Behavior

CloudFormation shows the message I quoted above and there is nothing that can be done about it.

Reproduction Steps

Create two stacks in different regions. Once defining a CloudFront distribution and the other defining a route53 alias record pointing to that distribution.

Possible Solution

It should be evaluated whether providing the lazy: true option would have any negative side effects and if not, it should just be added.

If it's not possible to add this, a more sophisticated approach might be needed.

Additional Information/Context

No response

CDK CLI Version

2.164.1 (build bb9275c)

Framework Version

No response

Node.js Version

v20.5.1

OS

Ubuntu 24.04 LTS

Language

Python

Language Version

Does not apply

Other information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-cloudformationRelated to AWS CloudFormationbugThis issue is a bug.closed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.needs-reproductionThis issue needs reproduction.p2response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions