-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hosted Zone NameServers & Nested Stack Output Not a String #33208
Comments
@aubsamai Good morning. Could you please share the complete CDK code which includes NestedStack as well. Looking at the CFN output in issue description, it appears that Thanks, |
@ashishdhingra Good morning, I have provided the complete code including the nested stack in the reproducible steps section above. The `CfnOutput` is generated automatically by CDK due to the cross-stack dependency when doing the delegation.
About the workaround can I stop this output from automatically being created so that I can create it myself and import in the parent stack? If not the error will continue since it is causing the template to be invalid...
|
Using the below CDK code: import * as cdk from 'aws-cdk-lib';
import * as route53 from "aws-cdk-lib/aws-route53";
export class CdktestStackNew extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const parentHostedZone = new route53.PublicHostedZone(this, "ParentHostedZone", {
zoneName: "parent-hosted-zone.com"
});
const nestedStack = new cdk.NestedStack(this, "NestedStack");
const subdomainHostedZoneInNestedStack = new route53.PublicHostedZone(nestedStack, "NestedStackHostedZone", {
zoneName: "nested.parent-hosted-zone.com",
});
parentHostedZone.addDelegation(subdomainHostedZoneInNestedStack);
}
} generates the below CloudFormation template: Resources:
ParentHostedZoneC2BD86E1:
Type: AWS::Route53::HostedZone
Properties:
Name: parent-hosted-zone.com.
Metadata:
aws:cdk:path: CdktestStackNew/ParentHostedZone/Resource
ParentHostedZoneparenthostedzonecomnestedparenthostedzonecom6CB48059:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId:
Ref: ParentHostedZoneC2BD86E1
Name: nested.parent-hosted-zone.com.
ResourceRecords:
Fn::GetAtt:
- NestedStackNestedStackNestedStackNestedStackResourceB70834FD
- Outputs.CdktestStackNewNestedStackNestedStackHostedZoneDA4D61A4NameServers
TTL: "172800"
Type: NS
Metadata:
aws:cdk:path: CdktestStackNew/ParentHostedZone/parent-hosted-zone.com -> nested.parent-hosted-zone.com/Resource
NestedStackNestedStackNestedStackNestedStackResourceB70834FD:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL:
Fn::Join:
- ""
- - https://s3.us-east-2.
- Ref: AWS::URLSuffix
- /cdk-hnb659fds-assets-139480602983-us-east-2/dcc43473be1d9a3b6db62bc98c7bc0c6566b958a2a99666ee4213b8c768c7fb6.json
UpdateReplacePolicy: Delete
DeletionPolicy: Delete
Metadata:
aws:cdk:path: CdktestStackNew/NestedStack.NestedStack/NestedStack.NestedStackResource
aws:asset:path: CdktestStackNewNestedStack0D3B3725.nested.template.json
aws:asset:property: TemplateURL
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Analytics: v2:deflate64:H4sIAAAAAAAA/02MsQ7CMBBDv6V7crQFVHYYGFG7saA0OVDakJNyCR2q/jsKWVhsP8tyC03XQV2phaU2s3R2hHWISs9CLfwIlCIe97De0uisvhJHNHfyKM5P/0dZLujwpaIl36OmYPKkpAHjlqn8/mqmFDRuwpNBmHj3aU7Q1nCoJrZWhuSjfSP0xb/FzucQpQAAAA==
Metadata:
aws:cdk:path: CdktestStackNew/CDKMetadata/Default For below resource: ...
ParentHostedZoneparenthostedzonecomnestedparenthostedzonecom6CB48059:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId:
Ref: ParentHostedZoneC2BD86E1
Name: nested.parent-hosted-zone.com.
ResourceRecords:
Fn::GetAtt:
- NestedStackNestedStackNestedStackNestedStackResourceB70834FD
- Outputs.CdktestStackNewNestedStackNestedStackHostedZoneDA4D61A4NameServers
TTL: "172800"
Type: NS
Metadata:
aws:cdk:path: CdktestStackNew/ParentHostedZone/parent-hosted-zone.com -> nested.parent-hosted-zone.com/Resource the Output might not be prevented from automatically generated since the code here explicitly accesses Marking the issue as |
Describe the bug
Scenario:
HostedZone
.Issue:
When deploying this change the following error occurs:
Related past issue: #22846
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
CDK generated CloudFormation Output should be valid for a NameServer in a nested stack.
Current Behavior
Reproduction Steps
CDK Output for the Nested Stack
The NameServer delegation in the CloudFormation output in the nested stack is not identified as a string which is causing the error. This output is generated by CDK.
CDK Version: 2.177.0
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.177.0 (build b396961)
Framework Version
No response
Node.js Version
v22.7.0
OS
MacOS 14.6.1
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: