diff --git a/packages/@aws-cdk/aws-route53/test/test.hosted-zone.ts b/packages/@aws-cdk/aws-route53/test/test.hosted-zone.ts index f9491ca00c30a..45eaed8e8cafb 100644 --- a/packages/@aws-cdk/aws-route53/test/test.hosted-zone.ts +++ b/packages/@aws-cdk/aws-route53/test/test.hosted-zone.ts @@ -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'; @@ -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(); + }, }; diff --git a/packages/@aws-cdk/cfnspec/lib/schema/property.ts b/packages/@aws-cdk/cfnspec/lib/schema/property.ts index 21de42c059640..a5d8bc602347f 100644 --- a/packages/@aws-cdk/cfnspec/lib/schema/property.ts +++ b/packages/@aws-cdk/cfnspec/lib/schema/property.ts @@ -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'; } @@ -224,6 +224,7 @@ export function isPropertyScrutinyType(str: string): str is PropertyScrutinyType const tagPropertyNames = { FileSystemTags: '', + HostedZoneTags: '', Tags: '', UserPoolTags: '', }; @@ -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' ); } diff --git a/packages/@aws-cdk/cfnspec/lib/schema/resource-type.ts b/packages/@aws-cdk/cfnspec/lib/schema/resource-type.ts index 6150c9bdd3dce..aeccfaa04d86f 100644 --- a/packages/@aws-cdk/cfnspec/lib/schema/resource-type.ts +++ b/packages/@aws-cdk/cfnspec/lib/schema/resource-type.ts @@ -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;