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): cannot add tags to HostedZone #7531

Merged
merged 2 commits into from
Apr 23, 2020
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
32 changes: 32 additions & 0 deletions packages/@aws-cdk/aws-route53/test/test.hosted-zone.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect } from '@aws-cdk/assert';
import * as cdk from '@aws-cdk/core';
import { Test } from 'nodeunit';
import { HostedZone } from '../lib';
Expand Down Expand Up @@ -29,4 +30,35 @@ export = {
test.done();
},
},

'Supports tags'(test: Test) {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const hostedZone = new HostedZone(stack, 'HostedZone', {
zoneName: 'test.zone',
});
cdk.Tag.add(hostedZone, 'zoneTag', 'inMyZone');

// THEN
expect(stack).toMatch({
Resources: {
HostedZoneDB99F866: {
Type: 'AWS::Route53::HostedZone',
Properties: {
Name: 'test.zone.',
HostedZoneTags: [
{
Key: 'zoneTag',
Value: 'inMyZone',
},
],
},
},
},
});

test.done();
},
};
6 changes: 4 additions & 2 deletions packages/@aws-cdk/cfnspec/lib/schema/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export interface ComplexMapProperty extends MapPropertyBase {
}

export interface TagPropertyStandard extends PropertyBase {
ItemType: 'Tag' | 'TagsEntry' | 'TagRef' | 'ElasticFileSystemTag';
ItemType: 'Tag' | 'TagsEntry' | 'TagRef' | 'ElasticFileSystemTag' | 'HostedZoneTag';
Type: 'Tags';
}

Expand Down Expand Up @@ -224,6 +224,7 @@ export function isPropertyScrutinyType(str: string): str is PropertyScrutinyType

const tagPropertyNames = {
FileSystemTags: '',
HostedZoneTags: '',
Tags: '',
UserPoolTags: '',
};
Expand Down Expand Up @@ -257,7 +258,8 @@ export function isTagPropertyStandard(prop: Property): prop is TagPropertyStanda
(prop as TagPropertyStandard).ItemType === 'TagsEntry' ||
(prop as TagPropertyStandard).Type === 'Tags' ||
(prop as TagPropertyStandard).ItemType === 'TagRef' ||
(prop as TagPropertyStandard).ItemType === 'ElasticFileSystemTag'
(prop as TagPropertyStandard).ItemType === 'ElasticFileSystemTag' ||
(prop as TagPropertyStandard).ItemType === 'HostedZoneTag'
);

}
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/cfnspec/lib/schema/resource-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface ResourceType extends Documented {
export interface TaggableResource extends ResourceType {
Properties: {
FileSystemTags: TagProperty;
HostedZoneTags: TagProperty;
Tags: TagProperty;
UserPoolTags: TagProperty;
[name: string]: Property;
Expand Down