Created
June 1, 2016 20:39
-
-
Save nicocesar/3f7408171e1377afbf3c3ef609538f38 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
provider "aws" { | |
region = "us-east-1" | |
} |
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
#resource "aws_disk" "switchyard_os" { | |
# name = "${var.cluster}-switchyard-os" | |
# type = "${var.os_disk_type.switchyard}" | |
# zone = "${var.zone}" | |
#} | |
resource "aws_eip" "switchyard" { | |
instance = "${aws_instance.switchyard.id}" | |
vpc = true | |
} | |
resource "aws_instance" "switchyard" { | |
instance_type = "${var.machine_types.switchyard}" | |
ami = "${var.images.switchyard}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
source_dest_check = false | |
private_ip = "${var.internal_ip.switchyard}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.switchyard}" | |
volume_size = "${var.os_disk_size.switchyard}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.switchyard.id}", "${aws_security_group.nat.id}" ] | |
tags { | |
Name = "${var.cluster}-switchyard" | |
fqdn = "switchyard.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_eip" "api" { | |
instance = "${aws_instance.api.id}" | |
vpc = true | |
} | |
resource "aws_ebs_volume" "api_data" { | |
type = "${var.data_disk_type.api}" | |
size = "${var.data_disk_size.api}" | |
availability_zone = "${var.zone}" | |
tags { | |
Name = "${var.cluster}-api-data" | |
} | |
} | |
resource "aws_volume_attachment" "api_data_attachment" { | |
device_name = "/dev/sdc" | |
volume_id = "${aws_ebs_volume.api_data.id}" | |
instance_id = "${aws_instance.api.id}" | |
} | |
resource "aws_instance" "api" { | |
instance_type = "${var.machine_types.api}" | |
ami = "${var.images.api}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
private_ip = "${var.internal_ip.api}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.api}" | |
volume_size = "${var.os_disk_size.api}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.api.id}", "${aws_security_group.git.id}", "${aws_security_group.controller.id}", "${aws_security_group.controller2.id}" ] | |
tags { | |
Name = "${var.cluster}-api" | |
fqdn = "${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_eip" "workbench" { | |
instance = "${aws_instance.workbench.id}" | |
vpc = true | |
} | |
resource "aws_instance" "workbench" { | |
instance_type = "${var.machine_types.workbench}" | |
ami = "${var.images.workbench}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
private_ip = "${var.internal_ip.workbench}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.workbench}" | |
volume_size = "${var.os_disk_size.workbench}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.workbench.id}" ] | |
tags { | |
Name = "${var.cluster}-workbench" | |
fqdn = "workbench.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_eip" "keepproxy" { | |
instance = "${aws_instance.keepproxy.id}" | |
vpc = true | |
} | |
resource "aws_instance" "keepproxy" { | |
instance_type = "${var.machine_types.keepproxy}" | |
ami = "${var.images.keepproxy}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
private_ip = "${var.internal_ip.keepproxy}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.keepproxy}" | |
volume_size = "${var.os_disk_size.keepproxy}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.keepproxy.id}" ] | |
tags { | |
Name = "${var.cluster}-keepproxy" | |
fqdn = "keep.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_instance" "manage" { | |
instance_type = "${var.machine_types.manage}" | |
ami = "${var.images.manage}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_private.id}" | |
private_ip = "${var.internal_ip.manage}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.manage}" | |
volume_size = "${var.os_disk_size.manage}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.controller.id}", "${aws_security_group.controller2.id}" ] | |
tags { | |
Name = "${var.cluster}-manage" | |
fqdn = "manage.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_ebs_volume" "shell_data" { | |
type = "${var.data_disk_type.shell}" | |
size = "${var.data_disk_size.shell}" | |
availability_zone = "${var.zone}" | |
tags { | |
Name = "${var.cluster}-shell-data" | |
} | |
} | |
resource "aws_volume_attachment" "shell_data_attachment" { | |
device_name = "/dev/sdc" | |
volume_id = "${aws_ebs_volume.shell_data.id}" | |
instance_id = "${aws_instance.shell.id}" | |
} | |
resource "aws_instance" "shell" { | |
instance_type = "${var.machine_types.shell}" | |
ami = "${var.images.shell}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_private.id}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.shell}" | |
volume_size = "${var.os_disk_size.shell}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.shell.id}" ] | |
tags { | |
Name = "${var.cluster}-shell" | |
fqdn = "shell.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_instance" "keepstore" { | |
count = "${var.keepstore_count}" | |
instance_type = "${var.machine_types.keepstore}" | |
ami = "${var.images.keepstore}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_private.id}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.keepstore}" | |
volume_size = "${var.os_disk_size.keepstore}" | |
delete_on_termination = false | |
} | |
ebs_block_device { | |
device_name = "/dev/sdc" | |
volume_type = "${var.data_disk_type.keepstore}" | |
volume_size = "${var.data_disk_size.keepstore}" | |
delete_on_termination = false | |
} | |
ebs_block_device { | |
device_name = "/dev/sdd" | |
volume_type = "${var.data_disk_type.keepstore}" | |
volume_size = "${var.data_disk_size.keepstore}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.keepstore.id}" ] | |
tags { | |
Name = "${var.cluster}-keepstore${count.index}" | |
fqdn = "keep${count.index}.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
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
resource "aws_internet_gateway" "arvados" { | |
vpc_id = "${aws_vpc.arvados.id}" | |
tags { | |
Name = "arvados ${var.cluster}" | |
} | |
} |
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
#resource "aws_disk" "switchyard_os" { | |
# name = "${var.cluster}-switchyard-os" | |
# type = "${var.os_disk_type.switchyard}" | |
# zone = "${var.zone}" | |
#} | |
resource "aws_eip" "switchyard" { | |
instance = "${aws_instance.switchyard.id}" | |
vpc = true | |
} | |
resource "aws_instance" "switchyard" { | |
instance_type = "${var.machine_types.switchyard}" | |
ami = "${var.images.switchyard}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
source_dest_check = false | |
private_ip = "${var.internal_ip.switchyard}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.switchyard}" | |
volume_size = "${var.os_disk_size.switchyard}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.switchyard.id}", "${aws_security_group.nat.id}" ] | |
tags { | |
Name = "${var.cluster}-switchyard" | |
fqdn = "switchyard.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_eip" "api" { | |
instance = "${aws_instance.api.id}" | |
vpc = true | |
} | |
resource "aws_ebs_volume" "api_data" { | |
type = "${var.data_disk_type.api}" | |
size = "${var.data_disk_size.api}" | |
availability_zone = "${var.zone}" | |
tags { | |
Name = "${var.cluster}-api-data" | |
} | |
} | |
resource "aws_volume_attachment" "api_data_attachment" { | |
device_name = "/dev/sdc" | |
volume_id = "${aws_ebs_volume.api_data.id}" | |
instance_id = "${aws_instance.api.id}" | |
} | |
resource "aws_instance" "api" { | |
instance_type = "${var.machine_types.api}" | |
ami = "${var.images.api}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
private_ip = "${var.internal_ip.api}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.api}" | |
volume_size = "${var.os_disk_size.api}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.api.id}", "${aws_security_group.git.id}", "${aws_security_group.controller.id}", "${aws_security_group.controller2.id}" ] | |
tags { | |
Name = "${var.cluster}-api" | |
fqdn = "${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_eip" "workbench" { | |
instance = "${aws_instance.workbench.id}" | |
vpc = true | |
} | |
resource "aws_instance" "workbench" { | |
instance_type = "${var.machine_types.workbench}" | |
ami = "${var.images.workbench}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
private_ip = "${var.internal_ip.workbench}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.workbench}" | |
volume_size = "${var.os_disk_size.workbench}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.workbench.id}" ] | |
tags { | |
Name = "${var.cluster}-workbench" | |
fqdn = "workbench.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_eip" "keepproxy" { | |
instance = "${aws_instance.keepproxy.id}" | |
vpc = true | |
} | |
resource "aws_instance" "keepproxy" { | |
instance_type = "${var.machine_types.keepproxy}" | |
ami = "${var.images.keepproxy}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_public.id}" | |
private_ip = "${var.internal_ip.keepproxy}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.keepproxy}" | |
volume_size = "${var.os_disk_size.keepproxy}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.keepproxy.id}" ] | |
tags { | |
Name = "${var.cluster}-keepproxy" | |
fqdn = "keep.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_instance" "manage" { | |
instance_type = "${var.machine_types.manage}" | |
ami = "${var.images.manage}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_private.id}" | |
private_ip = "${var.internal_ip.manage}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.manage}" | |
volume_size = "${var.os_disk_size.manage}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.controller.id}", "${aws_security_group.controller2.id}" ] | |
tags { | |
Name = "${var.cluster}-manage" | |
fqdn = "manage.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_ebs_volume" "shell_data" { | |
type = "${var.data_disk_type.shell}" | |
size = "${var.data_disk_size.shell}" | |
availability_zone = "${var.zone}" | |
tags { | |
Name = "${var.cluster}-shell-data" | |
} | |
} | |
resource "aws_volume_attachment" "shell_data_attachment" { | |
device_name = "/dev/sdc" | |
volume_id = "${aws_ebs_volume.shell_data.id}" | |
instance_id = "${aws_instance.shell.id}" | |
} | |
resource "aws_instance" "shell" { | |
instance_type = "${var.machine_types.shell}" | |
ami = "${var.images.shell}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_private.id}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.shell}" | |
volume_size = "${var.os_disk_size.shell}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.shell.id}" ] | |
tags { | |
Name = "${var.cluster}-shell" | |
fqdn = "shell.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
resource "aws_instance" "keepstore" { | |
count = "${var.keepstore_count}" | |
instance_type = "${var.machine_types.keepstore}" | |
ami = "${var.images.keepstore}" | |
availability_zone = "${var.zone}" | |
disable_api_termination = false | |
subnet_id = "${aws_subnet.arvados_private.id}" | |
root_block_device { | |
volume_type = "${var.os_disk_type.keepstore}" | |
volume_size = "${var.os_disk_size.keepstore}" | |
delete_on_termination = false | |
} | |
ebs_block_device { | |
device_name = "/dev/sdc" | |
volume_type = "${var.data_disk_type.keepstore}" | |
volume_size = "${var.data_disk_size.keepstore}" | |
delete_on_termination = false | |
} | |
ebs_block_device { | |
device_name = "/dev/sdd" | |
volume_type = "${var.data_disk_type.keepstore}" | |
volume_size = "${var.data_disk_size.keepstore}" | |
delete_on_termination = false | |
} | |
vpc_security_group_ids = [ "${aws_security_group.keepstore.id}" ] | |
tags { | |
Name = "${var.cluster}-keepstore${count.index}" | |
fqdn = "keep${count.index}.${var.cluster}.arvadosapi.com" | |
cluster = "${var.cluster}" | |
} | |
} | |
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
resource "aws_subnet" "arvados_public" { | |
vpc_id = "${aws_vpc.arvados.id}" | |
availability_zone = "${var.zone}" | |
cidr_block = "${var.ipv4_range_public_subnet}" | |
tags { | |
Name = "arvados ${var.cluster} public" | |
} | |
} | |
resource "aws_subnet" "arvados_private" { | |
vpc_id = "${aws_vpc.arvados.id}" | |
availability_zone = "${var.zone}" | |
cidr_block = "${var.ipv4_range_private_subnet}" | |
tags { | |
Name = "arvados ${var.cluster} private" | |
} | |
} |
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
variable "cluster" {} | |
variable "credentials_file_path" {} | |
variable "region" { default = "us-central1" } | |
variable "zone" { default = "us-central1-f" } | |
variable "nagios_server" { default = "X.X.X.X/32" } | |
variable "ipv4_range" {} | |
variable "ipv4_range_private_subnet" {} | |
variable "ipv4_range_public_subnet" {} | |
variable "images" { | |
default = { | |
switchyard = "backports-debian-7-wheezy-v20151104" | |
api = "backports-debian-7-wheezy-v20151104" | |
keepproxy = "backports-debian-7-wheezy-v20151104" | |
keepstore = "backports-debian-7-wheezy-v20151104" | |
shell = "backports-debian-7-wheezy-v20151104" | |
workbench = "backports-debian-7-wheezy-v20151104" | |
manage = "backports-debian-7-wheezy-v20151104" | |
} | |
} | |
variable "keepstore_count" { default = "2" } | |
# Only supported on AWS | |
variable "internal_ip" { | |
default = {} | |
} | |
variable "os_disk_type" { | |
default = { | |
switchyard = "pd-standard" | |
api = "pd-standard" | |
keepstore = "pd-standard" | |
keepproxy = "pd-standard" | |
manage = "pd-standard" | |
shell = "pd-standard" | |
workbench = "pd-standard" | |
} | |
} | |
variable "os_disk_size" { | |
default = { | |
switchyard = "10" | |
api = "10" | |
keepstore = "10" | |
keepproxy = "10" | |
manage = "10" | |
shell = "10" | |
workbench = "10" | |
} | |
} | |
variable "data_disk_type" { | |
default = { | |
api = "pd-ssd" | |
shell = "pd-standard" | |
keepstore = "pd-standard" | |
} | |
} | |
variable "data_disk_size" { | |
default = { | |
api = "200" | |
shell = "100" | |
keepstore = "3000" | |
} | |
} | |
variable "machine_types" { | |
default = { | |
switchyard = "n1-standard-1" | |
api = "n1-standard-2" | |
keepstore = "n1-standard-2" | |
keepproxy = "n1-standard-2" | |
manage = "n1-standard-2" | |
shell = "n1-standard-2" | |
workbench = "n1-standard-2" | |
} | |
} |
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
cluster = "xxxxx" | |
zone = "us-east-1b" | |
credentials_file_path = "cred.sh" | |
ipv4_range = "10.36.0.0/16" | |
ipv4_range_private_subnet = "10.36.64.0/18" | |
ipv4_range_public_subnet = "10.36.0.0/18" | |
keepstore_count = "4" | |
os_disk_type.switchyard = "standard" | |
os_disk_type.api = "standard" | |
os_disk_type.workbench = "standard" | |
os_disk_type.keepproxy = "standard" | |
os_disk_type.manage = "standard" | |
os_disk_type.shell = "standard" | |
os_disk_type.keepstore = "standard" | |
data_disk_type.api = "gp2" | |
data_disk_type.shell = "standard" | |
data_disk_type.keepstore = "standard" | |
data_disk_size.keepstore = "350" | |
machine_types.switchyard = "m4.large" | |
machine_types.workbench = "m4.large" | |
machine_types.manage = "m4.xlarge" | |
machine_types.shell = "m4.large" | |
machine_types.keepproxy = "m4.large" | |
machine_types.keepstore = "m4.xlarge" | |
machine_types.service = "m4.xlarge" | |
machine_types.api = "m4.2xlarge" | |
images.api = "ami-9620ddfb" | |
images.keepproxy = "ami-f809f495" | |
images.keepstore = "ami-110af77c" | |
images.manage = "ami-ba14e9d7" | |
images.shell = "ami-c60af7ab" | |
images.switchyard = "ami-2f19e442" | |
images.workbench = "ami-1d1ee370" | |
internal_ip.switchyard = "10.36.4.5" | |
internal_ip.api = "10.36.32.5" | |
internal_ip.workbench = "10.36.32.6" | |
internal_ip.keepproxy = "10.36.32.7" | |
internal_ip.manage = "10.36.64.5" |
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
resource "aws_vpc" "arvados" { | |
cidr_block = "${var.ipv4_range}" | |
instance_tenancy = "dedicated" | |
tags { | |
Name = "arvados" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment