Aws-cdk: HostedZone.fromlookup not working in nested stacks

Created on 23 Oct 2019  Â·  4Comments  Â·  Source: aws/aws-cdk

When using HostedZone.fromLookUp in a nested stack is not able to find out the hostedzone and keeps the DUMMY id value. Also it does not creates the entry in the context file.

Reproduction Steps

Create a hosted zone in route 53. Then create a stack, inside this stack create a nested stack that just gets a zone based in a domain name:

const zone = HostedZone.fromLookup(this, `zoneId`, {
      domainName: domain
    });

Error Log

No hosted zone found with ID: DUMMY (Service: AmazonRoute53; Status Code: 404; Error Code: NoSuchHostedZone; Request ID: 9868b6a0-6109-48e6-b475-c31c6041778f)

Environment

  • CLI Version : v.1.12.0
  • Framework Version: v.1.12.0
  • OS : mac
  • Language : Typescript

Other


This is :bug: Bug Report

@aws-cdaws-route53 bug efformedium needs-reproduction p1

Most helpful comment

Still happening, can be avoided with command "cdk deploy", only happens when using CloudFormationCreateUpdateStackAction.

All 4 comments

For me, the same error is from
new r53.ARecord(this, id + 'phpadminARecord', { recordName: 'phpadmin', zone: phpadminHostzone, target: r53.RecordTarget.fromAlias(new r53Targets.LoadBalancerTarget(loadBalancerFromOtherStack)) });
Template is

{ "Resources": { "??????????ARecordE5EA89BC": { "Type": "AWS::Route53::RecordSet", "Properties": { "Name": "recordName.hostzonename", "Type": "A", "AliasTarget": { "DNSName": { "Fn::Join": [ "", [ "dualstack.", { "Fn::ImportValue": "phpAdmin-FargateAlb:ExportsOutputFnGetAttphpadminfargateserviceLB1A2C75E2DNSNameA1C77413" } ] ] }, "HostedZoneId": { "Fn::ImportValue": "phpAdmin-FargateAlb:ExportsOutputFnGetAttphpadminfargateserviceLB1A2C75E2CanonicalHostedZoneID5377D125" } }, "HostedZoneId": "PHYSICAL-HOSTEDZONEID" }, "Metadata": { "aws:cdk:path": "phpAdmin-FargateAlbDNS/phpAdmin-FargateAlbDNSphpadminARecord/Resource" } } } }

It seems to be the "HostedZoneId": "PHYSICAL-HOSTEDZONEID" is causing the problem, but only when running inside codepipeline.

Still happening, can be avoided with command "cdk deploy", only happens when using CloudFormationCreateUpdateStackAction.

experiencing the same behavior

CLI Version : v.1.69.0
Language : Typescript

I figured it out, you need to add cdk.context.json into repo to
give CloudFormationCreateUpdateStackAction the context to load host zone.

On Fri, Oct 30, 2020 at 7:58 PM Ilia luk notifications@github.com wrote:

anyone managed to work around this?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/aws/aws-cdk/issues/4651#issuecomment-719849857, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAVPH4LGMFH4N53CYNEJW73SNNHKRANCNFSM4JEG4A7Q
.

Was this page helpful?
0 / 5 - 0 ratings