Skip to content

Commit 50c4cde

Browse files
Merge pull request #11 from segmentio/map-amis
default AMIs for all EC2 regions
2 parents 76800bf + 835ee1e commit 50c4cde

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ validate-ami:
4646
pack-ami validate -p ./packer -t ${template}
4747

4848
build-ami:
49-
pack-ami build -p ./packer -t ${template} | tee /tmp/build-ami.output
50-
@cat /tmp/build-ami.output | tfvar-ami ${template} > ${template)_ami.tfvars
51-
@rm -f /tmp/build-ami.output
49+
pack-ami build -p ./packer -t ${template}
5250

5351
test:
5452
@bash scripts/test.sh

base_ami.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.

ecs_ami.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.

main.tf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,28 @@ variable "ecs_security_groups" {
109109
default = ""
110110
}
111111

112+
variable "ecs_ami" {
113+
description = "The AMI that will be used to launch EC2 instances in the ECS cluster"
114+
default = ""
115+
}
116+
117+
variable "default_ecs_ami" {
118+
description = "A mapping of AWS regions to the default ECS AMIs"
119+
120+
default = {
121+
us-east-1 = "ami-5f3ff932"
122+
us-west-1 = "ami-31c08551"
123+
us-west-2 = "ami-f3985d93"
124+
eu-west-1 = "ami-ab4bd5d8"
125+
eu-central-1 = "ami-6c58b103"
126+
ap-northeast-1 = "ami-a69d68c7"
127+
ap-northeast-2 = "ami-7b2de615"
128+
ap-southeast-1 = "ami-550dde36"
129+
ap-southeast-2 = "ami-c799b0a4"
130+
sa-east-1 = "ami-0274fe6e"
131+
}
132+
}
133+
112134
module "vpc" {
113135
source = "./vpc"
114136
name = "${var.name}"
@@ -164,7 +186,7 @@ module "ecs_cluster" {
164186
name = "default"
165187
environment = "${var.environment}"
166188
vpc_id = "${module.vpc.id}"
167-
image_id = "${var.ecs_ami}"
189+
image_id = "${coalesce(var.ecs_ami, lookup(var.default_ecs_ami, var.region))}"
168190
subnet_ids = "${module.vpc.internal_subnets}"
169191
key_name = "${var.key_name}"
170192
instance_type = "${var.ecs_instance_type}"

task/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
*
1212
*/
1313

14-
1514
/**
1615
* Required Variables.
1716
*/

worker/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*
1414
*/
1515

16-
1716
/**
1817
* Required Variables.
1918
*/

0 commit comments

Comments
 (0)