Skip to content
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

fix(route53): dummy hosted zone has right name #2995

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, haveResource } from '@aws-cdk/assert';
import { PublicHostedZone } from '@aws-cdk/aws-route53';
import { Stack } from '@aws-cdk/cdk';
import { HostedZone, PublicHostedZone } from '@aws-cdk/aws-route53';
import { App, Stack } from '@aws-cdk/cdk';
import { Test } from 'nodeunit';
import { DnsValidatedCertificate } from '../lib/dns-validated-certificate';

Expand Down Expand Up @@ -123,4 +123,35 @@ export = {
}));
test.done();
},

'works with imported zone'(test: Test) {
// GIVEN
const app = new App();
const stack = new Stack(app, 'Stack', {
env: { account: '12345678', region: 'us-blue-5' },
});
const imported = HostedZone.fromLookup(stack, 'ExampleDotCom', {
domainName: 'mydomain.com',
});

// WHEN
new DnsValidatedCertificate(stack, 'Cert', {
domainName: 'mydomain.com',
hostedZone: imported,
});

// THEN
expect(stack).to(haveResource('AWS::CloudFormation::CustomResource', {
ServiceToken: {
'Fn::GetAtt': [
'CertCertificateRequestorFunction98FDF273',
'Arn'
]
},
DomainName: 'mydomain.com',
HostedZoneId: 'DUMMY'
}));

test.done();
},
};
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-route53/lib/hosted-zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class HostedZone extends Resource implements IHostedZone {
public static fromLookup(scope: Construct, id: string, query: HostedZoneProviderProps): IHostedZone {
const DEFAULT_HOSTED_ZONE: HostedZoneContextResponse = {
Id: '/hostedzone/DUMMY',
Name: 'example.com',
Name: query.domainName,
};

interface HostedZoneContextResponse {
Expand Down