-
-
Save jen20/ccc91ab961843babf93b119fe67e1938 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as aws from "@pulumi/aws"; | |
import { all } from "@pulumi/pulumi"; | |
async function main(): Promise<any> { | |
const ami = await aws.getAmi({ | |
nameRegex: "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*", | |
mostRecent: true, | |
owners: ["099720109477"], | |
}); | |
const vpc = await aws.ec2.getVpc({ | |
default: true, | |
}); | |
const subnetIds = await aws.ec2.getSubnetIds({ | |
vpcId: vpc.id, | |
}); | |
const serverSecurityGroup = new aws.ec2.SecurityGroup(`repro-security-group`, { | |
description: "ASG Repro SG", | |
ingress: [sgRule("Ingress")], | |
egress: [sgRule("Egress")], | |
}); | |
const launchConfiguration = new aws.ec2.LaunchConfiguration(`repro-launch-config`, { | |
associatePublicIpAddress: false, | |
instanceType: aws.ec2.T2InstanceMicro, | |
imageId: ami.id, | |
securityGroups: [serverSecurityGroup.id], | |
}); | |
// These are throwaway values but demonstrate the problem OK | |
const tagSet = all([ami.id, serverSecurityGroup.id]) | |
.apply(([amiId, secGroupId]) => [ | |
{ | |
key: "AMI", | |
value: amiId, | |
propagateAtLaunch: true, | |
}, | |
{ | |
key: "SecGroup", | |
value: secGroupId, | |
propagateAtLaunch: false, | |
}, | |
]); | |
new aws.autoscaling.Group(`repro-autoscaling-group`, { | |
desiredCapacity: 0, | |
minSize: 0, | |
maxSize: 1, | |
launchConfiguration: launchConfiguration.id, | |
vpcZoneIdentifiers: subnetIds.ids, | |
tags: tagSet, | |
}); | |
} | |
function sgRule(name: string): any { | |
return { | |
description: `All ${name} Traffic`, | |
fromPort: 0, | |
toPort: 0, | |
protocol: "-1", | |
cidrBlocks: ["0.0.0.0/0"], | |
}; | |
} | |
const _ = main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ pulumi version | |
v0.14.3 | |
❯ pulumi preview | |
Previewing update of stack 'pulumi-asg-repro-2-dev' | |
Previewing changes: | |
Type Name Plan Info | |
+ pulumi:pulumi:Stack pulumi-asg-repro-2-pulumi-asg-repro-2-dev create 1 error | |
+ ├─ aws:ec2:SecurityGroup repro-security-group create | |
+ ├─ aws:ec2:LaunchConfiguration repro-launch-config create | |
* └─ global global no change 3 errors | |
Diagnostics: | |
pulumi:pulumi:Stack: pulumi-asg-repro-2-pulumi-asg-repro-2-dev | |
error: One or more resource validation errors occurred; refusing to proceed | |
global: global | |
error: aws:autoscaling/group:Group resource 'repro-autoscaling-group' has a problem: "tag.0.key": required field is not set | |
error: aws:autoscaling/group:Group resource 'repro-autoscaling-group' has a problem: "tag.0.value": required field is not set | |
error: aws:autoscaling/group:Group resource 'repro-autoscaling-group' has a problem: "tag.0.propagate_at_launch": required field is not set | |
error: an error occurred while advancing the preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "pulumi-asg-repro-2", | |
"main": "bin/index.js", | |
"typings": "bin/index.d.ts", | |
"scripts": { | |
"build": "tsc" | |
}, | |
"devDependencies": { | |
"typescript": "^2.7.2", | |
"@types/node": "latest" | |
}, | |
"dependencies": { | |
"@pulumi/pulumi": "latest", | |
"@pulumi/aws": "^0.14.6-dev-1533615635-g36bed34" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment