Eliminate the expandTags functionality
This change eliminates the AWS package's cloudformation.expandTags functionality. The primary reason is that we haven't yet implemented string/array intrinsics (see marapongo/mu#80), and so the presence of this routine was preventing verification of the AWS library. But, it turns out, the expandTags routine was violating our "zero artistic license" principle for the foundational cloud packages. Namely, it was auto-adding the Name=<name> tag, when the name property was set, capturing an idiomatic AWS resource pattern. Instead of doing that, we will just project tags in their raw form, and add such conveniences (possibly) add a higher level in the layer cake.
This commit is contained in:
parent
11b7880547
commit
acd52778b7
|
@ -17,20 +17,7 @@ export type Tags = Tag[];
|
|||
|
||||
// TagArgs represents a base type for the common pattern of resources accepting tags and a name.
|
||||
export interface TagArgs {
|
||||
// An optional name for this resource.
|
||||
name?: string;
|
||||
// An arbitrary set of tags (key-value pairs) for this resource.
|
||||
tags?: Tags;
|
||||
}
|
||||
|
||||
// expandTags takes a TagArgs and expands the "Name" key in-place, for naming, when present.
|
||||
export function expandTags(args: TagArgs): void {
|
||||
if (args.name !== undefined) {
|
||||
if (args.tags == undefined) {
|
||||
args.tags = [];
|
||||
}
|
||||
args.tags.push({ key: "Name", value: args.name });
|
||||
delete args.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import * as cloudformation from '../cloudformation';
|
|||
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html
|
||||
export class Instance extends cloudformation.Resource {
|
||||
constructor(args: InstanceArgs) {
|
||||
cloudformation.expandTags(args);
|
||||
super({
|
||||
resource: "AWS::EC2::Instance",
|
||||
properties: args,
|
||||
|
|
|
@ -8,7 +8,6 @@ import * as cloudformation from '../cloudformation';
|
|||
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internet-gateway.html
|
||||
export class InternetGateway extends cloudformation.Resource {
|
||||
constructor(args: InternetGatewayArgs) {
|
||||
cloudformation.expandTags(args);
|
||||
super({
|
||||
resource: "AWS::EC2::InternetGateway",
|
||||
properties: args,
|
||||
|
|
|
@ -10,7 +10,6 @@ import * as cloudformation from '../cloudformation';
|
|||
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html
|
||||
export class RouteTable extends cloudformation.Resource {
|
||||
constructor(args: RouteTableArgs) {
|
||||
cloudformation.expandTags(args);
|
||||
super({
|
||||
resource: "AWS::EC2::RouteTable",
|
||||
properties: args,
|
||||
|
|
|
@ -10,7 +10,6 @@ import * as cloudformation from '../cloudformation';
|
|||
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html
|
||||
export class SecurityGroup extends cloudformation.Resource {
|
||||
constructor(args: SecurityGroupArgs) {
|
||||
cloudformation.expandTags(args);
|
||||
super({
|
||||
resource: "AWS::EC2::SecurityGroup",
|
||||
properties: args,
|
||||
|
|
|
@ -9,7 +9,6 @@ import * as cloudformation from '../cloudformation';
|
|||
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
|
||||
export class Subnet extends cloudformation.Resource {
|
||||
constructor(args: SubnetArgs) {
|
||||
cloudformation.expandTags(args);
|
||||
super({
|
||||
resource: "AWS::EC2::Subnet",
|
||||
properties: args,
|
||||
|
|
|
@ -8,7 +8,6 @@ import * as cloudformation from '../cloudformation';
|
|||
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html
|
||||
export class VPC extends cloudformation.Resource {
|
||||
constructor(args: VPCArgs) {
|
||||
cloudformation.expandTags(args);
|
||||
super({
|
||||
resource: "AWS::EC2::VPC",
|
||||
properties: args,
|
||||
|
|
|
@ -10,7 +10,6 @@ import * as cloudformation from '../cloudformation';
|
|||
// @website: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html
|
||||
export class VPCPeeringConnection extends cloudformation.Resource {
|
||||
constructor(args: VPCPeeringConnectionArgs) {
|
||||
cloudformation.expandTags(args);
|
||||
super({
|
||||
resource: "AWS::EC2::VPCPeeringConnection",
|
||||
properties: args,
|
||||
|
|
Loading…
Reference in a new issue