Skip to content

Instantly share code, notes, and snippets.

@jen20

jen20/index.ts Secret

Created August 6, 2018 14:57
Show Gist options
  • Select an option

  • Save jen20/55038870ab0293bcb0bb964f365e3557 to your computer and use it in GitHub Desktop.

Select an option

Save jen20/55038870ab0293bcb0bb964f365e3557 to your computer and use it in GitHub Desktop.
import * as aws from "@pulumi/aws";
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],
});
new aws.autoscaling.Group(`repro-autoscaling-group`, {
desiredCapacity: 0,
minSize: 0,
maxSize: 1,
launchConfiguration: launchConfiguration.id,
vpcZoneIdentifiers: subnetIds.ids,
tags: [
{
key: "Name",
value: "Test Server",
propagateAtLaunch: true
},
],
});
}
function sgRule(name: string): any {
return {
description: `All ${name} Traffic`,
fromPort: 0,
toPort: 0,
protocol: "-1",
cidrBlocks: ["0.0.0.0/0"],
};
}
const _ = main();
❯ pulumi preview
Previewing update of stack 'pulumi-asg-repro-dev'
Previewing changes:
Type Name Plan Info
+ pulumi:pulumi:Stack pulumi-asg-repro-pulumi-asg-repro-dev create 1 error
+ ├─ aws:ec2:SecurityGroup repro-security-group create
+ ├─ aws:ec2:LaunchConfiguration repro-launch-config create
* └─ global global no change 1 error
Diagnostics:
global: global
error: aws:autoscaling/group:Group resource 'repro-autoscaling-group' has a problem: tag.0: expected object, got slice
pulumi:pulumi:Stack: pulumi-asg-repro-pulumi-asg-repro-dev
error: One or more resource validation errors occurred; refusing to proceed
error: an error occurred while advancing the preview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment