-
Notifications
You must be signed in to change notification settings - Fork 878
/
index.ts
39 lines (31 loc) · 1.1 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
/**
* company
* └─ department
* └─ team
*/
const config = new pulumi.Config();
const companyStack = new pulumi.StackReference(config.require("companyStack"));
const departmentStack = new pulumi.StackReference(config.require("departmentStack"));
const combinedTags = {
/* from company stack */ company: companyStack.getOutput("companyName"),
/* from department stack */ department: departmentStack.getOutput("departmentName"),
/* from team config */ team: config.require("teamName"),
"Managed By": "Pulumi",
};
const ami = aws.getAmi({
owners: ["099720109477"], // Ubuntu
mostRecent: true,
filters: [
{ name: "name", values: ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"] },
],
});
const instance = new aws.ec2.Instance("tagged", {
ami: ami.id,
instanceType: "t2.medium",
tags: combinedTags,
});
export const instanceId = instance.id;
export const instanceTags = instance.tags;