Closed
Description
What is the problem?
Creation of CfnDomainNameApiAssociation and CfnDomainName that the previously mentioned object applies to fails, if is being done under the same stack. If I were to separate them into two different stacks, the error would not occur.
Reproduction Steps
- Create GraphqlApi instance.
- Setup domain name using this code snippet:
[..]
var certificate = new DnsValidatedCertificate(this, $"XXX-Api-Certificate",
new DnsValidatedCertificateProps
{
DomainName = props.DnsName,
Region = "us-east-1",
HostedZone = props.HostedZone
});
var cfnDomainName = new CfnDomainName(this, "XXX-Domain-Name",
new CfnDomainNameProps
{
CertificateArn = certificate.CertificateArn,
Description = "XXX domain name",
DomainName = props.DnsName,
});
new CfnDomainNameApiAssociation(this, "XXX-Domain-Name-Api-Association",
new CfnDomainNameApiAssociationProps
{
ApiId = graphqlApi.ApiId,
DomainName = props.DnsName
});
new CnameRecord(this, $"XXX-Domain-Name-CNameRecord", new CnameRecordProps
{
RecordName = props.DnsName,
DomainName = cfnDomainName.AttrAppSyncDomainName,
Zone = props.HostedZone
});
[..]
What did you expect to happen?
AppSync API with a custom domain name and API association would be created.
What actually happened?
XXX | 5/58 | 6:47:13 AM | CREATE_FAILED | AWS::AppSync::DomainNameApiAssociation | XXX (XXX) Resource handler returned message: "Resource of type 'AWS::AppSync::DomainNameApiAssociation' with identifier 'null' was not found." (RequestToken: 7349ad3a-7dda-4af5-90d9-732ecebe1fbf, HandlerErrorCode: NotFound)
CDK CLI Version
2.7.0
Framework Version
2.7.0
Node.js Version
14.18.3
OS
Debian 10
Language
.NET
Language Version
.net core 3.1
Other information
Observed the same behavior as well with CDK version 1.138.2. Following separation would not show the above error.
// First stack
[..]
var certificate = new DnsValidatedCertificate(this, $"XXX-Api-Certificate",
new DnsValidatedCertificateProps
{
DomainName = props.DnsName,
Region = "us-east-1",
HostedZone = props.HostedZone
});
var cfnDomainName = new CfnDomainName(this, "XXX-Domain-Name",
new CfnDomainNameProps
{
CertificateArn = certificate.CertificateArn,
Description = "XXX domain name",
DomainName = props.DnsName,
});
[..]
// Second stack
[..]
new CfnDomainNameApiAssociation(this, "XXX-Domain-Name-Api-Association",
new CfnDomainNameApiAssociationProps
{
ApiId = graphqlApi.ApiId,
DomainName = props.DnsName
});
new CnameRecord(this, $"XXX-Domain-Name-CNameRecord", new CnameRecordProps
{
RecordName = props.DnsName,
DomainName = cfnDomainName.AttrAppSyncDomainName,
Zone = props.HostedZone
});
[..]
Activity