Skip to content

Commit

Permalink
Changed artifact version - changed to ami with hvm virtualization
Browse files Browse the repository at this point in the history
  • Loading branch information
ravbaba committed Jul 27, 2015
1 parent f9bcd5c commit c2a0c7b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
8 changes: 4 additions & 4 deletions bootstrap/aws-public/config-default.sh
Expand Up @@ -18,12 +18,12 @@ export ANSIBLE_SSH_ARGS="-F ${APOLLO_ROOT}/terraform/${APOLLO_PROVIDER}/ssh.conf
# so no really needed to export them. Exporting for consitency.
export TF_VAR_atlas_artifact_master=${TF_VAR_atlas_artifact_master:-capgemini/apollo-ubuntu-14.04-amd64}
export TF_VAR_atlas_artifact_slave=${TF_VAR_atlas_artifact_slave:-capgemini/apollo-ubuntu-14.04-amd64}
export TF_VAR_atlas_artifact_version_master=${TF_VAR_atlas_artifact_version_master:-6}
export TF_VAR_atlas_artifact_version_slave=${TF_VAR_atlas_artifact_version_slave:-6}
export TF_VAR_atlas_artifact_version_master=${TF_VAR_atlas_artifact_version_master:-8}
export TF_VAR_atlas_artifact_version_slave=${TF_VAR_atlas_artifact_version_slave:-8}

export TF_VAR_region=${TF_VAR_region:-eu-west-1}
export TF_VAR_master_size=${TF_VAR_master_size:-m1.medium}
export TF_VAR_slave_size=${TF_VAR_slave_size:-m1.medium}
export TF_VAR_master_size=${TF_VAR_master_size:-m3.medium}
export TF_VAR_slave_size=${TF_VAR_slave_size:-m3.medium}
export TF_VAR_slaves=${TF_VAR_slaves:-1}
export TF_VAR_availability_zones=${TF_VAR_availability_zones:-'eu-west-1a,eu-west-1b,eu-west-1c'}

Expand Down
10 changes: 9 additions & 1 deletion terraform/aws-public/mesos-masters.tf
Expand Up @@ -12,8 +12,16 @@ resource "atlas_artifact" "mesos-master" {

/* Mesos master instances */
resource "aws_instance" "mesos-master" {
/*
We had to hardcode the amis list in variables.tf file creating amis map because terraform doesn't
support interpolation in the way which could allow us to replaced the region dinamically.
We need to remember to update the map every time when we build a new artifact on atlas.
Similar issue related to metada_full is mentioned here:
https://github.com/hashicorp/terraform/issues/732
*/

instance_type = "${var.instance_type.master}"
ami = "${replace(atlas_artifact.mesos-master.id, concat(var.region, ":"), "")}"
ami = "${lookup(var.amis, var.region)}"
count = "${var.masters}"
key_name = "${aws_key_pair.deployer.key_name}"
subnet_id = "${element(aws_subnet.public.*.id, count.index)}"
Expand Down
10 changes: 9 additions & 1 deletion terraform/aws-public/mesos-slaves.tf
Expand Up @@ -7,8 +7,16 @@ resource "atlas_artifact" "mesos-slave" {

/* Mesos slave instances */
resource "aws_instance" "mesos-slave" {
/*
We had to hardcode the amis list in variables.tf file creating amis map because terraform doesn't
support interpolation in the way which could allow us to replaced the region dinamically.
We need to remember to update the map every time when we build a new artifact on atlas.
Similar issue related to metada_full is mentioned here:
https://github.com/hashicorp/terraform/issues/732
*/

instance_type = "${var.instance_type.slave}"
ami = "${replace(atlas_artifact.mesos-master.id, concat(var.region, ":"), "")}"
ami = "${lookup(var.amis, var.region)}"
count = "${var.slaves}"
key_name = "${aws_key_pair.deployer.key_name}"
subnet_id = "${element(aws_subnet.public.*.id, count.index)}"
Expand Down
23 changes: 19 additions & 4 deletions terraform/aws-public/variables.tf
Expand Up @@ -57,8 +57,8 @@ variable "slave_block_device" {

variable "instance_type" {
default = {
master = "m1.medium"
slave = "m1.medium"
master = "m3.medium"
slave = "m3.medium"
}
}

Expand All @@ -71,7 +71,22 @@ variable "atlas_artifact" {

variable "atlas_artifact_version" {
default = {
master = "6"
slave = "6"
master = "8"
slave = "8"
}
}

/* Remember to update the list every time when you build a new artifact on atlas */
variable "amis" {
default = {
ap-northeast-1 = "ami-249e2e24"
ap-southeast-1 = "ami-f20b06a0"
ap-southeast-2 = "ami-7d793847"
eu-central-1 = "ami-f6888deb"
eu-west-1 = "ami-8c6431fb"
sa-east-1 = "ami-158b0508"
us-east-1 = "ami-2f36ee44"
us-west-1 = "ami-1d6d9059"
us-west-2 = "ami-af323d9f"
}
}

0 comments on commit c2a0c7b

Please sign in to comment.