aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.52k stars 3.86k forks source link

aws-servicediscovery: hostedZone NameServers undefined behaviour #31391

Open adminy opened 1 week ago

adminy commented 1 week ago

Describe the bug

const namespace = new PublicDnsNamespace(
  stack,
  'ServiceDiscoveryDnsNamespace',
  {
    vpc, name: process.env.PUBLIC_DNS
  }
)
const hostedZone = PublicHostedZone.fromPublicHostedZoneId(
  stack,
  'ServiceDiscoveryNs',
  namespace.namespaceHostedZoneId
)
console.log(">>>>>>>", hostedZone.hostedZoneNameServers, 'should not be undefined!!! but it is ...')

const certificate = new acm.Certificate(stack,  'SSL', {
    domainName: process.env.PUBLIC_DNS,
    hostedZone: hostedZone,
    subjectAlternativeNames: ['*.' + process.env.PUBLIC_DNS],
    transparencyLoggingEnabled: false,
    validation: acm.CertificateValidation.fromDns(hostedZone),
})

image

also errors:

API: certificatemanager:changeResourceRecordSets
The resource hostedzone/XYZ... can only be managed through AWS CloudMap 
(arn:aws:servicediscovery:eu-west-1:${accountId}:namespace/ns-xyz...)

Regression Issue

Last Known Working CDK Version

No response

Expected Behavior

Its an array of NS records instead of undefined.

Current Behavior

undefined is returned

Reproduction Steps

code above ^

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.153.0 (build 2bccd85)

Framework Version

No response

Node.js Version

v20.16.0

OS

NixOS 24.11.20240906.645018b (Vicuna) x86_64

Language

TypeScript

Language Version

No response

Other information

No response

khushail commented 4 days ago

Hi @adminy , thanks for reaching out. I found a similar issue that was reported long time back -https://github.com/aws/aws-cdk/issues/11108 Since hostedzonenameservers is an String array, you could try out this suggestions- https://github.com/aws/aws-cdk/issues/11108#issuecomment-716944888 https://github.com/aws/aws-cdk/issues/11108#issuecomment-753526964

Let me know if this works for you!

github-actions[bot] commented 2 days ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.