diff --git a/packages/@aws-cdk/cdk/lib/app.ts b/packages/@aws-cdk/cdk/lib/app.ts index 24411bfae6215..f3e7c6a90ff8a 100644 --- a/packages/@aws-cdk/cdk/lib/app.ts +++ b/packages/@aws-cdk/cdk/lib/app.ts @@ -3,15 +3,12 @@ import fs = require('fs'); import path = require('path'); import { Stack } from './cloudformation/stack'; import { Construct, MetadataEntry, PATH_SEP, Root } from './core/construct'; -import { ITaggable, TagManager } from './core/tag-manager'; import { resolve } from './core/tokens'; /** * Represents a CDK program. */ -export class App extends Root implements ITaggable { - - public readonly tags: TagManager; +export class App extends Root { /** * Initializes a CDK application. * @param request Optional toolkit request (e.g. for tests) @@ -19,7 +16,6 @@ export class App extends Root implements ITaggable { constructor() { super(); this.loadContext(); - this.tags = new TagManager(this); } private get stacks() { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index 987910ad944fe..82cce8b4f1538 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -1,7 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { App } from '../app'; import { Construct, PATH_SEP } from '../core/construct'; -import { ITaggable, TagManager, Tags } from '../core/tag-manager'; import { resolve, Token } from '../core/tokens'; import { Environment } from '../environment'; import { CloudFormationToken } from './cloudformation-token'; @@ -23,18 +22,12 @@ export interface StackProps { * Optional. If not supplied, the HashedNamingScheme will be used. */ namingScheme?: IAddressingScheme; - - /** - * Tags for the Constructs of this stack - */ - tags?: Tags; } /** * A root construct which represents a single CloudFormation stack. */ -export class Stack extends Construct implements ITaggable { - +export class Stack extends Construct { /** * Traverses the tree and looks up for the Stack root. * @param node A construct in the tree @@ -99,11 +92,6 @@ export class Stack extends Construct implements ITaggable { */ public readonly name: string; - /** - * Tag Manager for this Stack - */ - public readonly tags: TagManager; - /** * Creates a new stack. * @@ -118,10 +106,6 @@ export class Stack extends Construct implements ITaggable { this.logicalIds = new LogicalIDs(props && props.namingScheme ? props.namingScheme : new HashedAddressingScheme()); this.name = name || 'Stack'; - const tags = props ? props.tags || {} : {}; - this.tags = new TagManager(this, { - initialTags: tags, - }); } /** diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts index c369289baaea8..8e27bc94f5818 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts @@ -1,6 +1,5 @@ import { Test } from 'nodeunit'; -import { App, Condition, Construct, Include, ITaggable, - Output, Parameter, Resource, Root, Stack, TagManager, Token } from '../../lib'; +import { App, Condition, Construct, Include, Output, Parameter, Resource, Root, Stack, Token } from '../../lib'; export = { 'a stack can be serialized into a CloudFormation template, initially it\'s empty'(test: Test) { @@ -190,30 +189,6 @@ export = { test.done(); }, - 'Stack Tags can be propagated to children Contructs'(test: Test) { - // GIVEN - - // default is propagate - const stack = new Stack(undefined, 'Name', {tags: { - TagKey: 'TagValue', - }}); - stack.tags.setTag('TagKey2', 'TagValue2', { propagate: true }); - // this tag basically disappears until we implement stack level tags - stack.tags.setTag('TagKey3', 'TagValue3', { propagate: false}); - - // WHEN - - const taggedConstruct = new TaggableConstruct(stack, 'Taggable'); - - // THEN - - test.deepEqual(taggedConstruct.tags.resolve(), [ - {key: 'TagKey', value: 'TagValue'}, - {key: 'TagKey2', value: 'TagValue2'}, - ]); - - test.done(); - } }; class StackWithPostProcessor extends Stack { @@ -231,11 +206,3 @@ class StackWithPostProcessor extends Stack { return template; } } - -class TaggableConstruct extends Construct implements ITaggable { - public readonly tags: TagManager; - constructor(parent: Construct, name: string) { - super(parent, name); - this.tags = new TagManager(parent); - } -} diff --git a/packages/@aws-cdk/cdk/test/test.app.ts b/packages/@aws-cdk/cdk/test/test.app.ts index 392e5ffa723db..177ac8682219d 100644 --- a/packages/@aws-cdk/cdk/test/test.app.ts +++ b/packages/@aws-cdk/cdk/test/test.app.ts @@ -3,7 +3,7 @@ import fs = require('fs'); import { Test } from 'nodeunit'; import os = require('os'); import path = require('path'); -import { Construct, ITaggable, Resource, Stack, StackProps, TagManager } from '../lib'; +import { Construct, Resource, Stack, StackProps } from '../lib'; import { App } from '../lib/app'; function withApp(context: { [key: string]: any } | undefined, block: (app: App) => void) { @@ -266,31 +266,11 @@ export = { test.done(); }, - 'App Tags can be propagated to all Stacks in the app'(test: Test) { - // Given - - const app = new App(); - app.tags.setTag('AppName', 'MyApp'); - - // WHEN - const stack = new Stack(app, 'MyStack'); - const stack2 = new Stack(app, 'MyStack2'); - const construct = new MyConstruct(stack, 'Mine'); - const construct2 = new MyConstruct(stack2, 'Stack2'); - - // Then - test.deepEqual(construct.tags.resolve(), [{key: 'AppName', value: 'MyApp'}]); - test.deepEqual(construct2.tags.resolve(), [{key: 'AppName', value: 'MyApp'}]); - test.done(); - }, }; -class MyConstruct extends Construct implements ITaggable { - public readonly tags: TagManager; - +class MyConstruct extends Construct { constructor(parent: Construct, name: string) { super(parent, name); - this.tags = new TagManager(parent); new Resource(this, 'r1', { type: 'ResourceType1' }); new Resource(this, 'r2', { type: 'ResourceType2', properties: { FromContext: this.getContext('ctx1') } });