From bf95e217cbad323e1d353461b50fb97503c9ba73 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 27 Apr 2016 11:33:46 +0100 Subject: [PATCH 01/53] Add new azure resorce manager branch and privider terraform file --- terraform/azure_rmprovider/provider.tf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 terraform/azure_rmprovider/provider.tf diff --git a/terraform/azure_rmprovider/provider.tf b/terraform/azure_rmprovider/provider.tf new file mode 100644 index 00000000..3cf279d8 --- /dev/null +++ b/terraform/azure_rmprovider/provider.tf @@ -0,0 +1,9 @@ +/* Configure auth 2 resource manager authentication. This requires an aplication to be set up in Azure, see +https://www.terraform.io/docs/providers/azurerm/index.html fo details. */ + +provider "azurerm" { + subscription_id = "${var.subscription_id}" + client_id = "${var.client_id}" + client_secret = "${var.client_secret}" + tenant_id = "${var.tenant_id}" +} \ No newline at end of file From 690b73f50ddcae56aad3f017838376e94ba1ec2c Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 27 Apr 2016 12:23:32 +0100 Subject: [PATCH 02/53] Addition of terraform variables file --- terraform/azure_rmprovider/variables.tf | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 terraform/azure_rmprovider/variables.tf diff --git a/terraform/azure_rmprovider/variables.tf b/terraform/azure_rmprovider/variables.tf new file mode 100644 index 00000000..ec761415 --- /dev/null +++ b/terraform/azure_rmprovider/variables.tf @@ -0,0 +1,28 @@ +variable "subscription_id" { + description = "The Azure subscrition identifier (guid)." +} + +variable "client_id" { + description = "The oAuth 2 client id. " +} + +variable "client_secret" { + description = "The oAuth 2 client secret." +} + +variable "tenant_id" { + description = "The oAuth 2 tenant id." +} + +variable "location" { + description = "The deployment azure data centre location." +} + +variable "vn_cidr_block" { + description = "Cidr block for the VN." +} + +variable "subnet_cidr_block" { + description = "CIDR for private subnet" +} + From d2d56493f54b932607659a63bb911baf5c2ec818 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 27 Apr 2016 12:30:09 +0100 Subject: [PATCH 03/53] Rename folder to azurerm --- terraform/{azure_rmprovider => azurerm}/provider.tf | 0 terraform/{azure_rmprovider => azurerm}/variables.tf | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename terraform/{azure_rmprovider => azurerm}/provider.tf (100%) rename terraform/{azure_rmprovider => azurerm}/variables.tf (100%) diff --git a/terraform/azure_rmprovider/provider.tf b/terraform/azurerm/provider.tf similarity index 100% rename from terraform/azure_rmprovider/provider.tf rename to terraform/azurerm/provider.tf diff --git a/terraform/azure_rmprovider/variables.tf b/terraform/azurerm/variables.tf similarity index 100% rename from terraform/azure_rmprovider/variables.tf rename to terraform/azurerm/variables.tf From 51c370dba122ce87016b6fbd7563a3d2be41ec14 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 28 Apr 2016 10:32:42 +0100 Subject: [PATCH 04/53] Addition of virtual network and storage account --- terraform/azurerm/bastian-publicip.tf | 7 +++++++ terraform/azurerm/network-security-group.tf | 18 ++++++++++++++++++ terraform/azurerm/resourcegroup.tf | 5 +++++ terraform/azurerm/storage.tf | 15 +++++++++++++++ terraform/azurerm/variables.tf | 14 +++++++++++++- terraform/azurerm/virtual-network-subnet.tf | 6 ++++++ terraform/azurerm/virtual-network.tf | 7 +++++++ 7 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 terraform/azurerm/bastian-publicip.tf create mode 100644 terraform/azurerm/network-security-group.tf create mode 100644 terraform/azurerm/resourcegroup.tf create mode 100644 terraform/azurerm/storage.tf create mode 100644 terraform/azurerm/virtual-network-subnet.tf create mode 100644 terraform/azurerm/virtual-network.tf diff --git a/terraform/azurerm/bastian-publicip.tf b/terraform/azurerm/bastian-publicip.tf new file mode 100644 index 00000000..0641cdba --- /dev/null +++ b/terraform/azurerm/bastian-publicip.tf @@ -0,0 +1,7 @@ +#Create Public IP Address for bastian server +resource "azurerm_public_ip" "bastian_publicip" { + name = "BastianPublicIp" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} \ No newline at end of file diff --git a/terraform/azurerm/network-security-group.tf b/terraform/azurerm/network-security-group.tf new file mode 100644 index 00000000..726c92bc --- /dev/null +++ b/terraform/azurerm/network-security-group.tf @@ -0,0 +1,18 @@ +#Create Network Security Group +resource "azurerm_network_security_group" "network_security_group" { + name = "AzureRM_NetworkSecurityGroup" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + + security_rule { + name = "AzureRM_SecurityRuleTcp" + priority = 100 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "*" + source_address_prefix = "*" + destination_address_prefix = "*" + } +} \ No newline at end of file diff --git a/terraform/azurerm/resourcegroup.tf b/terraform/azurerm/resourcegroup.tf new file mode 100644 index 00000000..e066efd5 --- /dev/null +++ b/terraform/azurerm/resourcegroup.tf @@ -0,0 +1,5 @@ +# Create a resource group +resource "azurerm_resource_group" "resource_group" { + name = "AzureRM-Resource-Group" + location = "${var.region}" +} \ No newline at end of file diff --git a/terraform/azurerm/storage.tf b/terraform/azurerm/storage.tf new file mode 100644 index 00000000..8073d282 --- /dev/null +++ b/terraform/azurerm/storage.tf @@ -0,0 +1,15 @@ +# Create a storage account +resource "azurerm_storage_account" "storage_account" { + name = "${var.storage_account_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" + account_type = "Standard_GRS" +} + +# Create storage container +resource "azurerm_storage_container" "storage_container" { + name = "${var.storage_container_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + storage_account_name = "${azurerm_storage_account.storage_account.name}" + container_access_type = "private" +} \ No newline at end of file diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index ec761415..ed2d2995 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -14,15 +14,27 @@ variable "tenant_id" { description = "The oAuth 2 tenant id." } -variable "location" { +variable "region" { description = "The deployment azure data centre location." + default = "North Europe" } variable "vn_cidr_block" { description = "Cidr block for the VN." + default = "10.0.0.0/16" } variable "subnet_cidr_block" { description = "CIDR for private subnet" + default = "10.0.0.0/24" } +variable "storage_account_name" { + description = "Storage account name" + default = "mesosimages" +} + +variable "storage_container_name" { + description = "Storage container name" + default = "mesosimages-container" +} \ No newline at end of file diff --git a/terraform/azurerm/virtual-network-subnet.tf b/terraform/azurerm/virtual-network-subnet.tf new file mode 100644 index 00000000..5a41df75 --- /dev/null +++ b/terraform/azurerm/virtual-network-subnet.tf @@ -0,0 +1,6 @@ +resource "azurerm_subnet" "subnet" { + name = "AzureRM_Subnet" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" + address_prefix = "${var.subnet_cidr_block}" +} \ No newline at end of file diff --git a/terraform/azurerm/virtual-network.tf b/terraform/azurerm/virtual-network.tf new file mode 100644 index 00000000..dde47dda --- /dev/null +++ b/terraform/azurerm/virtual-network.tf @@ -0,0 +1,7 @@ +# Create a virtual network +resource "azurerm_virtual_network" "virtual_network" { + name = "AzureRM-Virtual-Network" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + address_space = ["${var.vn_cidr_block}"] + location = "${var.region}" +} \ No newline at end of file From 3aedd81cd18fb3b5a6d778b4584d1d3523fc834c Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 28 Apr 2016 17:01:37 +0100 Subject: [PATCH 05/53] Addition bastion server and master servers configuration --- terraform/azurerm/bastion-publicip.tf | 7 +++ terraform/azurerm/bastion-server.tf | 47 +++++++++++++++++++ terraform/azurerm/master-publicip.tf | 9 ++++ terraform/azurerm/mesos-masters.tf | 51 +++++++++++++++++++++ terraform/azurerm/network-security-group.tf | 43 +++++++++++++++-- terraform/azurerm/storage.tf | 3 +- terraform/azurerm/variables.tf | 27 ++++++++++- terraform/azurerm/virtual-network-subnet.tf | 3 +- terraform/azurerm/virtual-network.tf | 3 +- 9 files changed, 186 insertions(+), 7 deletions(-) create mode 100644 terraform/azurerm/bastion-publicip.tf create mode 100644 terraform/azurerm/bastion-server.tf create mode 100644 terraform/azurerm/master-publicip.tf create mode 100644 terraform/azurerm/mesos-masters.tf diff --git a/terraform/azurerm/bastion-publicip.tf b/terraform/azurerm/bastion-publicip.tf new file mode 100644 index 00000000..4dfa65eb --- /dev/null +++ b/terraform/azurerm/bastion-publicip.tf @@ -0,0 +1,7 @@ +#Create Public IP Address for bastion server +resource "azurerm_public_ip" "bastion_publicip" { + name = "BastionPublicIp" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf new file mode 100644 index 00000000..ca1af2b5 --- /dev/null +++ b/terraform/azurerm/bastion-server.tf @@ -0,0 +1,47 @@ +# Create a network interface for bastion server +resource "azurerm_network_interface" "bastion_network_interface" { + name = "Bastion_NetworkInterface" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "bastionipconfiguration" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${azurerm_public_ip.bastion_publicip.id}" + } +} + +# NAT/VPN server +resource "azurerm_virtual_machine" "bastion" { + name = "apollo-bastion" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${azurerm_network_interface.bastion_network_interface.id}"] + vm_size = "${var.instance_type.master}" + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "14.04.2-LTS" + version = "latest" + } + + storage_os_disk { + name = "bastiondisk" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/bastiondisk.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "${var.bastion_server_computername}" + admin_username = "${var.bastion_server_username}" + admin_password = "${var.bastion_server_password}" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} diff --git a/terraform/azurerm/master-publicip.tf b/terraform/azurerm/master-publicip.tf new file mode 100644 index 00000000..e7630175 --- /dev/null +++ b/terraform/azurerm/master-publicip.tf @@ -0,0 +1,9 @@ +#Create Public IP Address for master servers +resource "azurerm_public_ip" "master_publicip" { + name = "MasterPublicIp-${count.index}" + count = "${var.masters_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} + diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/mesos-masters.tf new file mode 100644 index 00000000..54a127f4 --- /dev/null +++ b/terraform/azurerm/mesos-masters.tf @@ -0,0 +1,51 @@ +# Create a network interface for bastion server +resource "azurerm_network_interface" "master_network_interface" { + name = "Master_NetworkInterface-${count.index}" + count = "${var.masters_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "masteripconfiguration-${count.index}" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${element(azurerm_public_ip.master_publicip.*.id, count.index)}" + } +} + +# Master server +resource "azurerm_virtual_machine" "master" { + name = "apollo-mesos-master-${count.index}" + count = "${var.masters_count}" + location = "${var.region}" + depends_on = ["azurerm_virtual_machine.bastion"] + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.master_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.master}" + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "14.04.2-LTS" + version = "latest" + } + + storage_os_disk { + name = "masterdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/masterdisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "Mesos-Master-${count.index}" + admin_username = "${var.bastion_server_username}" + admin_password = "${var.bastion_server_password}" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} + diff --git a/terraform/azurerm/network-security-group.tf b/terraform/azurerm/network-security-group.tf index 726c92bc..7e2ee982 100644 --- a/terraform/azurerm/network-security-group.tf +++ b/terraform/azurerm/network-security-group.tf @@ -5,14 +5,51 @@ resource "azurerm_network_security_group" "network_security_group" { resource_group_name = "${azurerm_resource_group.resource_group.name}" security_rule { - name = "AzureRM_SecurityRuleTcp" + name = "AzureRM_SecurityRuleSSH" priority = 100 direction = "Inbound" access = "Allow" protocol = "Tcp" source_port_range = "*" - destination_port_range = "*" + destination_port_range = "22" source_address_prefix = "*" destination_address_prefix = "*" } -} \ No newline at end of file + + security_rule { + name = "AzureRM_SecurityRuleOpenVPN" + priority = 101 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "1194" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenHTTPS" + priority = 102 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "443" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenHTTP" + priority = 103 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "80" + source_address_prefix = "*" + destination_address_prefix = "*" + } +} + diff --git a/terraform/azurerm/storage.tf b/terraform/azurerm/storage.tf index 8073d282..a08322e4 100644 --- a/terraform/azurerm/storage.tf +++ b/terraform/azurerm/storage.tf @@ -12,4 +12,5 @@ resource "azurerm_storage_container" "storage_container" { resource_group_name = "${azurerm_resource_group.resource_group.name}" storage_account_name = "${azurerm_storage_account.storage_account.name}" container_access_type = "private" -} \ No newline at end of file +} + diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index ed2d2995..8f795010 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -37,4 +37,29 @@ variable "storage_account_name" { variable "storage_container_name" { description = "Storage container name" default = "mesosimages-container" -} \ No newline at end of file +} + +variable "instance_type" { + default = { + master = "Standard_A0" + slave = "Standard_A0" + } +} + +variable "bastion_server_computername" { + description = "Username to access server" + default = "bastion" +} + +variable "bastion_server_username" { + description = "Username to access server" +} + +variable "bastion_server_password" { + description = "Password to access server" +} + +variable "masters_count" { + description = "The number of masters." + default = "2" +} diff --git a/terraform/azurerm/virtual-network-subnet.tf b/terraform/azurerm/virtual-network-subnet.tf index 5a41df75..133cdedc 100644 --- a/terraform/azurerm/virtual-network-subnet.tf +++ b/terraform/azurerm/virtual-network-subnet.tf @@ -1,6 +1,7 @@ +#Create Subnet resource "azurerm_subnet" "subnet" { name = "AzureRM_Subnet" resource_group_name = "${azurerm_resource_group.resource_group.name}" virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" address_prefix = "${var.subnet_cidr_block}" -} \ No newline at end of file +} diff --git a/terraform/azurerm/virtual-network.tf b/terraform/azurerm/virtual-network.tf index dde47dda..76e83fb8 100644 --- a/terraform/azurerm/virtual-network.tf +++ b/terraform/azurerm/virtual-network.tf @@ -4,4 +4,5 @@ resource "azurerm_virtual_network" "virtual_network" { resource_group_name = "${azurerm_resource_group.resource_group.name}" address_space = ["${var.vn_cidr_block}"] location = "${var.region}" -} \ No newline at end of file +} + From 809a9c919ab0e6eb192827612a8a16f09e8a0545 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Fri, 29 Apr 2016 14:42:42 +0100 Subject: [PATCH 06/53] updates and addition of slave server configuration --- terraform/azurerm/bastian-publicip.tf | 7 --- ...-publicip.tf => mesos-master-publicips.tf} | 6 ++- terraform/azurerm/mesos-masters.tf | 19 ++++--- terraform/azurerm/mesos-slave-publicips.tf | 12 +++++ terraform/azurerm/mesos-slaves.tf | 54 +++++++++++++++++++ terraform/azurerm/variables.tf | 31 ++++++++++- 6 files changed, 112 insertions(+), 17 deletions(-) delete mode 100644 terraform/azurerm/bastian-publicip.tf rename terraform/azurerm/{master-publicip.tf => mesos-master-publicips.tf} (87%) create mode 100644 terraform/azurerm/mesos-slave-publicips.tf create mode 100644 terraform/azurerm/mesos-slaves.tf diff --git a/terraform/azurerm/bastian-publicip.tf b/terraform/azurerm/bastian-publicip.tf deleted file mode 100644 index 0641cdba..00000000 --- a/terraform/azurerm/bastian-publicip.tf +++ /dev/null @@ -1,7 +0,0 @@ -#Create Public IP Address for bastian server -resource "azurerm_public_ip" "bastian_publicip" { - name = "BastianPublicIp" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - public_ip_address_allocation = "static" -} \ No newline at end of file diff --git a/terraform/azurerm/master-publicip.tf b/terraform/azurerm/mesos-master-publicips.tf similarity index 87% rename from terraform/azurerm/master-publicip.tf rename to terraform/azurerm/mesos-master-publicips.tf index e7630175..3e05ec22 100644 --- a/terraform/azurerm/master-publicip.tf +++ b/terraform/azurerm/mesos-master-publicips.tf @@ -1,9 +1,13 @@ +/* + #Create Public IP Address for master servers resource "azurerm_public_ip" "master_publicip" { name = "MasterPublicIp-${count.index}" - count = "${var.masters_count}" + count = "${var.master_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" public_ip_address_allocation = "static" } +*/ + diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/mesos-masters.tf index 54a127f4..ec03f0d1 100644 --- a/terraform/azurerm/mesos-masters.tf +++ b/terraform/azurerm/mesos-masters.tf @@ -1,7 +1,9 @@ -# Create a network interface for bastion server +/* + +# Create a network interface for master server resource "azurerm_network_interface" "master_network_interface" { name = "Master_NetworkInterface-${count.index}" - count = "${var.masters_count}" + count = "${var.master_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" @@ -15,9 +17,9 @@ resource "azurerm_network_interface" "master_network_interface" { } # Master server -resource "azurerm_virtual_machine" "master" { +resource "azurerm_virtual_machine" "mesos_master" { name = "apollo-mesos-master-${count.index}" - count = "${var.masters_count}" + count = "${var.master_count}" location = "${var.region}" depends_on = ["azurerm_virtual_machine.bastion"] resource_group_name = "${azurerm_resource_group.resource_group.name}" @@ -25,10 +27,10 @@ resource "azurerm_virtual_machine" "master" { vm_size = "${var.instance_type.master}" storage_image_reference { - publisher = "Canonical" - offer = "UbuntuServer" - sku = "14.04.2-LTS" - version = "latest" + publisher = "${var.atlas_artifact_master.publisher}" + offer = "${var.atlas_artifact_master.offer}" + sku = "${var.atlas_artifact_master.sku}" + version = "${var.atlas_artifact_master.version}" } storage_os_disk { @@ -49,3 +51,4 @@ resource "azurerm_virtual_machine" "master" { } } +*/ \ No newline at end of file diff --git a/terraform/azurerm/mesos-slave-publicips.tf b/terraform/azurerm/mesos-slave-publicips.tf new file mode 100644 index 00000000..080d1bea --- /dev/null +++ b/terraform/azurerm/mesos-slave-publicips.tf @@ -0,0 +1,12 @@ +/* + +#Create Public IP Address for slave servers +resource "azurerm_public_ip" "slave_publicip" { + name = "SlavePublicIp-${count.index}" + count = "${var.slave_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} + +*/ diff --git a/terraform/azurerm/mesos-slaves.tf b/terraform/azurerm/mesos-slaves.tf new file mode 100644 index 00000000..35f4b990 --- /dev/null +++ b/terraform/azurerm/mesos-slaves.tf @@ -0,0 +1,54 @@ +/* + +# Create a network interface for slave server +resource "azurerm_network_interface" "slave_network_interface" { + name = "Slave_NetworkInterface-${count.index}" + count = "${var.slave_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "slaveipconfiguration-${count.index}" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${element(azurerm_public_ip.slave_publicip.*.id, count.index)}" + } +} + +# Slave server +resource "azurerm_virtual_machine" "mesos_slave" { + name = "apollo-mesos-slave-${count.index}" + count = "${var.slave_count}" + location = "${var.region}" + depends_on = ["azurerm_virtual_machine.bastion", "azurerm_virtual_machine.mesos_master"] + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.slave_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.slave}" + + storage_image_reference { + publisher = "${var.atlas_artifact_slave.publisher}" + offer = "${var.atlas_artifact_slave.offer}" + sku = "${var.atlas_artifact_slave.sku}" + version = "${var.atlas_artifact_slave.version}" + } + + storage_os_disk { + name = "slavedisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/slavedisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "Mesos-Slave-${count.index}" + admin_username = "${var.bastion_server_username}" + admin_password = "${var.bastion_server_password}" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} + +*/ \ No newline at end of file diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index 8f795010..52ca2904 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -39,6 +39,24 @@ variable "storage_container_name" { default = "mesosimages-container" } +variable "atlas_artifact_master" { + default = { + publisher = "" + offer ="" + "sku" = "" + "version" = "" + } +} + +variable "atlas_artifact_slave" { + default = { + publisher = "" + offer ="" + "sku" = "" + "version" = "" + } +} + variable "instance_type" { default = { master = "Standard_A0" @@ -59,7 +77,18 @@ variable "bastion_server_password" { description = "Password to access server" } -variable "masters_count" { +variable "master_count" { description = "The number of masters." default = "2" } + +variable "slave_count" { + description = "The number of slaves." + default = "2" +} + +variable "docker_version" { + description = "Docker version" + default = "1.9.0-0~trusty" +} + From 6b79f6ca7c9c3557cba39fe49678abbde8abe5b5 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Fri, 6 May 2016 09:48:07 +0100 Subject: [PATCH 07/53] update slave references to agent --- .../{mesos-slave-publicips.tf => mesos-agent-publicips.tf} | 0 terraform/azurerm/{mesos-slaves.tf => mesos-agents.tf} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename terraform/azurerm/{mesos-slave-publicips.tf => mesos-agent-publicips.tf} (100%) rename terraform/azurerm/{mesos-slaves.tf => mesos-agents.tf} (100%) diff --git a/terraform/azurerm/mesos-slave-publicips.tf b/terraform/azurerm/mesos-agent-publicips.tf similarity index 100% rename from terraform/azurerm/mesos-slave-publicips.tf rename to terraform/azurerm/mesos-agent-publicips.tf diff --git a/terraform/azurerm/mesos-slaves.tf b/terraform/azurerm/mesos-agents.tf similarity index 100% rename from terraform/azurerm/mesos-slaves.tf rename to terraform/azurerm/mesos-agents.tf From 57e9c82efde874e3c117e575ef584e3eb99d6ef6 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 9 May 2016 11:50:59 +0100 Subject: [PATCH 08/53] Updates to run remote execution scripts on server --- terraform/azurerm/bastion-server.tf | 43 ++++++++++++++++-- terraform/azurerm/mesos-agent-publicips.tf | 14 +++--- terraform/azurerm/mesos-agents.tf | 50 ++++++++++----------- terraform/azurerm/mesos-master-publicips.tf | 7 +-- terraform/azurerm/mesos-masters.tf | 14 +++--- terraform/azurerm/variables.tf | 35 ++++++++++++--- 6 files changed, 102 insertions(+), 61 deletions(-) diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf index ca1af2b5..c4d5a7c1 100644 --- a/terraform/azurerm/bastion-server.tf +++ b/terraform/azurerm/bastion-server.tf @@ -36,12 +36,47 @@ resource "azurerm_virtual_machine" "bastion" { } os_profile { - computer_name = "${var.bastion_server_computername}" + computer_name = "${var.bastion_server_computername}" admin_username = "${var.bastion_server_username}" admin_password = "${var.bastion_server_password}" } - + os_profile_linux_config { - disable_password_authentication = false - } + disable_password_authentication = false + + /* ssh_keys { + path = "/home/${var.bastion_server_username}/.ssh/authorized_keys" + key_data = "${file("${var.ssh_public_key_file}")}" + } */ + } + + provisioner "remote-exec" { + + connection { + host = "${azurerm_public_ip.bastion_publicip.ip_address}" + type = "ssh" + user = "${var.bastion_server_username}" + password = "${var.bastion_server_password}" + /* private_key = "${file("${var.ssh_private_key_file}")}" */ + } + + inline = [ + "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", + "echo 1 | sudo tee /proc/sys/net/ipv4/conf/all/forwarding", + /* Install docker */ + /* Add the repository to your APT sources */ + "sudo -E sh -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list'", + /* Then import the repository key */ + "sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D", + "sudo apt-get update", + /* Install docker-engine */ + "sudo apt-get install -y docker-engine=${var.docker_version}", + "sudo service docker start", + /* Initialize open vpn data container */ + "sudo mkdir -p /etc/openvpn", + "sudo docker run --name ovpn-data -v /etc/openvpn busybox", + /* Generate OpenVPN server config */ + "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vn_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.id}" + ] + } } diff --git a/terraform/azurerm/mesos-agent-publicips.tf b/terraform/azurerm/mesos-agent-publicips.tf index 080d1bea..c7b36b96 100644 --- a/terraform/azurerm/mesos-agent-publicips.tf +++ b/terraform/azurerm/mesos-agent-publicips.tf @@ -1,12 +1,8 @@ -/* - -#Create Public IP Address for slave servers -resource "azurerm_public_ip" "slave_publicip" { - name = "SlavePublicIp-${count.index}" - count = "${var.slave_count}" +#Create Public IP Address for agent servers +resource "azurerm_public_ip" "agent_publicip" { + name = "AgentPublicIp-${count.index}" + count = "${var.agent_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" public_ip_address_allocation = "static" -} - -*/ +} \ No newline at end of file diff --git a/terraform/azurerm/mesos-agents.tf b/terraform/azurerm/mesos-agents.tf index 35f4b990..2f9637cf 100644 --- a/terraform/azurerm/mesos-agents.tf +++ b/terraform/azurerm/mesos-agents.tf @@ -1,54 +1,50 @@ -/* - -# Create a network interface for slave server -resource "azurerm_network_interface" "slave_network_interface" { - name = "Slave_NetworkInterface-${count.index}" - count = "${var.slave_count}" +# Create a network interface for agent server +resource "azurerm_network_interface" "agent_network_interface" { + name = "Agent_NetworkInterface-${count.index}" + count = "${var.agent_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" ip_configuration { - name = "slaveipconfiguration-${count.index}" + name = "agentipconfiguration-${count.index}" subnet_id = "${azurerm_subnet.subnet.id}" private_ip_address_allocation = "dynamic" - public_ip_address_id = "${element(azurerm_public_ip.slave_publicip.*.id, count.index)}" + public_ip_address_id = "${element(azurerm_public_ip.agent_publicip.*.id, count.index)}" } } -# Slave server -resource "azurerm_virtual_machine" "mesos_slave" { - name = "apollo-mesos-slave-${count.index}" - count = "${var.slave_count}" +# Agent server +resource "azurerm_virtual_machine" "mesos_agent" { + name = "apollo-mesos-agent-${count.index}" + count = "${var.agent_count}" location = "${var.region}" depends_on = ["azurerm_virtual_machine.bastion", "azurerm_virtual_machine.mesos_master"] resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_interface_ids = ["${element(azurerm_network_interface.slave_network_interface.*.id, count.index)}"] - vm_size = "${var.instance_type.slave}" + network_interface_ids = ["${element(azurerm_network_interface.agent_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.agent}" storage_image_reference { - publisher = "${var.atlas_artifact_slave.publisher}" - offer = "${var.atlas_artifact_slave.offer}" - sku = "${var.atlas_artifact_slave.sku}" - version = "${var.atlas_artifact_slave.version}" + publisher = "${var.atlas_artifact_agent.publisher}" + offer = "${var.atlas_artifact_agent.offer}" + sku = "${var.atlas_artifact_agent.sku}" + version = "${var.atlas_artifact_agent.version}" } storage_os_disk { - name = "slavedisk${count.index}" - vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/slavedisk-${count.index}.vhd" + name = "agentdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/agentdisk-${count.index}.vhd" caching = "ReadWrite" create_option = "FromImage" } os_profile { - computer_name = "Mesos-Slave-${count.index}" - admin_username = "${var.bastion_server_username}" - admin_password = "${var.bastion_server_password}" + computer_name = "Mesos-Agent-${count.index}" + admin_username = "${var.agent_server_username}" + admin_password = "${var.agent_server_password}" } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = false } -} - -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/terraform/azurerm/mesos-master-publicips.tf b/terraform/azurerm/mesos-master-publicips.tf index 3e05ec22..7aaa3edc 100644 --- a/terraform/azurerm/mesos-master-publicips.tf +++ b/terraform/azurerm/mesos-master-publicips.tf @@ -1,5 +1,3 @@ -/* - #Create Public IP Address for master servers resource "azurerm_public_ip" "master_publicip" { name = "MasterPublicIp-${count.index}" @@ -7,7 +5,4 @@ resource "azurerm_public_ip" "master_publicip" { location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" public_ip_address_allocation = "static" -} - -*/ - +} \ No newline at end of file diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/mesos-masters.tf index ec03f0d1..f4d0d7df 100644 --- a/terraform/azurerm/mesos-masters.tf +++ b/terraform/azurerm/mesos-masters.tf @@ -1,5 +1,3 @@ -/* - # Create a network interface for master server resource "azurerm_network_interface" "master_network_interface" { name = "Master_NetworkInterface-${count.index}" @@ -41,14 +39,12 @@ resource "azurerm_virtual_machine" "mesos_master" { } os_profile { - computer_name = "Mesos-Master-${count.index}" - admin_username = "${var.bastion_server_username}" - admin_password = "${var.bastion_server_password}" + computer_name = "Mesos-Master-${count.index}" + admin_username = "${var.master_server_username}" + admin_password = "${var.master_server_password}" } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = false } -} - -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index 52ca2904..2290fc72 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -48,7 +48,7 @@ variable "atlas_artifact_master" { } } -variable "atlas_artifact_slave" { +variable "atlas_artifact_agent" { default = { publisher = "" offer ="" @@ -60,7 +60,7 @@ variable "atlas_artifact_slave" { variable "instance_type" { default = { master = "Standard_A0" - slave = "Standard_A0" + agent = "Standard_A0" } } @@ -76,15 +76,31 @@ variable "bastion_server_username" { variable "bastion_server_password" { description = "Password to access server" } + +variable "master_server_username" { + description = "Username to access master server" +} + +variable "master_server_password" { + description = "Password to access master server" +} + +variable "agent_server_username" { + description = "Username to access agent server" +} + +variable "agent_server_password" { + description = "Password to access agent server" +} variable "master_count" { description = "The number of masters." - default = "2" + default = "1" } -variable "slave_count" { - description = "The number of slaves." - default = "2" +variable "agent_count" { + description = "The number of agents." + default = "1" } variable "docker_version" { @@ -92,3 +108,10 @@ variable "docker_version" { default = "1.9.0-0~trusty" } +variable "ssh_public_key_file" { + description = "Public key required to connect via ssh" +} + +variable "ssh_private_key_file" { + description = "Public key required to connect via ssh" +} From cd19c54e045e47bac9d9d3c7a388a45de4013214 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 10 May 2016 14:47:45 +0100 Subject: [PATCH 09/53] update remote-exec to use certificate authentication, requires Terraform v0.6.16 --- terraform/azurerm/bastion-server.tf | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf index c4d5a7c1..bb478e1c 100644 --- a/terraform/azurerm/bastion-server.tf +++ b/terraform/azurerm/bastion-server.tf @@ -42,24 +42,21 @@ resource "azurerm_virtual_machine" "bastion" { } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = true - /* ssh_keys { + ssh_keys { path = "/home/${var.bastion_server_username}/.ssh/authorized_keys" - key_data = "${file("${var.ssh_public_key_file}")}" - } */ + key_data = "${file("${var.ssh_public_key_file}")}" # openssh format + } + } + + connection { + host = "${azurerm_public_ip.bastion_publicip.ip_address}" + user = "${var.bastion_server_username}" + private_key = "${file("${var.ssh_private_key_file}")}" # openssh format } provisioner "remote-exec" { - - connection { - host = "${azurerm_public_ip.bastion_publicip.ip_address}" - type = "ssh" - user = "${var.bastion_server_username}" - password = "${var.bastion_server_password}" - /* private_key = "${file("${var.ssh_private_key_file}")}" */ - } - inline = [ "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", "echo 1 | sudo tee /proc/sys/net/ipv4/conf/all/forwarding", @@ -79,4 +76,4 @@ resource "azurerm_virtual_machine" "bastion" { "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vn_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.id}" ] } -} +} \ No newline at end of file From 5274c5b9ebfcd65cbd06bce4b74b816e2933dd39 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 27 Apr 2016 11:33:46 +0100 Subject: [PATCH 10/53] Add new azure resorce manager branch and privider terraform file --- terraform/azure_rmprovider/provider.tf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 terraform/azure_rmprovider/provider.tf diff --git a/terraform/azure_rmprovider/provider.tf b/terraform/azure_rmprovider/provider.tf new file mode 100644 index 00000000..3cf279d8 --- /dev/null +++ b/terraform/azure_rmprovider/provider.tf @@ -0,0 +1,9 @@ +/* Configure auth 2 resource manager authentication. This requires an aplication to be set up in Azure, see +https://www.terraform.io/docs/providers/azurerm/index.html fo details. */ + +provider "azurerm" { + subscription_id = "${var.subscription_id}" + client_id = "${var.client_id}" + client_secret = "${var.client_secret}" + tenant_id = "${var.tenant_id}" +} \ No newline at end of file From 929821085906c8ed4b62f26127d35b3aea3f3e3a Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 27 Apr 2016 12:23:32 +0100 Subject: [PATCH 11/53] Addition of terraform variables file --- terraform/azure_rmprovider/variables.tf | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 terraform/azure_rmprovider/variables.tf diff --git a/terraform/azure_rmprovider/variables.tf b/terraform/azure_rmprovider/variables.tf new file mode 100644 index 00000000..ec761415 --- /dev/null +++ b/terraform/azure_rmprovider/variables.tf @@ -0,0 +1,28 @@ +variable "subscription_id" { + description = "The Azure subscrition identifier (guid)." +} + +variable "client_id" { + description = "The oAuth 2 client id. " +} + +variable "client_secret" { + description = "The oAuth 2 client secret." +} + +variable "tenant_id" { + description = "The oAuth 2 tenant id." +} + +variable "location" { + description = "The deployment azure data centre location." +} + +variable "vn_cidr_block" { + description = "Cidr block for the VN." +} + +variable "subnet_cidr_block" { + description = "CIDR for private subnet" +} + From 63028d13c883c822b6115083a803e95a8613a33a Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 27 Apr 2016 12:30:09 +0100 Subject: [PATCH 12/53] Rename folder to azurerm --- terraform/{azure_rmprovider => azurerm}/provider.tf | 0 terraform/{azure_rmprovider => azurerm}/variables.tf | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename terraform/{azure_rmprovider => azurerm}/provider.tf (100%) rename terraform/{azure_rmprovider => azurerm}/variables.tf (100%) diff --git a/terraform/azure_rmprovider/provider.tf b/terraform/azurerm/provider.tf similarity index 100% rename from terraform/azure_rmprovider/provider.tf rename to terraform/azurerm/provider.tf diff --git a/terraform/azure_rmprovider/variables.tf b/terraform/azurerm/variables.tf similarity index 100% rename from terraform/azure_rmprovider/variables.tf rename to terraform/azurerm/variables.tf From f778e8304ef97bd44d4d2f8a3e733aebae1cd506 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 28 Apr 2016 10:32:42 +0100 Subject: [PATCH 13/53] Addition of virtual network and storage account --- terraform/azurerm/bastian-publicip.tf | 7 +++++++ terraform/azurerm/network-security-group.tf | 18 ++++++++++++++++++ terraform/azurerm/resourcegroup.tf | 5 +++++ terraform/azurerm/storage.tf | 15 +++++++++++++++ terraform/azurerm/variables.tf | 14 +++++++++++++- terraform/azurerm/virtual-network-subnet.tf | 6 ++++++ terraform/azurerm/virtual-network.tf | 7 +++++++ 7 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 terraform/azurerm/bastian-publicip.tf create mode 100644 terraform/azurerm/network-security-group.tf create mode 100644 terraform/azurerm/resourcegroup.tf create mode 100644 terraform/azurerm/storage.tf create mode 100644 terraform/azurerm/virtual-network-subnet.tf create mode 100644 terraform/azurerm/virtual-network.tf diff --git a/terraform/azurerm/bastian-publicip.tf b/terraform/azurerm/bastian-publicip.tf new file mode 100644 index 00000000..0641cdba --- /dev/null +++ b/terraform/azurerm/bastian-publicip.tf @@ -0,0 +1,7 @@ +#Create Public IP Address for bastian server +resource "azurerm_public_ip" "bastian_publicip" { + name = "BastianPublicIp" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} \ No newline at end of file diff --git a/terraform/azurerm/network-security-group.tf b/terraform/azurerm/network-security-group.tf new file mode 100644 index 00000000..726c92bc --- /dev/null +++ b/terraform/azurerm/network-security-group.tf @@ -0,0 +1,18 @@ +#Create Network Security Group +resource "azurerm_network_security_group" "network_security_group" { + name = "AzureRM_NetworkSecurityGroup" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + + security_rule { + name = "AzureRM_SecurityRuleTcp" + priority = 100 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "*" + source_address_prefix = "*" + destination_address_prefix = "*" + } +} \ No newline at end of file diff --git a/terraform/azurerm/resourcegroup.tf b/terraform/azurerm/resourcegroup.tf new file mode 100644 index 00000000..e066efd5 --- /dev/null +++ b/terraform/azurerm/resourcegroup.tf @@ -0,0 +1,5 @@ +# Create a resource group +resource "azurerm_resource_group" "resource_group" { + name = "AzureRM-Resource-Group" + location = "${var.region}" +} \ No newline at end of file diff --git a/terraform/azurerm/storage.tf b/terraform/azurerm/storage.tf new file mode 100644 index 00000000..8073d282 --- /dev/null +++ b/terraform/azurerm/storage.tf @@ -0,0 +1,15 @@ +# Create a storage account +resource "azurerm_storage_account" "storage_account" { + name = "${var.storage_account_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" + account_type = "Standard_GRS" +} + +# Create storage container +resource "azurerm_storage_container" "storage_container" { + name = "${var.storage_container_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + storage_account_name = "${azurerm_storage_account.storage_account.name}" + container_access_type = "private" +} \ No newline at end of file diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index ec761415..ed2d2995 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -14,15 +14,27 @@ variable "tenant_id" { description = "The oAuth 2 tenant id." } -variable "location" { +variable "region" { description = "The deployment azure data centre location." + default = "North Europe" } variable "vn_cidr_block" { description = "Cidr block for the VN." + default = "10.0.0.0/16" } variable "subnet_cidr_block" { description = "CIDR for private subnet" + default = "10.0.0.0/24" } +variable "storage_account_name" { + description = "Storage account name" + default = "mesosimages" +} + +variable "storage_container_name" { + description = "Storage container name" + default = "mesosimages-container" +} \ No newline at end of file diff --git a/terraform/azurerm/virtual-network-subnet.tf b/terraform/azurerm/virtual-network-subnet.tf new file mode 100644 index 00000000..5a41df75 --- /dev/null +++ b/terraform/azurerm/virtual-network-subnet.tf @@ -0,0 +1,6 @@ +resource "azurerm_subnet" "subnet" { + name = "AzureRM_Subnet" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" + address_prefix = "${var.subnet_cidr_block}" +} \ No newline at end of file diff --git a/terraform/azurerm/virtual-network.tf b/terraform/azurerm/virtual-network.tf new file mode 100644 index 00000000..dde47dda --- /dev/null +++ b/terraform/azurerm/virtual-network.tf @@ -0,0 +1,7 @@ +# Create a virtual network +resource "azurerm_virtual_network" "virtual_network" { + name = "AzureRM-Virtual-Network" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + address_space = ["${var.vn_cidr_block}"] + location = "${var.region}" +} \ No newline at end of file From 88c2bd85b8d58c5f45c5fe6ef49be646f0616753 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 28 Apr 2016 17:01:37 +0100 Subject: [PATCH 14/53] Addition bastion server and master servers configuration --- terraform/azurerm/bastion-publicip.tf | 7 +++ terraform/azurerm/bastion-server.tf | 47 +++++++++++++++++++ terraform/azurerm/master-publicip.tf | 9 ++++ terraform/azurerm/mesos-masters.tf | 51 +++++++++++++++++++++ terraform/azurerm/network-security-group.tf | 43 +++++++++++++++-- terraform/azurerm/storage.tf | 3 +- terraform/azurerm/variables.tf | 27 ++++++++++- terraform/azurerm/virtual-network-subnet.tf | 3 +- terraform/azurerm/virtual-network.tf | 3 +- 9 files changed, 186 insertions(+), 7 deletions(-) create mode 100644 terraform/azurerm/bastion-publicip.tf create mode 100644 terraform/azurerm/bastion-server.tf create mode 100644 terraform/azurerm/master-publicip.tf create mode 100644 terraform/azurerm/mesos-masters.tf diff --git a/terraform/azurerm/bastion-publicip.tf b/terraform/azurerm/bastion-publicip.tf new file mode 100644 index 00000000..4dfa65eb --- /dev/null +++ b/terraform/azurerm/bastion-publicip.tf @@ -0,0 +1,7 @@ +#Create Public IP Address for bastion server +resource "azurerm_public_ip" "bastion_publicip" { + name = "BastionPublicIp" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf new file mode 100644 index 00000000..ca1af2b5 --- /dev/null +++ b/terraform/azurerm/bastion-server.tf @@ -0,0 +1,47 @@ +# Create a network interface for bastion server +resource "azurerm_network_interface" "bastion_network_interface" { + name = "Bastion_NetworkInterface" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "bastionipconfiguration" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${azurerm_public_ip.bastion_publicip.id}" + } +} + +# NAT/VPN server +resource "azurerm_virtual_machine" "bastion" { + name = "apollo-bastion" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${azurerm_network_interface.bastion_network_interface.id}"] + vm_size = "${var.instance_type.master}" + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "14.04.2-LTS" + version = "latest" + } + + storage_os_disk { + name = "bastiondisk" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/bastiondisk.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "${var.bastion_server_computername}" + admin_username = "${var.bastion_server_username}" + admin_password = "${var.bastion_server_password}" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} diff --git a/terraform/azurerm/master-publicip.tf b/terraform/azurerm/master-publicip.tf new file mode 100644 index 00000000..e7630175 --- /dev/null +++ b/terraform/azurerm/master-publicip.tf @@ -0,0 +1,9 @@ +#Create Public IP Address for master servers +resource "azurerm_public_ip" "master_publicip" { + name = "MasterPublicIp-${count.index}" + count = "${var.masters_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} + diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/mesos-masters.tf new file mode 100644 index 00000000..54a127f4 --- /dev/null +++ b/terraform/azurerm/mesos-masters.tf @@ -0,0 +1,51 @@ +# Create a network interface for bastion server +resource "azurerm_network_interface" "master_network_interface" { + name = "Master_NetworkInterface-${count.index}" + count = "${var.masters_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "masteripconfiguration-${count.index}" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${element(azurerm_public_ip.master_publicip.*.id, count.index)}" + } +} + +# Master server +resource "azurerm_virtual_machine" "master" { + name = "apollo-mesos-master-${count.index}" + count = "${var.masters_count}" + location = "${var.region}" + depends_on = ["azurerm_virtual_machine.bastion"] + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.master_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.master}" + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "14.04.2-LTS" + version = "latest" + } + + storage_os_disk { + name = "masterdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/masterdisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "Mesos-Master-${count.index}" + admin_username = "${var.bastion_server_username}" + admin_password = "${var.bastion_server_password}" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} + diff --git a/terraform/azurerm/network-security-group.tf b/terraform/azurerm/network-security-group.tf index 726c92bc..7e2ee982 100644 --- a/terraform/azurerm/network-security-group.tf +++ b/terraform/azurerm/network-security-group.tf @@ -5,14 +5,51 @@ resource "azurerm_network_security_group" "network_security_group" { resource_group_name = "${azurerm_resource_group.resource_group.name}" security_rule { - name = "AzureRM_SecurityRuleTcp" + name = "AzureRM_SecurityRuleSSH" priority = 100 direction = "Inbound" access = "Allow" protocol = "Tcp" source_port_range = "*" - destination_port_range = "*" + destination_port_range = "22" source_address_prefix = "*" destination_address_prefix = "*" } -} \ No newline at end of file + + security_rule { + name = "AzureRM_SecurityRuleOpenVPN" + priority = 101 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "1194" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenHTTPS" + priority = 102 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "443" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenHTTP" + priority = 103 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "80" + source_address_prefix = "*" + destination_address_prefix = "*" + } +} + diff --git a/terraform/azurerm/storage.tf b/terraform/azurerm/storage.tf index 8073d282..a08322e4 100644 --- a/terraform/azurerm/storage.tf +++ b/terraform/azurerm/storage.tf @@ -12,4 +12,5 @@ resource "azurerm_storage_container" "storage_container" { resource_group_name = "${azurerm_resource_group.resource_group.name}" storage_account_name = "${azurerm_storage_account.storage_account.name}" container_access_type = "private" -} \ No newline at end of file +} + diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index ed2d2995..8f795010 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -37,4 +37,29 @@ variable "storage_account_name" { variable "storage_container_name" { description = "Storage container name" default = "mesosimages-container" -} \ No newline at end of file +} + +variable "instance_type" { + default = { + master = "Standard_A0" + slave = "Standard_A0" + } +} + +variable "bastion_server_computername" { + description = "Username to access server" + default = "bastion" +} + +variable "bastion_server_username" { + description = "Username to access server" +} + +variable "bastion_server_password" { + description = "Password to access server" +} + +variable "masters_count" { + description = "The number of masters." + default = "2" +} diff --git a/terraform/azurerm/virtual-network-subnet.tf b/terraform/azurerm/virtual-network-subnet.tf index 5a41df75..133cdedc 100644 --- a/terraform/azurerm/virtual-network-subnet.tf +++ b/terraform/azurerm/virtual-network-subnet.tf @@ -1,6 +1,7 @@ +#Create Subnet resource "azurerm_subnet" "subnet" { name = "AzureRM_Subnet" resource_group_name = "${azurerm_resource_group.resource_group.name}" virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" address_prefix = "${var.subnet_cidr_block}" -} \ No newline at end of file +} diff --git a/terraform/azurerm/virtual-network.tf b/terraform/azurerm/virtual-network.tf index dde47dda..76e83fb8 100644 --- a/terraform/azurerm/virtual-network.tf +++ b/terraform/azurerm/virtual-network.tf @@ -4,4 +4,5 @@ resource "azurerm_virtual_network" "virtual_network" { resource_group_name = "${azurerm_resource_group.resource_group.name}" address_space = ["${var.vn_cidr_block}"] location = "${var.region}" -} \ No newline at end of file +} + From 974d0faee203f77276aa2c35eba6670a504951eb Mon Sep 17 00:00:00 2001 From: heywoodj Date: Fri, 29 Apr 2016 14:42:42 +0100 Subject: [PATCH 15/53] updates and addition of slave server configuration --- terraform/azurerm/bastian-publicip.tf | 7 --- ...-publicip.tf => mesos-master-publicips.tf} | 6 ++- terraform/azurerm/mesos-masters.tf | 19 ++++--- terraform/azurerm/mesos-slave-publicips.tf | 12 +++++ terraform/azurerm/mesos-slaves.tf | 54 +++++++++++++++++++ terraform/azurerm/variables.tf | 31 ++++++++++- 6 files changed, 112 insertions(+), 17 deletions(-) delete mode 100644 terraform/azurerm/bastian-publicip.tf rename terraform/azurerm/{master-publicip.tf => mesos-master-publicips.tf} (87%) create mode 100644 terraform/azurerm/mesos-slave-publicips.tf create mode 100644 terraform/azurerm/mesos-slaves.tf diff --git a/terraform/azurerm/bastian-publicip.tf b/terraform/azurerm/bastian-publicip.tf deleted file mode 100644 index 0641cdba..00000000 --- a/terraform/azurerm/bastian-publicip.tf +++ /dev/null @@ -1,7 +0,0 @@ -#Create Public IP Address for bastian server -resource "azurerm_public_ip" "bastian_publicip" { - name = "BastianPublicIp" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - public_ip_address_allocation = "static" -} \ No newline at end of file diff --git a/terraform/azurerm/master-publicip.tf b/terraform/azurerm/mesos-master-publicips.tf similarity index 87% rename from terraform/azurerm/master-publicip.tf rename to terraform/azurerm/mesos-master-publicips.tf index e7630175..3e05ec22 100644 --- a/terraform/azurerm/master-publicip.tf +++ b/terraform/azurerm/mesos-master-publicips.tf @@ -1,9 +1,13 @@ +/* + #Create Public IP Address for master servers resource "azurerm_public_ip" "master_publicip" { name = "MasterPublicIp-${count.index}" - count = "${var.masters_count}" + count = "${var.master_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" public_ip_address_allocation = "static" } +*/ + diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/mesos-masters.tf index 54a127f4..ec03f0d1 100644 --- a/terraform/azurerm/mesos-masters.tf +++ b/terraform/azurerm/mesos-masters.tf @@ -1,7 +1,9 @@ -# Create a network interface for bastion server +/* + +# Create a network interface for master server resource "azurerm_network_interface" "master_network_interface" { name = "Master_NetworkInterface-${count.index}" - count = "${var.masters_count}" + count = "${var.master_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" @@ -15,9 +17,9 @@ resource "azurerm_network_interface" "master_network_interface" { } # Master server -resource "azurerm_virtual_machine" "master" { +resource "azurerm_virtual_machine" "mesos_master" { name = "apollo-mesos-master-${count.index}" - count = "${var.masters_count}" + count = "${var.master_count}" location = "${var.region}" depends_on = ["azurerm_virtual_machine.bastion"] resource_group_name = "${azurerm_resource_group.resource_group.name}" @@ -25,10 +27,10 @@ resource "azurerm_virtual_machine" "master" { vm_size = "${var.instance_type.master}" storage_image_reference { - publisher = "Canonical" - offer = "UbuntuServer" - sku = "14.04.2-LTS" - version = "latest" + publisher = "${var.atlas_artifact_master.publisher}" + offer = "${var.atlas_artifact_master.offer}" + sku = "${var.atlas_artifact_master.sku}" + version = "${var.atlas_artifact_master.version}" } storage_os_disk { @@ -49,3 +51,4 @@ resource "azurerm_virtual_machine" "master" { } } +*/ \ No newline at end of file diff --git a/terraform/azurerm/mesos-slave-publicips.tf b/terraform/azurerm/mesos-slave-publicips.tf new file mode 100644 index 00000000..080d1bea --- /dev/null +++ b/terraform/azurerm/mesos-slave-publicips.tf @@ -0,0 +1,12 @@ +/* + +#Create Public IP Address for slave servers +resource "azurerm_public_ip" "slave_publicip" { + name = "SlavePublicIp-${count.index}" + count = "${var.slave_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} + +*/ diff --git a/terraform/azurerm/mesos-slaves.tf b/terraform/azurerm/mesos-slaves.tf new file mode 100644 index 00000000..35f4b990 --- /dev/null +++ b/terraform/azurerm/mesos-slaves.tf @@ -0,0 +1,54 @@ +/* + +# Create a network interface for slave server +resource "azurerm_network_interface" "slave_network_interface" { + name = "Slave_NetworkInterface-${count.index}" + count = "${var.slave_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "slaveipconfiguration-${count.index}" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${element(azurerm_public_ip.slave_publicip.*.id, count.index)}" + } +} + +# Slave server +resource "azurerm_virtual_machine" "mesos_slave" { + name = "apollo-mesos-slave-${count.index}" + count = "${var.slave_count}" + location = "${var.region}" + depends_on = ["azurerm_virtual_machine.bastion", "azurerm_virtual_machine.mesos_master"] + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.slave_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.slave}" + + storage_image_reference { + publisher = "${var.atlas_artifact_slave.publisher}" + offer = "${var.atlas_artifact_slave.offer}" + sku = "${var.atlas_artifact_slave.sku}" + version = "${var.atlas_artifact_slave.version}" + } + + storage_os_disk { + name = "slavedisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/slavedisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "Mesos-Slave-${count.index}" + admin_username = "${var.bastion_server_username}" + admin_password = "${var.bastion_server_password}" + } + + os_profile_linux_config { + disable_password_authentication = false + } +} + +*/ \ No newline at end of file diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index 8f795010..52ca2904 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -39,6 +39,24 @@ variable "storage_container_name" { default = "mesosimages-container" } +variable "atlas_artifact_master" { + default = { + publisher = "" + offer ="" + "sku" = "" + "version" = "" + } +} + +variable "atlas_artifact_slave" { + default = { + publisher = "" + offer ="" + "sku" = "" + "version" = "" + } +} + variable "instance_type" { default = { master = "Standard_A0" @@ -59,7 +77,18 @@ variable "bastion_server_password" { description = "Password to access server" } -variable "masters_count" { +variable "master_count" { description = "The number of masters." default = "2" } + +variable "slave_count" { + description = "The number of slaves." + default = "2" +} + +variable "docker_version" { + description = "Docker version" + default = "1.9.0-0~trusty" +} + From d8e04d65fc64dd0659a87aa02da31c908f54c861 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Fri, 6 May 2016 09:48:07 +0100 Subject: [PATCH 16/53] update slave references to agent --- .../{mesos-slave-publicips.tf => mesos-agent-publicips.tf} | 0 terraform/azurerm/{mesos-slaves.tf => mesos-agents.tf} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename terraform/azurerm/{mesos-slave-publicips.tf => mesos-agent-publicips.tf} (100%) rename terraform/azurerm/{mesos-slaves.tf => mesos-agents.tf} (100%) diff --git a/terraform/azurerm/mesos-slave-publicips.tf b/terraform/azurerm/mesos-agent-publicips.tf similarity index 100% rename from terraform/azurerm/mesos-slave-publicips.tf rename to terraform/azurerm/mesos-agent-publicips.tf diff --git a/terraform/azurerm/mesos-slaves.tf b/terraform/azurerm/mesos-agents.tf similarity index 100% rename from terraform/azurerm/mesos-slaves.tf rename to terraform/azurerm/mesos-agents.tf From 15cda480f0eeee75def7fe1ce80ef6f60f14410a Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 9 May 2016 11:50:59 +0100 Subject: [PATCH 17/53] Updates to run remote execution scripts on server --- terraform/azurerm/bastion-server.tf | 43 ++++++++++++++++-- terraform/azurerm/mesos-agent-publicips.tf | 14 +++--- terraform/azurerm/mesos-agents.tf | 50 ++++++++++----------- terraform/azurerm/mesos-master-publicips.tf | 7 +-- terraform/azurerm/mesos-masters.tf | 14 +++--- terraform/azurerm/variables.tf | 35 ++++++++++++--- 6 files changed, 102 insertions(+), 61 deletions(-) diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf index ca1af2b5..c4d5a7c1 100644 --- a/terraform/azurerm/bastion-server.tf +++ b/terraform/azurerm/bastion-server.tf @@ -36,12 +36,47 @@ resource "azurerm_virtual_machine" "bastion" { } os_profile { - computer_name = "${var.bastion_server_computername}" + computer_name = "${var.bastion_server_computername}" admin_username = "${var.bastion_server_username}" admin_password = "${var.bastion_server_password}" } - + os_profile_linux_config { - disable_password_authentication = false - } + disable_password_authentication = false + + /* ssh_keys { + path = "/home/${var.bastion_server_username}/.ssh/authorized_keys" + key_data = "${file("${var.ssh_public_key_file}")}" + } */ + } + + provisioner "remote-exec" { + + connection { + host = "${azurerm_public_ip.bastion_publicip.ip_address}" + type = "ssh" + user = "${var.bastion_server_username}" + password = "${var.bastion_server_password}" + /* private_key = "${file("${var.ssh_private_key_file}")}" */ + } + + inline = [ + "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", + "echo 1 | sudo tee /proc/sys/net/ipv4/conf/all/forwarding", + /* Install docker */ + /* Add the repository to your APT sources */ + "sudo -E sh -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list'", + /* Then import the repository key */ + "sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D", + "sudo apt-get update", + /* Install docker-engine */ + "sudo apt-get install -y docker-engine=${var.docker_version}", + "sudo service docker start", + /* Initialize open vpn data container */ + "sudo mkdir -p /etc/openvpn", + "sudo docker run --name ovpn-data -v /etc/openvpn busybox", + /* Generate OpenVPN server config */ + "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vn_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.id}" + ] + } } diff --git a/terraform/azurerm/mesos-agent-publicips.tf b/terraform/azurerm/mesos-agent-publicips.tf index 080d1bea..c7b36b96 100644 --- a/terraform/azurerm/mesos-agent-publicips.tf +++ b/terraform/azurerm/mesos-agent-publicips.tf @@ -1,12 +1,8 @@ -/* - -#Create Public IP Address for slave servers -resource "azurerm_public_ip" "slave_publicip" { - name = "SlavePublicIp-${count.index}" - count = "${var.slave_count}" +#Create Public IP Address for agent servers +resource "azurerm_public_ip" "agent_publicip" { + name = "AgentPublicIp-${count.index}" + count = "${var.agent_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" public_ip_address_allocation = "static" -} - -*/ +} \ No newline at end of file diff --git a/terraform/azurerm/mesos-agents.tf b/terraform/azurerm/mesos-agents.tf index 35f4b990..2f9637cf 100644 --- a/terraform/azurerm/mesos-agents.tf +++ b/terraform/azurerm/mesos-agents.tf @@ -1,54 +1,50 @@ -/* - -# Create a network interface for slave server -resource "azurerm_network_interface" "slave_network_interface" { - name = "Slave_NetworkInterface-${count.index}" - count = "${var.slave_count}" +# Create a network interface for agent server +resource "azurerm_network_interface" "agent_network_interface" { + name = "Agent_NetworkInterface-${count.index}" + count = "${var.agent_count}" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" ip_configuration { - name = "slaveipconfiguration-${count.index}" + name = "agentipconfiguration-${count.index}" subnet_id = "${azurerm_subnet.subnet.id}" private_ip_address_allocation = "dynamic" - public_ip_address_id = "${element(azurerm_public_ip.slave_publicip.*.id, count.index)}" + public_ip_address_id = "${element(azurerm_public_ip.agent_publicip.*.id, count.index)}" } } -# Slave server -resource "azurerm_virtual_machine" "mesos_slave" { - name = "apollo-mesos-slave-${count.index}" - count = "${var.slave_count}" +# Agent server +resource "azurerm_virtual_machine" "mesos_agent" { + name = "apollo-mesos-agent-${count.index}" + count = "${var.agent_count}" location = "${var.region}" depends_on = ["azurerm_virtual_machine.bastion", "azurerm_virtual_machine.mesos_master"] resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_interface_ids = ["${element(azurerm_network_interface.slave_network_interface.*.id, count.index)}"] - vm_size = "${var.instance_type.slave}" + network_interface_ids = ["${element(azurerm_network_interface.agent_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.agent}" storage_image_reference { - publisher = "${var.atlas_artifact_slave.publisher}" - offer = "${var.atlas_artifact_slave.offer}" - sku = "${var.atlas_artifact_slave.sku}" - version = "${var.atlas_artifact_slave.version}" + publisher = "${var.atlas_artifact_agent.publisher}" + offer = "${var.atlas_artifact_agent.offer}" + sku = "${var.atlas_artifact_agent.sku}" + version = "${var.atlas_artifact_agent.version}" } storage_os_disk { - name = "slavedisk${count.index}" - vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/slavedisk-${count.index}.vhd" + name = "agentdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/agentdisk-${count.index}.vhd" caching = "ReadWrite" create_option = "FromImage" } os_profile { - computer_name = "Mesos-Slave-${count.index}" - admin_username = "${var.bastion_server_username}" - admin_password = "${var.bastion_server_password}" + computer_name = "Mesos-Agent-${count.index}" + admin_username = "${var.agent_server_username}" + admin_password = "${var.agent_server_password}" } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = false } -} - -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/terraform/azurerm/mesos-master-publicips.tf b/terraform/azurerm/mesos-master-publicips.tf index 3e05ec22..7aaa3edc 100644 --- a/terraform/azurerm/mesos-master-publicips.tf +++ b/terraform/azurerm/mesos-master-publicips.tf @@ -1,5 +1,3 @@ -/* - #Create Public IP Address for master servers resource "azurerm_public_ip" "master_publicip" { name = "MasterPublicIp-${count.index}" @@ -7,7 +5,4 @@ resource "azurerm_public_ip" "master_publicip" { location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" public_ip_address_allocation = "static" -} - -*/ - +} \ No newline at end of file diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/mesos-masters.tf index ec03f0d1..f4d0d7df 100644 --- a/terraform/azurerm/mesos-masters.tf +++ b/terraform/azurerm/mesos-masters.tf @@ -1,5 +1,3 @@ -/* - # Create a network interface for master server resource "azurerm_network_interface" "master_network_interface" { name = "Master_NetworkInterface-${count.index}" @@ -41,14 +39,12 @@ resource "azurerm_virtual_machine" "mesos_master" { } os_profile { - computer_name = "Mesos-Master-${count.index}" - admin_username = "${var.bastion_server_username}" - admin_password = "${var.bastion_server_password}" + computer_name = "Mesos-Master-${count.index}" + admin_username = "${var.master_server_username}" + admin_password = "${var.master_server_password}" } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = false } -} - -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index 52ca2904..2290fc72 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -48,7 +48,7 @@ variable "atlas_artifact_master" { } } -variable "atlas_artifact_slave" { +variable "atlas_artifact_agent" { default = { publisher = "" offer ="" @@ -60,7 +60,7 @@ variable "atlas_artifact_slave" { variable "instance_type" { default = { master = "Standard_A0" - slave = "Standard_A0" + agent = "Standard_A0" } } @@ -76,15 +76,31 @@ variable "bastion_server_username" { variable "bastion_server_password" { description = "Password to access server" } + +variable "master_server_username" { + description = "Username to access master server" +} + +variable "master_server_password" { + description = "Password to access master server" +} + +variable "agent_server_username" { + description = "Username to access agent server" +} + +variable "agent_server_password" { + description = "Password to access agent server" +} variable "master_count" { description = "The number of masters." - default = "2" + default = "1" } -variable "slave_count" { - description = "The number of slaves." - default = "2" +variable "agent_count" { + description = "The number of agents." + default = "1" } variable "docker_version" { @@ -92,3 +108,10 @@ variable "docker_version" { default = "1.9.0-0~trusty" } +variable "ssh_public_key_file" { + description = "Public key required to connect via ssh" +} + +variable "ssh_private_key_file" { + description = "Public key required to connect via ssh" +} From be8a3d44ea13a977cd2e5a03708cf9f086c810e3 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 10 May 2016 14:47:45 +0100 Subject: [PATCH 18/53] update remote-exec to use certificate authentication, requires Terraform v0.6.16 --- terraform/azurerm/bastion-server.tf | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf index c4d5a7c1..bb478e1c 100644 --- a/terraform/azurerm/bastion-server.tf +++ b/terraform/azurerm/bastion-server.tf @@ -42,24 +42,21 @@ resource "azurerm_virtual_machine" "bastion" { } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = true - /* ssh_keys { + ssh_keys { path = "/home/${var.bastion_server_username}/.ssh/authorized_keys" - key_data = "${file("${var.ssh_public_key_file}")}" - } */ + key_data = "${file("${var.ssh_public_key_file}")}" # openssh format + } + } + + connection { + host = "${azurerm_public_ip.bastion_publicip.ip_address}" + user = "${var.bastion_server_username}" + private_key = "${file("${var.ssh_private_key_file}")}" # openssh format } provisioner "remote-exec" { - - connection { - host = "${azurerm_public_ip.bastion_publicip.ip_address}" - type = "ssh" - user = "${var.bastion_server_username}" - password = "${var.bastion_server_password}" - /* private_key = "${file("${var.ssh_private_key_file}")}" */ - } - inline = [ "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", "echo 1 | sudo tee /proc/sys/net/ipv4/conf/all/forwarding", @@ -79,4 +76,4 @@ resource "azurerm_virtual_machine" "bastion" { "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vn_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.id}" ] } -} +} \ No newline at end of file From 92f594a0f0185c3df6b391ac6deb73b3c99fa857 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 10 May 2016 16:57:27 +0100 Subject: [PATCH 19/53] Clean up formatting --- terraform/azurerm/bastion-publicip.tf | 8 +- terraform/azurerm/bastion-server.tf | 62 +++++++------- terraform/azurerm/mesos-agent-publicips.tf | 8 +- terraform/azurerm/mesos-agents.tf | 28 +++--- terraform/azurerm/mesos-master-publicips.tf | 8 +- terraform/azurerm/mesos-masters.tf | 56 ++++++------ terraform/azurerm/network-security-group.tf | 94 ++++++++++----------- terraform/azurerm/provider.tf | 8 +- terraform/azurerm/resourcegroup.tf | 4 +- terraform/azurerm/storage.tf | 16 ++-- terraform/azurerm/virtual-network-subnet.tf | 8 +- terraform/azurerm/virtual-network.tf | 8 +- 12 files changed, 154 insertions(+), 154 deletions(-) diff --git a/terraform/azurerm/bastion-publicip.tf b/terraform/azurerm/bastion-publicip.tf index 4dfa65eb..d171ad12 100644 --- a/terraform/azurerm/bastion-publicip.tf +++ b/terraform/azurerm/bastion-publicip.tf @@ -1,7 +1,7 @@ #Create Public IP Address for bastion server resource "azurerm_public_ip" "bastion_publicip" { - name = "BastionPublicIp" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - public_ip_address_allocation = "static" + name = "BastionPublicIp" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" } diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf index bb478e1c..dc1d5bf6 100644 --- a/terraform/azurerm/bastion-server.tf +++ b/terraform/azurerm/bastion-server.tf @@ -1,47 +1,47 @@ # Create a network interface for bastion server resource "azurerm_network_interface" "bastion_network_interface" { - name = "Bastion_NetworkInterface" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + name = "Bastion_NetworkInterface" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" - ip_configuration { - name = "bastionipconfiguration" - subnet_id = "${azurerm_subnet.subnet.id}" - private_ip_address_allocation = "dynamic" + ip_configuration { + name = "bastionipconfiguration" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" public_ip_address_id = "${azurerm_public_ip.bastion_publicip.id}" - } + } } # NAT/VPN server resource "azurerm_virtual_machine" "bastion" { - name = "apollo-bastion" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_interface_ids = ["${azurerm_network_interface.bastion_network_interface.id}"] - vm_size = "${var.instance_type.master}" + name = "apollo-bastion" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${azurerm_network_interface.bastion_network_interface.id}"] + vm_size = "${var.instance_type.master}" - storage_image_reference { - publisher = "Canonical" + storage_image_reference { + publisher = "Canonical" offer = "UbuntuServer" sku = "14.04.2-LTS" version = "latest" - } + } - storage_os_disk { - name = "bastiondisk" - vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/bastiondisk.vhd" - caching = "ReadWrite" - create_option = "FromImage" - } + storage_os_disk { + name = "bastiondisk" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/bastiondisk.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } - os_profile { + os_profile { computer_name = "${var.bastion_server_computername}" - admin_username = "${var.bastion_server_username}" - admin_password = "${var.bastion_server_password}" - } - - os_profile_linux_config { + admin_username = "${var.bastion_server_username}" + admin_password = "${var.bastion_server_password}" + } + + os_profile_linux_config { disable_password_authentication = true ssh_keys { @@ -49,13 +49,13 @@ resource "azurerm_virtual_machine" "bastion" { key_data = "${file("${var.ssh_public_key_file}")}" # openssh format } } - + connection { host = "${azurerm_public_ip.bastion_publicip.ip_address}" user = "${var.bastion_server_username}" private_key = "${file("${var.ssh_private_key_file}")}" # openssh format } - + provisioner "remote-exec" { inline = [ "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", diff --git a/terraform/azurerm/mesos-agent-publicips.tf b/terraform/azurerm/mesos-agent-publicips.tf index c7b36b96..f23960f8 100644 --- a/terraform/azurerm/mesos-agent-publicips.tf +++ b/terraform/azurerm/mesos-agent-publicips.tf @@ -1,8 +1,8 @@ #Create Public IP Address for agent servers resource "azurerm_public_ip" "agent_publicip" { - name = "AgentPublicIp-${count.index}" + name = "AgentPublicIp-${count.index}" count = "${var.agent_count}" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - public_ip_address_allocation = "static" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" } \ No newline at end of file diff --git a/terraform/azurerm/mesos-agents.tf b/terraform/azurerm/mesos-agents.tf index 2f9637cf..686c92a3 100644 --- a/terraform/azurerm/mesos-agents.tf +++ b/terraform/azurerm/mesos-agents.tf @@ -1,31 +1,31 @@ # Create a network interface for agent server resource "azurerm_network_interface" "agent_network_interface" { - name = "Agent_NetworkInterface-${count.index}" + name = "Agent_NetworkInterface-${count.index}" count = "${var.agent_count}" location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" - ip_configuration { - name = "agentipconfiguration-${count.index}" - subnet_id = "${azurerm_subnet.subnet.id}" - private_ip_address_allocation = "dynamic" + ip_configuration { + name = "agentipconfiguration-${count.index}" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" public_ip_address_id = "${element(azurerm_public_ip.agent_publicip.*.id, count.index)}" - } + } } # Agent server resource "azurerm_virtual_machine" "mesos_agent" { - name = "apollo-mesos-agent-${count.index}" + name = "apollo-mesos-agent-${count.index}" count = "${var.agent_count}" - location = "${var.region}" + location = "${var.region}" depends_on = ["azurerm_virtual_machine.bastion", "azurerm_virtual_machine.mesos_master"] - resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_interface_ids = ["${element(azurerm_network_interface.agent_network_interface.*.id, count.index)}"] - vm_size = "${var.instance_type.agent}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.agent_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.agent}" storage_image_reference { - publisher = "${var.atlas_artifact_agent.publisher}" + publisher = "${var.atlas_artifact_agent.publisher}" offer = "${var.atlas_artifact_agent.offer}" sku = "${var.atlas_artifact_agent.sku}" version = "${var.atlas_artifact_agent.version}" diff --git a/terraform/azurerm/mesos-master-publicips.tf b/terraform/azurerm/mesos-master-publicips.tf index 7aaa3edc..0cdb1286 100644 --- a/terraform/azurerm/mesos-master-publicips.tf +++ b/terraform/azurerm/mesos-master-publicips.tf @@ -1,8 +1,8 @@ #Create Public IP Address for master servers resource "azurerm_public_ip" "master_publicip" { - name = "MasterPublicIp-${count.index}" + name = "MasterPublicIp-${count.index}" count = "${var.master_count}" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - public_ip_address_allocation = "static" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" } \ No newline at end of file diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/mesos-masters.tf index f4d0d7df..0254254d 100644 --- a/terraform/azurerm/mesos-masters.tf +++ b/terraform/azurerm/mesos-masters.tf @@ -1,50 +1,50 @@ # Create a network interface for master server resource "azurerm_network_interface" "master_network_interface" { - name = "Master_NetworkInterface-${count.index}" + name = "Master_NetworkInterface-${count.index}" count = "${var.master_count}" location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" - ip_configuration { - name = "masteripconfiguration-${count.index}" - subnet_id = "${azurerm_subnet.subnet.id}" - private_ip_address_allocation = "dynamic" + ip_configuration { + name = "masteripconfiguration-${count.index}" + subnet_id = "${azurerm_subnet.subnet.id}" + private_ip_address_allocation = "dynamic" public_ip_address_id = "${element(azurerm_public_ip.master_publicip.*.id, count.index)}" - } + } } # Master server resource "azurerm_virtual_machine" "mesos_master" { - name = "apollo-mesos-master-${count.index}" + name = "apollo-mesos-master-${count.index}" count = "${var.master_count}" - location = "${var.region}" + location = "${var.region}" depends_on = ["azurerm_virtual_machine.bastion"] - resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_interface_ids = ["${element(azurerm_network_interface.master_network_interface.*.id, count.index)}"] - vm_size = "${var.instance_type.master}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.master_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.master}" - storage_image_reference { - publisher = "${var.atlas_artifact_master.publisher}" + storage_image_reference { + publisher = "${var.atlas_artifact_master.publisher}" offer = "${var.atlas_artifact_master.offer}" sku = "${var.atlas_artifact_master.sku}" version = "${var.atlas_artifact_master.version}" - } + } - storage_os_disk { - name = "masterdisk${count.index}" - vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/masterdisk-${count.index}.vhd" - caching = "ReadWrite" - create_option = "FromImage" - } + storage_os_disk { + name = "masterdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/masterdisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } - os_profile { + os_profile { computer_name = "Mesos-Master-${count.index}" - admin_username = "${var.master_server_username}" - admin_password = "${var.master_server_password}" - } + admin_username = "${var.master_server_username}" + admin_password = "${var.master_server_password}" + } - os_profile_linux_config { + os_profile_linux_config { disable_password_authentication = false - } + } } \ No newline at end of file diff --git a/terraform/azurerm/network-security-group.tf b/terraform/azurerm/network-security-group.tf index 7e2ee982..1f63e8da 100644 --- a/terraform/azurerm/network-security-group.tf +++ b/terraform/azurerm/network-security-group.tf @@ -1,55 +1,55 @@ #Create Network Security Group resource "azurerm_network_security_group" "network_security_group" { - name = "AzureRM_NetworkSecurityGroup" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" + name = "AzureRM_NetworkSecurityGroup" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" - security_rule { - name = "AzureRM_SecurityRuleSSH" - priority = 100 - direction = "Inbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "22" - source_address_prefix = "*" - destination_address_prefix = "*" - } - security_rule { - name = "AzureRM_SecurityRuleOpenVPN" - priority = 101 - direction = "Inbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "1194" - source_address_prefix = "*" - destination_address_prefix = "*" - } - + name = "AzureRM_SecurityRuleSSH" + priority = 100 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "22" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenVPN" + priority = 101 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "1194" + source_address_prefix = "*" + destination_address_prefix = "*" + } + security_rule { - name = "AzureRM_SecurityRuleOpenHTTPS" - priority = 102 - direction = "Inbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "443" - source_address_prefix = "*" - destination_address_prefix = "*" - } - + name = "AzureRM_SecurityRuleOpenHTTPS" + priority = 102 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "443" + source_address_prefix = "*" + destination_address_prefix = "*" + } + security_rule { - name = "AzureRM_SecurityRuleOpenHTTP" - priority = 103 - direction = "Inbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "80" - source_address_prefix = "*" - destination_address_prefix = "*" - } + name = "AzureRM_SecurityRuleOpenHTTP" + priority = 103 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "80" + source_address_prefix = "*" + destination_address_prefix = "*" + } } diff --git a/terraform/azurerm/provider.tf b/terraform/azurerm/provider.tf index 3cf279d8..66fd5ba1 100644 --- a/terraform/azurerm/provider.tf +++ b/terraform/azurerm/provider.tf @@ -2,8 +2,8 @@ https://www.terraform.io/docs/providers/azurerm/index.html fo details. */ provider "azurerm" { - subscription_id = "${var.subscription_id}" - client_id = "${var.client_id}" - client_secret = "${var.client_secret}" - tenant_id = "${var.tenant_id}" + subscription_id = "${var.subscription_id}" + client_id = "${var.client_id}" + client_secret = "${var.client_secret}" + tenant_id = "${var.tenant_id}" } \ No newline at end of file diff --git a/terraform/azurerm/resourcegroup.tf b/terraform/azurerm/resourcegroup.tf index e066efd5..5616309f 100644 --- a/terraform/azurerm/resourcegroup.tf +++ b/terraform/azurerm/resourcegroup.tf @@ -1,5 +1,5 @@ # Create a resource group resource "azurerm_resource_group" "resource_group" { - name = "AzureRM-Resource-Group" - location = "${var.region}" + name = "AzureRM-Resource-Group" + location = "${var.region}" } \ No newline at end of file diff --git a/terraform/azurerm/storage.tf b/terraform/azurerm/storage.tf index a08322e4..8c39f7c0 100644 --- a/terraform/azurerm/storage.tf +++ b/terraform/azurerm/storage.tf @@ -1,16 +1,16 @@ # Create a storage account resource "azurerm_storage_account" "storage_account" { - name = "${var.storage_account_name}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - location = "${var.region}" - account_type = "Standard_GRS" + name = "${var.storage_account_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" + account_type = "Standard_GRS" } # Create storage container resource "azurerm_storage_container" "storage_container" { - name = "${var.storage_container_name}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - storage_account_name = "${azurerm_storage_account.storage_account.name}" - container_access_type = "private" + name = "${var.storage_container_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + storage_account_name = "${azurerm_storage_account.storage_account.name}" + container_access_type = "private" } diff --git a/terraform/azurerm/virtual-network-subnet.tf b/terraform/azurerm/virtual-network-subnet.tf index 133cdedc..83a5ec25 100644 --- a/terraform/azurerm/virtual-network-subnet.tf +++ b/terraform/azurerm/virtual-network-subnet.tf @@ -1,7 +1,7 @@ #Create Subnet resource "azurerm_subnet" "subnet" { - name = "AzureRM_Subnet" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" - address_prefix = "${var.subnet_cidr_block}" + name = "AzureRM_Subnet" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" + address_prefix = "${var.subnet_cidr_block}" } diff --git a/terraform/azurerm/virtual-network.tf b/terraform/azurerm/virtual-network.tf index 76e83fb8..ad860517 100644 --- a/terraform/azurerm/virtual-network.tf +++ b/terraform/azurerm/virtual-network.tf @@ -1,8 +1,8 @@ # Create a virtual network resource "azurerm_virtual_network" "virtual_network" { - name = "AzureRM-Virtual-Network" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - address_space = ["${var.vn_cidr_block}"] - location = "${var.region}" + name = "AzureRM-Virtual-Network" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + address_space = ["${var.vn_cidr_block}"] + location = "${var.region}" } From 522d7c70af0117f9ded6dc2e7a44242250edcf95 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 10 May 2016 17:06:03 +0100 Subject: [PATCH 20/53] Clean up formatting --- terraform/azurerm/bastion-server.tf | 2 +- terraform/azurerm/mesos-agents.tf | 32 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/bastion-server.tf index dc1d5bf6..777d5981 100644 --- a/terraform/azurerm/bastion-server.tf +++ b/terraform/azurerm/bastion-server.tf @@ -74,6 +74,6 @@ resource "azurerm_virtual_machine" "bastion" { "sudo docker run --name ovpn-data -v /etc/openvpn busybox", /* Generate OpenVPN server config */ "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vn_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.id}" - ] + ] } } \ No newline at end of file diff --git a/terraform/azurerm/mesos-agents.tf b/terraform/azurerm/mesos-agents.tf index 686c92a3..de027fa8 100644 --- a/terraform/azurerm/mesos-agents.tf +++ b/terraform/azurerm/mesos-agents.tf @@ -24,27 +24,27 @@ resource "azurerm_virtual_machine" "mesos_agent" { network_interface_ids = ["${element(azurerm_network_interface.agent_network_interface.*.id, count.index)}"] vm_size = "${var.instance_type.agent}" - storage_image_reference { + storage_image_reference { publisher = "${var.atlas_artifact_agent.publisher}" offer = "${var.atlas_artifact_agent.offer}" sku = "${var.atlas_artifact_agent.sku}" - version = "${var.atlas_artifact_agent.version}" - } - - storage_os_disk { - name = "agentdisk${count.index}" - vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/agentdisk-${count.index}.vhd" - caching = "ReadWrite" - create_option = "FromImage" - } + version = "${var.atlas_artifact_agent.version}" + } + + storage_os_disk { + name = "agentdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/agentdisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } - os_profile { + os_profile { computer_name = "Mesos-Agent-${count.index}" - admin_username = "${var.agent_server_username}" - admin_password = "${var.agent_server_password}" - } + admin_username = "${var.agent_server_username}" + admin_password = "${var.agent_server_password}" + } - os_profile_linux_config { + os_profile_linux_config { disable_password_authentication = false - } + } } \ No newline at end of file From c0f64c7cdfceba22c12d97a47df204e5e8700d10 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 10 May 2016 17:08:43 +0100 Subject: [PATCH 21/53] Clean up formatting --- terraform/azurerm/variables.tf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/variables.tf index 2290fc72..5047df43 100644 --- a/terraform/azurerm/variables.tf +++ b/terraform/azurerm/variables.tf @@ -30,13 +30,13 @@ variable "subnet_cidr_block" { } variable "storage_account_name" { - description = "Storage account name" - default = "mesosimages" + description = "Storage account name" + default = "mesosimages" } variable "storage_container_name" { - description = "Storage container name" - default = "mesosimages-container" + description = "Storage container name" + default = "mesosimages-container" } variable "atlas_artifact_master" { @@ -95,12 +95,12 @@ variable "agent_server_password" { variable "master_count" { description = "The number of masters." - default = "1" + default = "1" } variable "agent_count" { description = "The number of agents." - default = "1" + default = "1" } variable "docker_version" { From 7f35c1e2fc6e5662bb11a641c4cc238d996a1b52 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 16 May 2016 10:57:51 +0100 Subject: [PATCH 22/53] Move into 'private-cloud' folder --- terraform/azurerm/{ => private-cloud}/bastion-publicip.tf | 0 terraform/azurerm/{ => private-cloud}/bastion-server.tf | 0 terraform/azurerm/{ => private-cloud}/mesos-agent-publicips.tf | 0 terraform/azurerm/{ => private-cloud}/mesos-agents.tf | 0 terraform/azurerm/{ => private-cloud}/mesos-master-publicips.tf | 0 terraform/azurerm/{ => private-cloud}/mesos-masters.tf | 0 terraform/azurerm/{ => private-cloud}/network-security-group.tf | 0 terraform/azurerm/{ => private-cloud}/provider.tf | 0 terraform/azurerm/{ => private-cloud}/resourcegroup.tf | 0 terraform/azurerm/{ => private-cloud}/storage.tf | 0 terraform/azurerm/{ => private-cloud}/variables.tf | 0 terraform/azurerm/{ => private-cloud}/virtual-network-subnet.tf | 0 terraform/azurerm/{ => private-cloud}/virtual-network.tf | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename terraform/azurerm/{ => private-cloud}/bastion-publicip.tf (100%) rename terraform/azurerm/{ => private-cloud}/bastion-server.tf (100%) rename terraform/azurerm/{ => private-cloud}/mesos-agent-publicips.tf (100%) rename terraform/azurerm/{ => private-cloud}/mesos-agents.tf (100%) rename terraform/azurerm/{ => private-cloud}/mesos-master-publicips.tf (100%) rename terraform/azurerm/{ => private-cloud}/mesos-masters.tf (100%) rename terraform/azurerm/{ => private-cloud}/network-security-group.tf (100%) rename terraform/azurerm/{ => private-cloud}/provider.tf (100%) rename terraform/azurerm/{ => private-cloud}/resourcegroup.tf (100%) rename terraform/azurerm/{ => private-cloud}/storage.tf (100%) rename terraform/azurerm/{ => private-cloud}/variables.tf (100%) rename terraform/azurerm/{ => private-cloud}/virtual-network-subnet.tf (100%) rename terraform/azurerm/{ => private-cloud}/virtual-network.tf (100%) diff --git a/terraform/azurerm/bastion-publicip.tf b/terraform/azurerm/private-cloud/bastion-publicip.tf similarity index 100% rename from terraform/azurerm/bastion-publicip.tf rename to terraform/azurerm/private-cloud/bastion-publicip.tf diff --git a/terraform/azurerm/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf similarity index 100% rename from terraform/azurerm/bastion-server.tf rename to terraform/azurerm/private-cloud/bastion-server.tf diff --git a/terraform/azurerm/mesos-agent-publicips.tf b/terraform/azurerm/private-cloud/mesos-agent-publicips.tf similarity index 100% rename from terraform/azurerm/mesos-agent-publicips.tf rename to terraform/azurerm/private-cloud/mesos-agent-publicips.tf diff --git a/terraform/azurerm/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf similarity index 100% rename from terraform/azurerm/mesos-agents.tf rename to terraform/azurerm/private-cloud/mesos-agents.tf diff --git a/terraform/azurerm/mesos-master-publicips.tf b/terraform/azurerm/private-cloud/mesos-master-publicips.tf similarity index 100% rename from terraform/azurerm/mesos-master-publicips.tf rename to terraform/azurerm/private-cloud/mesos-master-publicips.tf diff --git a/terraform/azurerm/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf similarity index 100% rename from terraform/azurerm/mesos-masters.tf rename to terraform/azurerm/private-cloud/mesos-masters.tf diff --git a/terraform/azurerm/network-security-group.tf b/terraform/azurerm/private-cloud/network-security-group.tf similarity index 100% rename from terraform/azurerm/network-security-group.tf rename to terraform/azurerm/private-cloud/network-security-group.tf diff --git a/terraform/azurerm/provider.tf b/terraform/azurerm/private-cloud/provider.tf similarity index 100% rename from terraform/azurerm/provider.tf rename to terraform/azurerm/private-cloud/provider.tf diff --git a/terraform/azurerm/resourcegroup.tf b/terraform/azurerm/private-cloud/resourcegroup.tf similarity index 100% rename from terraform/azurerm/resourcegroup.tf rename to terraform/azurerm/private-cloud/resourcegroup.tf diff --git a/terraform/azurerm/storage.tf b/terraform/azurerm/private-cloud/storage.tf similarity index 100% rename from terraform/azurerm/storage.tf rename to terraform/azurerm/private-cloud/storage.tf diff --git a/terraform/azurerm/variables.tf b/terraform/azurerm/private-cloud/variables.tf similarity index 100% rename from terraform/azurerm/variables.tf rename to terraform/azurerm/private-cloud/variables.tf diff --git a/terraform/azurerm/virtual-network-subnet.tf b/terraform/azurerm/private-cloud/virtual-network-subnet.tf similarity index 100% rename from terraform/azurerm/virtual-network-subnet.tf rename to terraform/azurerm/private-cloud/virtual-network-subnet.tf diff --git a/terraform/azurerm/virtual-network.tf b/terraform/azurerm/private-cloud/virtual-network.tf similarity index 100% rename from terraform/azurerm/virtual-network.tf rename to terraform/azurerm/private-cloud/virtual-network.tf From a6c68cbde40f61cf1fe5f30d1d34659b478c9e49 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 16 May 2016 16:34:13 +0100 Subject: [PATCH 23/53] Update to configure VM's through bastion host --- .../azurerm/private-cloud/bastion-publicip.tf | 13 +++ .../azurerm/private-cloud/bastion-server.tf | 101 ++++++++++++++---- .../private-cloud/mesos-agent-publicips.tf | 8 -- .../mesos-agents-availability-set.tf | 11 ++ .../azurerm/private-cloud/mesos-agents.tf | 87 +++++++++++++-- .../private-cloud/mesos-master-publicips.tf | 8 -- .../mesos-masters-availability-set.tf | 11 ++ .../azurerm/private-cloud/mesos-masters.tf | 89 +++++++++++++-- .../private-cloud/network-security-group.tf | 4 + .../{resourcegroup.tf => resource-group.tf} | 5 + terraform/azurerm/private-cloud/storage.tf | 54 +++++++++- terraform/azurerm/private-cloud/variables.tf | 35 ++++-- .../private-cloud/virtual-network-subnet.tf | 9 ++ .../azurerm/private-cloud/virtual-network.tf | 10 +- 14 files changed, 378 insertions(+), 67 deletions(-) delete mode 100644 terraform/azurerm/private-cloud/mesos-agent-publicips.tf create mode 100644 terraform/azurerm/private-cloud/mesos-agents-availability-set.tf delete mode 100644 terraform/azurerm/private-cloud/mesos-master-publicips.tf create mode 100644 terraform/azurerm/private-cloud/mesos-masters-availability-set.tf rename terraform/azurerm/private-cloud/{resourcegroup.tf => resource-group.tf} (60%) diff --git a/terraform/azurerm/private-cloud/bastion-publicip.tf b/terraform/azurerm/private-cloud/bastion-publicip.tf index d171ad12..c34bf8ec 100644 --- a/terraform/azurerm/private-cloud/bastion-publicip.tf +++ b/terraform/azurerm/private-cloud/bastion-publicip.tf @@ -5,3 +5,16 @@ resource "azurerm_public_ip" "bastion_publicip" { resource_group_name = "${azurerm_resource_group.resource_group.name}" public_ip_address_allocation = "static" } + +#Output +output "bastion_publicip_id" { + value = "${azurerm_public_ip.bastion_publicip.id}" +} + +output "bastion_publicip_ipaddress" { + value = "${azurerm_public_ip.bastion_publicip.ip_address}" +} + +output "bastion_publicip_fqdn" { + value = "${azurerm_public_ip.bastion_publicip.fqdn}" +} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 777d5981..56bd09fc 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -22,10 +22,10 @@ resource "azurerm_virtual_machine" "bastion" { vm_size = "${var.instance_type.master}" storage_image_reference { - publisher = "Canonical" - offer = "UbuntuServer" - sku = "14.04.2-LTS" - version = "latest" + publisher = "${var.artifact_bastion.publisher}" + offer = "${var.artifact_bastion.offer}" + sku = "${var.artifact_bastion.sku}" + version = "${var.artifact_bastion.version}" } storage_os_disk { @@ -50,30 +50,87 @@ resource "azurerm_virtual_machine" "bastion" { } } + tags { + Name = "apollo-mesos-bastion" + role = "bastion" + } + connection { host = "${azurerm_public_ip.bastion_publicip.ip_address}" user = "${var.bastion_server_username}" private_key = "${file("${var.ssh_private_key_file}")}" # openssh format } + # Do some early bootstrapping of the CoreOS machines. This will install + + # python and pip so we can use as the ansible_python_interpreter in our playbooks + + provisioner "file" { + + source = "coreos" + + destination = "/tmp" + + } + + + # provisioner "file" { + # source = "../../scripts/coreos" + # destination = "/tmp" + #} + provisioner "remote-exec" { + inline = [ - "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", - "echo 1 | sudo tee /proc/sys/net/ipv4/conf/all/forwarding", - /* Install docker */ - /* Add the repository to your APT sources */ - "sudo -E sh -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list'", - /* Then import the repository key */ - "sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D", - "sudo apt-get update", - /* Install docker-engine */ - "sudo apt-get install -y docker-engine=${var.docker_version}", - "sudo service docker start", - /* Initialize open vpn data container */ - "sudo mkdir -p /etc/openvpn", - "sudo docker run --name ovpn-data -v /etc/openvpn busybox", - /* Generate OpenVPN server config */ - "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vn_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.id}" - ] - } + + "sudo chmod -R +x /tmp/coreos", + + "/tmp/coreos/bootstrap.sh", + + "~/bin/python /tmp/coreos/get-pip.py", + + "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip", + + "sudo rm -rf /tmp/coreos", + + # Initialize open VPN container and server config + "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", + + "sudo docker run --name ovpn-data -v /etc/openvpn busybox", + + "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vpc_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.ip_address}" + + ] + + } +} + +# Bastion network interface outputs +output "bastion_network_interface_id" { + value = "${azurerm_network_interface.bastion_network_interface.id}" +} + +output "bastion_network_interface_macaddress" { + value = "${azurerm_network_interface.bastion_network_interface.mac_address}" +} + +output "bastion_network_interface_privateipaddress" { + value = "${azurerm_network_interface.bastion_network_interface.private_ip_address}" +} + +output "bastion_network_interface_virtualmachineid" { + value = "${azurerm_network_interface.bastion_network_interface.virtual_machine_id}" +} + +output "bastion_network_interface_applieddnsservers" { + value = "${azurerm_network_interface.bastion_network_interface.applied_dns_servers}" +} + +output "bastion_network_interface_internalfqdn" { + value = "${azurerm_network_interface.bastion_network_interface.internal_fqdn}" +} + +# Bastion virtual machine outputs +output "bastion_virtual_machine_id" { + value = "${azurerm_virtual_machine.bastion.id}" } \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/mesos-agent-publicips.tf b/terraform/azurerm/private-cloud/mesos-agent-publicips.tf deleted file mode 100644 index f23960f8..00000000 --- a/terraform/azurerm/private-cloud/mesos-agent-publicips.tf +++ /dev/null @@ -1,8 +0,0 @@ -#Create Public IP Address for agent servers -resource "azurerm_public_ip" "agent_publicip" { - name = "AgentPublicIp-${count.index}" - count = "${var.agent_count}" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - public_ip_address_allocation = "static" -} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/mesos-agents-availability-set.tf b/terraform/azurerm/private-cloud/mesos-agents-availability-set.tf new file mode 100644 index 00000000..8e5c8c46 --- /dev/null +++ b/terraform/azurerm/private-cloud/mesos-agents-availability-set.tf @@ -0,0 +1,11 @@ +# Create an availability set for agent servers +resource "azurerm_availability_set" "agent" { + name = "Agent_AvailabilitySet" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" +} + +# Mesos agent availability set outputs +output "mesos_agent_virtual_machine_ids" { + value = "${azurerm_availability_set.agent.id}" +} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index de027fa8..92dd21b2 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -10,7 +10,6 @@ resource "azurerm_network_interface" "agent_network_interface" { name = "agentipconfiguration-${count.index}" subnet_id = "${azurerm_subnet.subnet.id}" private_ip_address_allocation = "dynamic" - public_ip_address_id = "${element(azurerm_public_ip.agent_publicip.*.id, count.index)}" } } @@ -19,16 +18,17 @@ resource "azurerm_virtual_machine" "mesos_agent" { name = "apollo-mesos-agent-${count.index}" count = "${var.agent_count}" location = "${var.region}" + availability_set_id = "${azurerm_availability_set.agent.id}" depends_on = ["azurerm_virtual_machine.bastion", "azurerm_virtual_machine.mesos_master"] resource_group_name = "${azurerm_resource_group.resource_group.name}" network_interface_ids = ["${element(azurerm_network_interface.agent_network_interface.*.id, count.index)}"] vm_size = "${var.instance_type.agent}" storage_image_reference { - publisher = "${var.atlas_artifact_agent.publisher}" - offer = "${var.atlas_artifact_agent.offer}" - sku = "${var.atlas_artifact_agent.sku}" - version = "${var.atlas_artifact_agent.version}" + publisher = "${var.artifact_agent.publisher}" + offer = "${var.artifact_agent.offer}" + sku = "${var.artifact_agent.sku}" + version = "${var.artifact_agent.version}" } storage_os_disk { @@ -45,6 +45,81 @@ resource "azurerm_virtual_machine" "mesos_agent" { } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = true + + ssh_keys { + path = "/home/${var.agent_server_username}/.ssh/authorized_keys" + key_data = "${file("${var.ssh_public_key_file}")}" # openssh format + } } + + tags = { + Name = "apollo-mesos-agent-${count.index}" + role = "mesos_agents" + } + + connection { + user = "${var.agent_server_username}" + host = "${element(azurerm_network_interface.agent_network_interface.*.private_ip_address, count.index)}" + private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + bastion_host = "${azurerm_public_ip.bastion_publicip.ip_address}" + bastion_user = "${var.bastion_server_username}" + bastion_private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + } + + # Do some early bootstrapping of the CoreOS machines. This will install + # python and pip so we can use as the ansible_python_interpreter in our playbooks + provisioner "file" { + + source = "coreos" + + destination = "/tmp" + + } + + + # provisioner "file" { + # source = "../../scripts/coreos" + # destination = "/tmp" + # } + + provisioner "remote-exec" { + inline = [ + "sudo chmod -R +x /tmp/coreos", + "/tmp/coreos/bootstrap.sh", + "~/bin/python /tmp/coreos/get-pip.py", + "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip", + "sudo rm -rf /tmp/coreos" + ] + } +} + +# Mesos agent network interface outputs +output "mesos_agent_network_interface_ids" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.id)}" +} + +output "mesos_agent_network_interface_macaddresses" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.mac_address)}" +} + +output "mesos_agent_network_interface_privateipaddresses" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.private_ip_address)}" +} + +output "mesos_agent_network_interface_virtualmachineids" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.virtual_machine_id)}" +} + +output "mesos_agent_network_interface_applieddnsservers" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.applied_dns_servers)}" +} + +output "mesos_agent_network_interface_internalfqdns" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.internal_fqdn)}" +} + +# Mesos agent virtual machine outputs +output "mesos_agent_virtual_machine_ids" { + value = "${join(",", azurerm_virtual_machine.mesos_agent.*.id)}" } \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/mesos-master-publicips.tf b/terraform/azurerm/private-cloud/mesos-master-publicips.tf deleted file mode 100644 index 0cdb1286..00000000 --- a/terraform/azurerm/private-cloud/mesos-master-publicips.tf +++ /dev/null @@ -1,8 +0,0 @@ -#Create Public IP Address for master servers -resource "azurerm_public_ip" "master_publicip" { - name = "MasterPublicIp-${count.index}" - count = "${var.master_count}" - location = "${var.region}" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - public_ip_address_allocation = "static" -} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/mesos-masters-availability-set.tf b/terraform/azurerm/private-cloud/mesos-masters-availability-set.tf new file mode 100644 index 00000000..2f4f674a --- /dev/null +++ b/terraform/azurerm/private-cloud/mesos-masters-availability-set.tf @@ -0,0 +1,11 @@ +# Create an availability set for master servers +resource "azurerm_availability_set" "master" { + name = "Master_AvailabilitySet" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" +} + +# Mesos master availability set outputs +output "mesos_master_virtual_machine_ids" { + value = "${azurerm_availability_set.master.id}" +} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 0254254d..30ed93d0 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -10,7 +10,6 @@ resource "azurerm_network_interface" "master_network_interface" { name = "masteripconfiguration-${count.index}" subnet_id = "${azurerm_subnet.subnet.id}" private_ip_address_allocation = "dynamic" - public_ip_address_id = "${element(azurerm_public_ip.master_publicip.*.id, count.index)}" } } @@ -19,16 +18,17 @@ resource "azurerm_virtual_machine" "mesos_master" { name = "apollo-mesos-master-${count.index}" count = "${var.master_count}" location = "${var.region}" + availability_set_id = "${azurerm_availability_set.master.id}" depends_on = ["azurerm_virtual_machine.bastion"] resource_group_name = "${azurerm_resource_group.resource_group.name}" network_interface_ids = ["${element(azurerm_network_interface.master_network_interface.*.id, count.index)}"] vm_size = "${var.instance_type.master}" storage_image_reference { - publisher = "${var.atlas_artifact_master.publisher}" - offer = "${var.atlas_artifact_master.offer}" - sku = "${var.atlas_artifact_master.sku}" - version = "${var.atlas_artifact_master.version}" + publisher = "${var.artifact_master.publisher}" + offer = "${var.artifact_master.offer}" + sku = "${var.artifact_master.sku}" + version = "${var.artifact_master.version}" } storage_os_disk { @@ -39,12 +39,87 @@ resource "azurerm_virtual_machine" "mesos_master" { } os_profile { - computer_name = "Mesos-Master-${count.index}" + computer_name = "apollo-mesos-master-${count.index}" admin_username = "${var.master_server_username}" admin_password = "${var.master_server_password}" } os_profile_linux_config { - disable_password_authentication = false + disable_password_authentication = true + + ssh_keys { + path = "/home/${var.master_server_username}/.ssh/authorized_keys" + key_data = "${file("${var.ssh_public_key_file}")}" # openssh format + } } + + tags { + Name = "apollo-mesos-master-${count.index}" + role = "mesos_masters" + } + + connection { + user = "${var.master_server_username}" + host = "${element(azurerm_network_interface.master_network_interface.*.private_ip_address, count.index)}" + private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + bastion_host = "${azurerm_public_ip.bastion_publicip.ip_address}" + bastion_user = "${var.bastion_server_username}" + bastion_private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + } + + # Do some early bootstrapping of the CoreOS machines. This will install + # python and pip so we can use as the ansible_python_interpreter in our playbooks + provisioner "file" { + + source = "coreos" + + destination = "/tmp" + + } + + + # provisioner "file" { + # source = "../../scripts/coreos" + # destination = "/tmp" + # } + + provisioner "remote-exec" { + inline = [ + "sudo chmod -R +x /tmp/coreos", + "/tmp/coreos/bootstrap.sh", + "~/bin/python /tmp/coreos/get-pip.py", + "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip", + "sudo rm -rf /tmp/coreos" + ] + } +} + +# Mesos master network interface outputs +output "mesos_master_network_interface_ids" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.id)}" +} + +output "mesos_master_network_interface_macaddresses" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.mac_address)}" +} + +output "mesos_master_network_interface_privateipaddresses" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.private_ip_address)}" +} + +output "mesos_master_network_interface_virtualmachineids" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.virtual_machine_id)}" +} + +output "mesos_master_network_interface_applieddnsservers" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.applied_dns_servers)}" +} + +output "mesos_master_network_interface_internalfqdns" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.internal_fqdn)}" +} + +# Mesos master virtual machine outputs +output "mesos_master_virtual_machine_ids" { + value = "${join(",", azurerm_virtual_machine.mesos_master.*.id)}" } \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/network-security-group.tf b/terraform/azurerm/private-cloud/network-security-group.tf index 1f63e8da..bcde1e09 100644 --- a/terraform/azurerm/private-cloud/network-security-group.tf +++ b/terraform/azurerm/private-cloud/network-security-group.tf @@ -53,3 +53,7 @@ resource "azurerm_network_security_group" "network_security_group" { } } +#Output +output "network_security_group_id" { + value = "${azurerm_network_security_group.network_security_group.id}" +} diff --git a/terraform/azurerm/private-cloud/resourcegroup.tf b/terraform/azurerm/private-cloud/resource-group.tf similarity index 60% rename from terraform/azurerm/private-cloud/resourcegroup.tf rename to terraform/azurerm/private-cloud/resource-group.tf index 5616309f..75be4923 100644 --- a/terraform/azurerm/private-cloud/resourcegroup.tf +++ b/terraform/azurerm/private-cloud/resource-group.tf @@ -2,4 +2,9 @@ resource "azurerm_resource_group" "resource_group" { name = "AzureRM-Resource-Group" location = "${var.region}" +} + +#Output +output "resource_group_id" { + value = "${azurerm_resource_group.resource_group.id}" } \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/storage.tf b/terraform/azurerm/private-cloud/storage.tf index 8c39f7c0..3aa64e7b 100644 --- a/terraform/azurerm/private-cloud/storage.tf +++ b/terraform/azurerm/private-cloud/storage.tf @@ -3,7 +3,7 @@ resource "azurerm_storage_account" "storage_account" { name = "${var.storage_account_name}" resource_group_name = "${azurerm_resource_group.resource_group.name}" location = "${var.region}" - account_type = "Standard_GRS" + account_type = "${var.storage_account_type}" } # Create storage container @@ -12,5 +12,55 @@ resource "azurerm_storage_container" "storage_container" { resource_group_name = "${azurerm_resource_group.resource_group.name}" storage_account_name = "${azurerm_storage_account.storage_account.name}" container_access_type = "private" -} + depends_on = ["azurerm_storage_account.storage_account"] +} + +# Storage Account Output +output "storage_account_id" { + value = "${azurerm_storage_account.storage_account.id}" +} + +output "storage_account_primary_location" { + value = "${azurerm_storage_account.storage_account.primary_location}" +} + +output "storage_account_secondary_location" { + value = "${azurerm_storage_account.storage_account.secondary_location}" +} + +output "storage_account_primary_blob_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_blob_endpoint}" +} + +output "storage_account_secondary_blob_endpoint" { + value = "${azurerm_storage_account.storage_account.secondary_blob_endpoint}" +} + +output "storage_account_primary_queue_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_queue_endpoint}" +} + +output "storage_account_secondary_queue_endpoint" { + value = "${azurerm_storage_account.storage_account.secondary_queue_endpoint}" +} + +output "storage_account_primary_table_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_table_endpoint}" +} + +output "storage_account_secondary_table_endpoint" { + value = "${azurerm_storage_account.storage_account.secondary_table_endpoint}" +} + +output "storage_account_primary_file_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_file_endpoint}" +} +# Storage Container Output +output "storage_container_id" { + value = "${azurerm_storage_container.storage_container.id}" +} + +output "storage_container_properties" { + value = "${azurerm_storage_container.storage_container.properties}" +} diff --git a/terraform/azurerm/private-cloud/variables.tf b/terraform/azurerm/private-cloud/variables.tf index 5047df43..9ca60cc7 100644 --- a/terraform/azurerm/private-cloud/variables.tf +++ b/terraform/azurerm/private-cloud/variables.tf @@ -19,7 +19,7 @@ variable "region" { default = "North Europe" } -variable "vn_cidr_block" { +variable "vpc_cidr_block" { description = "Cidr block for the VN." default = "10.0.0.0/16" } @@ -34,26 +34,39 @@ variable "storage_account_name" { default = "mesosimages" } +variable "storage_account_type" { + description = "Storage account type" +} + variable "storage_container_name" { description = "Storage container name" default = "mesosimages-container" } -variable "atlas_artifact_master" { +variable "artifact_bastion" { + default = { + publisher = "CoreOS" + offer ="CoreOS" + "sku" = "Stable" + "version" = "latest" + } +} + +variable "artifact_master" { default = { - publisher = "" - offer ="" - "sku" = "" - "version" = "" + publisher = "CoreOS" + offer ="CoreOS" + "sku" = "Stable" + "version" = "latest" } } -variable "atlas_artifact_agent" { +variable "artifact_agent" { default = { - publisher = "" - offer ="" - "sku" = "" - "version" = "" + publisher = "CoreOS" + offer ="CoreOS" + "sku" = "Stable" + "version" = "latest" } } diff --git a/terraform/azurerm/private-cloud/virtual-network-subnet.tf b/terraform/azurerm/private-cloud/virtual-network-subnet.tf index 83a5ec25..aed6f4b5 100644 --- a/terraform/azurerm/private-cloud/virtual-network-subnet.tf +++ b/terraform/azurerm/private-cloud/virtual-network-subnet.tf @@ -5,3 +5,12 @@ resource "azurerm_subnet" "subnet" { virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" address_prefix = "${var.subnet_cidr_block}" } + +#Output +output "subnet_id" { + value = "${azurerm_subnet.subnet.id}" +} + +output "subnet_ip_configurations" { + value = "${azurerm_subnet.subnet.ip_configurations}" +} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/virtual-network.tf b/terraform/azurerm/private-cloud/virtual-network.tf index ad860517..b7c3a0ff 100644 --- a/terraform/azurerm/private-cloud/virtual-network.tf +++ b/terraform/azurerm/private-cloud/virtual-network.tf @@ -1,8 +1,12 @@ # Create a virtual network resource "azurerm_virtual_network" "virtual_network" { - name = "AzureRM-Virtual-Network" + name = "AzureRM-Virtual-Network" resource_group_name = "${azurerm_resource_group.resource_group.name}" - address_space = ["${var.vn_cidr_block}"] - location = "${var.region}" + address_space = ["${var.vpc_cidr_block}"] + location = "${var.region}" } +#Output +output "network_confirguration_id" { + value = "${azurerm_virtual_network.virtual_network.id}" +} \ No newline at end of file From 53dc1e1230fc91a190ccda6b7e8940362be3c29c Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 16 May 2016 16:38:15 +0100 Subject: [PATCH 24/53] Update servers to copy files from correct location. --- .../azurerm/private-cloud/bastion-server.tf | 15 +++------------ terraform/azurerm/private-cloud/mesos-agents.tf | 17 ++++------------- .../azurerm/private-cloud/mesos-masters.tf | 17 ++++------------- 3 files changed, 11 insertions(+), 38 deletions(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 56bd09fc..3ed2b519 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -65,19 +65,10 @@ resource "azurerm_virtual_machine" "bastion" { # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - - source = "coreos" - - destination = "/tmp" - + provisioner "file" { + source = "../../scripts/coreos" + destination = "/tmp" } - - - # provisioner "file" { - # source = "../../scripts/coreos" - # destination = "/tmp" - #} provisioner "remote-exec" { diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index 92dd21b2..fd6d50cd 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -69,19 +69,10 @@ resource "azurerm_virtual_machine" "mesos_agent" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - - source = "coreos" - - destination = "/tmp" - - } - - - # provisioner "file" { - # source = "../../scripts/coreos" - # destination = "/tmp" - # } + provisioner "file" { + source = "../../scripts/coreos" + destination = "/tmp" + } provisioner "remote-exec" { inline = [ diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 30ed93d0..5ab4fd26 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -69,19 +69,10 @@ resource "azurerm_virtual_machine" "mesos_master" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - - source = "coreos" - - destination = "/tmp" - - } - - - # provisioner "file" { - # source = "../../scripts/coreos" - # destination = "/tmp" - # } + provisioner "file" { + source = "../../scripts/coreos" + destination = "/tmp" + } provisioner "remote-exec" { inline = [ From 5ae33fc00686043f5e5b4cc8c0c03b6a95e2f436 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 16 May 2016 16:40:19 +0100 Subject: [PATCH 25/53] Fix format issue. --- terraform/azurerm/private-cloud/bastion-server.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 3ed2b519..f564b315 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -62,9 +62,8 @@ resource "azurerm_virtual_machine" "bastion" { } # Do some early bootstrapping of the CoreOS machines. This will install - # python and pip so we can use as the ansible_python_interpreter in our playbooks - + provisioner "file" { source = "../../scripts/coreos" destination = "/tmp" From a8142a7b88ef89f4cbf2c6d8817b104f861ee76b Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 16 May 2016 16:41:20 +0100 Subject: [PATCH 26/53] Fix format issue. --- terraform/azurerm/private-cloud/bastion-server.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index f564b315..2bfba76d 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -63,7 +63,6 @@ resource "azurerm_virtual_machine" "bastion" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { source = "../../scripts/coreos" destination = "/tmp" From 12effba577fe114e43bf5d7f45eb5f1c1e179e42 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 17 May 2016 16:56:07 +0100 Subject: [PATCH 27/53] Inclusion of cloud config and seperation of subnets --- .../private-cloud/agent-cloud-config.yml.tpl | 48 +++++++++++++++++++ .../bastion-cloud-config.yml.tpl | 20 ++++++++ .../azurerm/private-cloud/bastion-server.tf | 26 ++++++++-- .../private-cloud/master-cloud-config.yml.tpl | 22 +++++++++ .../azurerm/private-cloud/mesos-agents.tf | 24 ++++++++-- .../azurerm/private-cloud/mesos-masters.tf | 26 +++++++--- .../template_file.etcd_discovery_url.tf | 12 +++++ terraform/azurerm/private-cloud/variables.tf | 14 +++++- .../private-cloud/virtual-network-subnet.tf | 16 ------- .../private-cloud/virtual-network-subnets.tf | 35 ++++++++++++++ 10 files changed, 209 insertions(+), 34 deletions(-) create mode 100644 terraform/azurerm/private-cloud/agent-cloud-config.yml.tpl create mode 100644 terraform/azurerm/private-cloud/bastion-cloud-config.yml.tpl create mode 100644 terraform/azurerm/private-cloud/master-cloud-config.yml.tpl create mode 100644 terraform/azurerm/private-cloud/template_file.etcd_discovery_url.tf delete mode 100644 terraform/azurerm/private-cloud/virtual-network-subnet.tf create mode 100644 terraform/azurerm/private-cloud/virtual-network-subnets.tf diff --git a/terraform/azurerm/private-cloud/agent-cloud-config.yml.tpl b/terraform/azurerm/private-cloud/agent-cloud-config.yml.tpl new file mode 100644 index 00000000..4a8640b3 --- /dev/null +++ b/terraform/azurerm/private-cloud/agent-cloud-config.yml.tpl @@ -0,0 +1,48 @@ +#cloud-config + +coreos: + units: + - name: format-ebs-volume.service + command: start + content: | + [Unit] + Description=Formats the ebs volume if needed + Before=docker.service + [Service] + Type=oneshot + RemainAfterExit=yes + ExecStart=/bin/bash -c '(/usr/sbin/blkid -t TYPE=ext4 | grep /dev/xvdb) || (/usr/sbin/wipefs -fa /dev/xvdb && /usr/sbin/mkfs.ext4 /dev/xvdb)' + - name: var-lib-docker.mount + command: start + content: | + [Unit] + Description=Mount ephemeral to /var/lib/docker + Requires=format-ebs-volume.service + After=format-ebs-volume.service + [Mount] + What=/dev/xvdb + Where=/var/lib/docker + Type=ext4 + - name: docker.service + drop-ins: + - name: 10-wait-docker.conf + content: | + [Unit] + After=var-lib-docker.mount + Requires=var-lib-docker.mount + etcd2: + proxy: on + listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 + discovery: ${etcd_discovery_url} + fleet: + metadata: "role=agent,region=${region}" + public-ip: "$public_ipv4" + etcd_servers: "http://localhost:2379" + locksmith: + endpoint: "http://localhost:2379" + units: + - name: etcd2.service + command: start + update: + reboot-strategy: best-effort +manage_etc_hosts: localhost \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/bastion-cloud-config.yml.tpl b/terraform/azurerm/private-cloud/bastion-cloud-config.yml.tpl new file mode 100644 index 00000000..e99c9fde --- /dev/null +++ b/terraform/azurerm/private-cloud/bastion-cloud-config.yml.tpl @@ -0,0 +1,20 @@ +#cloud-config + +coreos: + etcd2: + proxy: on + listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 + discovery: ${etcd_discovery_url} + fleet: + metadata: "role=bastion,region=${region}" + etcd_servers: "http://localhost:2379" + locksmith: + endpoint: "http://localhost:2379" + units: + - name: docker.service + command: start + - name: etcd2.service + command: start + update: + reboot-strategy: best-effort +manage_etc_hosts: localhost \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 2bfba76d..eb3af2ad 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -7,19 +7,31 @@ resource "azurerm_network_interface" "bastion_network_interface" { ip_configuration { name = "bastionipconfiguration" - subnet_id = "${azurerm_subnet.subnet.id}" + subnet_id = "${element(azurerm_subnet.public.*.id, count.index)}" private_ip_address_allocation = "dynamic" public_ip_address_id = "${azurerm_public_ip.bastion_publicip.id}" } } +# User profile template +resource "template_file" "bastion_cloud_init" { + template = "${file("bastion-cloud-config.yml.tpl")}" + depends_on = ["template_file.etcd_discovery_url"] + vars { + etcd_discovery_url = "${file(var.etcd_discovery_url_file)}" + size = "${var.master_count}" + vpc_cidr_block = "${var.vpc_cidr_block}" + region = "${var.region}" + } +} + # NAT/VPN server resource "azurerm_virtual_machine" "bastion" { name = "apollo-bastion" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" network_interface_ids = ["${azurerm_network_interface.bastion_network_interface.id}"] - vm_size = "${var.instance_type.master}" + vm_size = "${var.instance_type.bastion}" storage_image_reference { publisher = "${var.artifact_bastion.publisher}" @@ -39,6 +51,7 @@ resource "azurerm_virtual_machine" "bastion" { computer_name = "${var.bastion_server_computername}" admin_username = "${var.bastion_server_username}" admin_password = "${var.bastion_server_password}" + custom_data = "${base64encode(template_file.bastion_cloud_init.rendered)}" } os_profile_linux_config { @@ -62,10 +75,13 @@ resource "azurerm_virtual_machine" "bastion" { } # Do some early bootstrapping of the CoreOS machines. This will install + # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - source = "../../scripts/coreos" - destination = "/tmp" + + provisioner "file" { + + source = "../../scripts/coreos" + destination = "/tmp } provisioner "remote-exec" { diff --git a/terraform/azurerm/private-cloud/master-cloud-config.yml.tpl b/terraform/azurerm/private-cloud/master-cloud-config.yml.tpl new file mode 100644 index 00000000..df2f0b6e --- /dev/null +++ b/terraform/azurerm/private-cloud/master-cloud-config.yml.tpl @@ -0,0 +1,22 @@ +#cloud-config + +coreos: + etcd2: + # $private_ipv4 is populated by the cloud provider + # we don't have a $public_ipv4 in the private VPC + advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001 + initial-advertise-peer-urls: http://$private_ipv4:2380 + # listen on both the official ports and the legacy ports + # legacy ports can be omitted if your application doesn't depend on them + listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 + listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001 + # Discovery is populated by Terraform + discovery: ${etcd_discovery_url} + fleet: + metadata: "role=master,region=${region}" + units: + - name: etcd2.service + command: start + update: + reboot-strategy: best-effort +manage_etc_hosts: localhost \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index fd6d50cd..8b9c4bc9 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -8,11 +8,23 @@ resource "azurerm_network_interface" "agent_network_interface" { ip_configuration { name = "agentipconfiguration-${count.index}" - subnet_id = "${azurerm_subnet.subnet.id}" + subnet_id = "${element(azurerm_subnet.private.*.id, count.index)}" private_ip_address_allocation = "dynamic" } } +# User profile template +resource "template_file" "agent_cloud_init" { + template = "${file("agent-cloud-config.yml.tpl")}" + depends_on = ["template_file.etcd_discovery_url"] + vars { + etcd_discovery_url = "${file(var.etcd_discovery_url_file)}" + size = "${var.master_count}" + vpc_cidr_block = "${var.vpc_cidr_block}" + region = "${var.region}" + } +} + # Agent server resource "azurerm_virtual_machine" "mesos_agent" { name = "apollo-mesos-agent-${count.index}" @@ -42,6 +54,7 @@ resource "azurerm_virtual_machine" "mesos_agent" { computer_name = "Mesos-Agent-${count.index}" admin_username = "${var.agent_server_username}" admin_password = "${var.agent_server_password}" + custom_data = "${base64encode(template_file.agent_cloud_init.rendered)}" } os_profile_linux_config { @@ -69,10 +82,11 @@ resource "azurerm_virtual_machine" "mesos_agent" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - source = "../../scripts/coreos" - destination = "/tmp" - } + provisioner "file" { + + source = "../../scripts/coreos" + destination = "/tmp + } provisioner "remote-exec" { inline = [ diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 5ab4fd26..4452f7f5 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -8,11 +8,23 @@ resource "azurerm_network_interface" "master_network_interface" { ip_configuration { name = "masteripconfiguration-${count.index}" - subnet_id = "${azurerm_subnet.subnet.id}" + subnet_id = "${element(azurerm_subnet.private.*.id, count.index)}" private_ip_address_allocation = "dynamic" } } +# User profile template +resource "template_file" "master_cloud_init" { + template = "${file("master-cloud-config.yml.tpl")}" + depends_on = ["template_file.etcd_discovery_url"] + vars { + etcd_discovery_url = "${file(var.etcd_discovery_url_file)}" + size = "${var.master_count}" + vpc_cidr_block = "${var.vpc_cidr_block}" + region = "${var.region}" + } +} + # Master server resource "azurerm_virtual_machine" "mesos_master" { name = "apollo-mesos-master-${count.index}" @@ -42,6 +54,7 @@ resource "azurerm_virtual_machine" "mesos_master" { computer_name = "apollo-mesos-master-${count.index}" admin_username = "${var.master_server_username}" admin_password = "${var.master_server_password}" + custom_data = "${base64encode(template_file.master_cloud_init.rendered)}" } os_profile_linux_config { @@ -69,12 +82,13 @@ resource "azurerm_virtual_machine" "mesos_master" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - source = "../../scripts/coreos" - destination = "/tmp" - } + provisioner "file" { + + source = "../../scripts/coreos" + destination = "/tmp + } - provisioner "remote-exec" { + provisioner "remote-exec" { inline = [ "sudo chmod -R +x /tmp/coreos", "/tmp/coreos/bootstrap.sh", diff --git a/terraform/azurerm/private-cloud/template_file.etcd_discovery_url.tf b/terraform/azurerm/private-cloud/template_file.etcd_discovery_url.tf new file mode 100644 index 00000000..631cc0bb --- /dev/null +++ b/terraform/azurerm/private-cloud/template_file.etcd_discovery_url.tf @@ -0,0 +1,12 @@ +# Generate an etcd URL for the cluster +resource "template_file" "etcd_discovery_url" { + # template = "${file(/dev/null)}" + provisioner "local-exec" { + command = "curl https://discovery.etcd.io/new?size=${var.master_count} > ${var.etcd_discovery_url_file}" + } + + # This will regenerate the discovery URL if the cluster size changes, we include the bastion here + vars { + size = "${var.master_count}" + } +} diff --git a/terraform/azurerm/private-cloud/variables.tf b/terraform/azurerm/private-cloud/variables.tf index 9ca60cc7..bcea32e9 100644 --- a/terraform/azurerm/private-cloud/variables.tf +++ b/terraform/azurerm/private-cloud/variables.tf @@ -24,9 +24,14 @@ variable "vpc_cidr_block" { default = "10.0.0.0/16" } -variable "subnet_cidr_block" { +variable "private_subnet_cidr_block" { description = "CIDR for private subnet" - default = "10.0.0.0/24" + default = "10.0.1.0/24,10.0.2.0/24,10.0.3.0/24" +} + +variable "public_subnet_cidr_block" { + description = "CIDR for public subnet" + default = "10.0.101.0/24,10.0.102.0/24,10.0.103.0/24" } variable "storage_account_name" { @@ -72,6 +77,7 @@ variable "artifact_agent" { variable "instance_type" { default = { + bastion = "Standard_A0" master = "Standard_A0" agent = "Standard_A0" } @@ -128,3 +134,7 @@ variable "ssh_public_key_file" { variable "ssh_private_key_file" { description = "Public key required to connect via ssh" } + +variable "etcd_discovery_url_file" { + default = "etcd_discovery_url.txt" +} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/virtual-network-subnet.tf b/terraform/azurerm/private-cloud/virtual-network-subnet.tf deleted file mode 100644 index aed6f4b5..00000000 --- a/terraform/azurerm/private-cloud/virtual-network-subnet.tf +++ /dev/null @@ -1,16 +0,0 @@ -#Create Subnet -resource "azurerm_subnet" "subnet" { - name = "AzureRM_Subnet" - resource_group_name = "${azurerm_resource_group.resource_group.name}" - virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" - address_prefix = "${var.subnet_cidr_block}" -} - -#Output -output "subnet_id" { - value = "${azurerm_subnet.subnet.id}" -} - -output "subnet_ip_configurations" { - value = "${azurerm_subnet.subnet.ip_configurations}" -} \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/virtual-network-subnets.tf b/terraform/azurerm/private-cloud/virtual-network-subnets.tf new file mode 100644 index 00000000..d8953110 --- /dev/null +++ b/terraform/azurerm/private-cloud/virtual-network-subnets.tf @@ -0,0 +1,35 @@ +#Create public subnets +resource "azurerm_subnet" "public" { + name = "AzureRM_Public_Subnet-${count.index}" + count = "${length(compact(split(",", var.public_subnet_cidr_block)))}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" + address_prefix = "${element(split(",", var.public_subnet_cidr_block), count.index)}" +} + +#Create private subnets +resource "azurerm_subnet" "private" { + name = "AzureRM_Private_Subnet-${count.index}" + count = "${length(compact(split(",", var.private_subnet_cidr_block)))}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" + address_prefix = "${element(split(",", var.private_subnet_cidr_block), count.index)}" +} + +# Public subnets output +output "subnet_ids" { + value = "${join(",", azurerm_subnet.public.*.id)}" +} + +output "subnet_ip_configurations" { + value = "${join(",", azurerm_subnet.public.ip_configurations)}" +} + +# Private subnets output +output "subnet_ids" { + value = "${join(",", azurerm_subnet.private.*.id)}" +} + +output "subnet_ip_configurations" { + value = "${join(",", azurerm_subnet.private.ip_configurations)}" +} \ No newline at end of file From d7412d95f962dcf49ca4266e76c8bdf6576f049f Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 17 May 2016 17:01:03 +0100 Subject: [PATCH 28/53] Fix format issues --- terraform/azurerm/private-cloud/bastion-server.tf | 9 ++++----- terraform/azurerm/private-cloud/mesos-masters.tf | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index eb3af2ad..d8a78011 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -75,13 +75,12 @@ resource "azurerm_virtual_machine" "bastion" { } # Do some early bootstrapping of the CoreOS machines. This will install - + # python and pip so we can use as the ansible_python_interpreter in our playbooks - + provisioner "file" { - - source = "../../scripts/coreos" - destination = "/tmp + source = "../../scripts/coreos" + destination = "/tmp } provisioner "remote-exec" { diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 4452f7f5..3b99240f 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -84,8 +84,8 @@ resource "azurerm_virtual_machine" "mesos_master" { # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" - destination = "/tmp + source = "../../scripts/coreos" + destination = "/tmp } provisioner "remote-exec" { From 0af0c9d512ba29c5d77732e285a2f8531508269c Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 17 May 2016 17:02:54 +0100 Subject: [PATCH 29/53] Fix format issues --- terraform/azurerm/private-cloud/bastion-server.tf | 2 -- terraform/azurerm/private-cloud/mesos-agents.tf | 1 - terraform/azurerm/private-cloud/mesos-masters.tf | 1 - 3 files changed, 4 deletions(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index d8a78011..64fb73fa 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -75,9 +75,7 @@ resource "azurerm_virtual_machine" "bastion" { } # Do some early bootstrapping of the CoreOS machines. This will install - # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { source = "../../scripts/coreos" destination = "/tmp diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index 8b9c4bc9..f311b908 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -83,7 +83,6 @@ resource "azurerm_virtual_machine" "mesos_agent" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" destination = "/tmp } diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 3b99240f..0326cb95 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -83,7 +83,6 @@ resource "azurerm_virtual_machine" "mesos_master" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" destination = "/tmp } From 712d6302c30cc3c94f821bc6e2ccd888967a72a7 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 18 May 2016 17:36:01 +0100 Subject: [PATCH 30/53] Update to create bastion security group --- .../private-cloud/bastion-security-group.tf | 63 +++++++++++++++++++ .../azurerm/private-cloud/bastion-server.tf | 36 ++++------- .../azurerm/private-cloud/mesos-agents.tf | 6 +- .../azurerm/private-cloud/mesos-masters.tf | 38 +++++------ .../private-cloud/network-security-group.tf | 44 ++++--------- terraform/azurerm/private-cloud/storage.tf | 2 +- terraform/azurerm/private-cloud/variables.tf | 15 ++--- 7 files changed, 119 insertions(+), 85 deletions(-) create mode 100644 terraform/azurerm/private-cloud/bastion-security-group.tf diff --git a/terraform/azurerm/private-cloud/bastion-security-group.tf b/terraform/azurerm/private-cloud/bastion-security-group.tf new file mode 100644 index 00000000..bd851209 --- /dev/null +++ b/terraform/azurerm/private-cloud/bastion-security-group.tf @@ -0,0 +1,63 @@ +#Create Network Security Group +resource "azurerm_network_security_group" "bastion_security_group" { + name = "AzureRM_NetworkSecurityGroup" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + + security_rule { + name = "AzureRM_SecurityRuleSSH" + priority = 100 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "22" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenVPN" + priority = 101 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "1194" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenHTTPS" + priority = 102 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "443" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOpenHTTP" + priority = 103 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "80" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + tags { + Name = "bastion-apollo-sg" + } +} + +#Output +output "network_security_group_id" { + value = "${azurerm_network_security_group.bastion_security_group.id}" +} diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 64fb73fa..9b299e4b 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -3,7 +3,7 @@ resource "azurerm_network_interface" "bastion_network_interface" { name = "Bastion_NetworkInterface" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" - network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + network_security_group_id = "${azurerm_network_security_group.bastion_security_group.id}" ip_configuration { name = "bastionipconfiguration" @@ -76,34 +76,24 @@ resource "azurerm_virtual_machine" "bastion" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - source = "../../scripts/coreos" - destination = "/tmp + provisioner "file" { + source = "../../scripts/coreos" + destination = "/tmp" } provisioner "remote-exec" { - - inline = [ - - "sudo chmod -R +x /tmp/coreos", - - "/tmp/coreos/bootstrap.sh", - - "~/bin/python /tmp/coreos/get-pip.py", - - "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip", - - "sudo rm -rf /tmp/coreos", + inline = [ + "sudo chmod -R +x /tmp/coreos", + "/tmp/coreos/bootstrap.sh", + "~/bin/python /tmp/coreos/get-pip.py", + "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip", + "sudo rm -rf /tmp/coreos", # Initialize open VPN container and server config "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", - - "sudo docker run --name ovpn-data -v /etc/openvpn busybox", - - "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vpc_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.ip_address}" - - ] - + "sudo docker run --name ovpn-data -v /etc/openvpn busybox", + "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vpc_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.ip_address}" + ] } } diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index f311b908..82245f28 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -82,10 +82,10 @@ resource "azurerm_virtual_machine" "mesos_agent" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { + provisioner "file" { source = "../../scripts/coreos" - destination = "/tmp - } + destination = "/tmp" + } provisioner "remote-exec" { inline = [ diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 0326cb95..76e4149c 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -70,32 +70,32 @@ resource "azurerm_virtual_machine" "mesos_master" { Name = "apollo-mesos-master-${count.index}" role = "mesos_masters" } - - connection { - user = "${var.master_server_username}" + + connection { + user = "${var.master_server_username}" host = "${element(azurerm_network_interface.master_network_interface.*.private_ip_address, count.index)}" - private_key = "${file("${var.ssh_private_key_file}")}" # openssh format - bastion_host = "${azurerm_public_ip.bastion_publicip.ip_address}" + private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + bastion_host = "${azurerm_public_ip.bastion_publicip.ip_address}" bastion_user = "${var.bastion_server_username}" - bastion_private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + bastion_private_key = "${file("${var.ssh_private_key_file}")}" # openssh format } - + # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks - provisioner "file" { - source = "../../scripts/coreos" - destination = "/tmp - } + provisioner "file" { + source = "../../scripts/coreos" + destination = "/tmp" + } provisioner "remote-exec" { - inline = [ - "sudo chmod -R +x /tmp/coreos", - "/tmp/coreos/bootstrap.sh", - "~/bin/python /tmp/coreos/get-pip.py", - "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip", - "sudo rm -rf /tmp/coreos" - ] - } + inline = [ + "sudo chmod -R +x /tmp/coreos", + "/tmp/coreos/bootstrap.sh", + "~/bin/python /tmp/coreos/get-pip.py", + "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip", + "sudo rm -rf /tmp/coreos" + ] + } } # Mesos master network interface outputs diff --git a/terraform/azurerm/private-cloud/network-security-group.tf b/terraform/azurerm/private-cloud/network-security-group.tf index bcde1e09..d77f322b 100644 --- a/terraform/azurerm/private-cloud/network-security-group.tf +++ b/terraform/azurerm/private-cloud/network-security-group.tf @@ -1,56 +1,36 @@ #Create Network Security Group resource "azurerm_network_security_group" "network_security_group" { - name = "AzureRM_NetworkSecurityGroup" + name = "AzureRM_BastionNetworkSecurityGroup" location = "${var.region}" resource_group_name = "${azurerm_resource_group.resource_group.name}" security_rule { - name = "AzureRM_SecurityRuleSSH" + name = "AzureRM_SecurityRuleInbound" priority = 100 direction = "Inbound" access = "Allow" - protocol = "Tcp" + protocol = "*" source_port_range = "*" - destination_port_range = "22" + destination_port_range = "*" source_address_prefix = "*" destination_address_prefix = "*" } security_rule { - name = "AzureRM_SecurityRuleOpenVPN" + name = "AzureRM_SecurityRuleOutbound" priority = 101 - direction = "Inbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "1194" - source_address_prefix = "*" - destination_address_prefix = "*" - } - - security_rule { - name = "AzureRM_SecurityRuleOpenHTTPS" - priority = 102 - direction = "Inbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "443" - source_address_prefix = "*" - destination_address_prefix = "*" - } - - security_rule { - name = "AzureRM_SecurityRuleOpenHTTP" - priority = 103 - direction = "Inbound" + direction = "Outbound" access = "Allow" - protocol = "Tcp" + protocol = "*" source_port_range = "*" - destination_port_range = "80" + destination_port_range = "*" source_address_prefix = "*" destination_address_prefix = "*" } + + tags { + Name = "default-apollo-sg" + } } #Output diff --git a/terraform/azurerm/private-cloud/storage.tf b/terraform/azurerm/private-cloud/storage.tf index 3aa64e7b..04b282e6 100644 --- a/terraform/azurerm/private-cloud/storage.tf +++ b/terraform/azurerm/private-cloud/storage.tf @@ -9,10 +9,10 @@ resource "azurerm_storage_account" "storage_account" { # Create storage container resource "azurerm_storage_container" "storage_container" { name = "${var.storage_container_name}" + depends_on = ["azurerm_storage_account.storage_account"] resource_group_name = "${azurerm_resource_group.resource_group.name}" storage_account_name = "${azurerm_storage_account.storage_account.name}" container_access_type = "private" - depends_on = ["azurerm_storage_account.storage_account"] } # Storage Account Output diff --git a/terraform/azurerm/private-cloud/variables.tf b/terraform/azurerm/private-cloud/variables.tf index bcea32e9..d1dbf583 100644 --- a/terraform/azurerm/private-cloud/variables.tf +++ b/terraform/azurerm/private-cloud/variables.tf @@ -35,17 +35,18 @@ variable "public_subnet_cidr_block" { } variable "storage_account_name" { - description = "Storage account name" - default = "mesosimages" + description = "Storage account name" + default = "mesosimages" } +# I.E. Standard_GRS variable "storage_account_type" { - description = "Storage account type" + description = "Storage account type" } variable "storage_container_name" { - description = "Storage container name" - default = "mesosimages-container" + description = "Storage container name" + default = "mesosimages-container" } variable "artifact_bastion" { @@ -128,11 +129,11 @@ variable "docker_version" { } variable "ssh_public_key_file" { - description = "Public key required to connect via ssh" + description = "Public key file path required to connect via ssh" } variable "ssh_private_key_file" { - description = "Public key required to connect via ssh" + description = "Public key file path required to connect via ssh" } variable "etcd_discovery_url_file" { From cf8eb3fea5d12d1f9b5c4ad6c06a162094220f3b Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 18 May 2016 17:38:47 +0100 Subject: [PATCH 31/53] Fix formatting --- terraform/azurerm/private-cloud/mesos-agents.tf | 2 +- terraform/azurerm/private-cloud/mesos-masters.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index 82245f28..31349910 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -83,7 +83,7 @@ resource "azurerm_virtual_machine" "mesos_agent" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" + source = "../../scripts/coreos" destination = "/tmp" } diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 76e4149c..adc789ef 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -83,7 +83,7 @@ resource "azurerm_virtual_machine" "mesos_master" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" + source = "../../scripts/coreos" destination = "/tmp" } From 0ebb252e1ac3e0dfdf817cb09b2e236185e69979 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 18 May 2016 17:41:44 +0100 Subject: [PATCH 32/53] Fix formatting --- terraform/azurerm/private-cloud/bastion-server.tf | 2 +- terraform/azurerm/private-cloud/mesos-masters.tf | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 9b299e4b..d63fdcf4 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -93,7 +93,7 @@ resource "azurerm_virtual_machine" "bastion" { "sudo iptables -t nat -A POSTROUTING -j MASQUERADE", "sudo docker run --name ovpn-data -v /etc/openvpn busybox", "sudo docker run --volumes-from ovpn-data --rm gosuri/openvpn ovpn_genconfig -p ${var.vpc_cidr_block} -u udp://${azurerm_public_ip.bastion_publicip.ip_address}" - ] + ] } } diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index adc789ef..24969243 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -67,17 +67,17 @@ resource "azurerm_virtual_machine" "mesos_master" { } tags { - Name = "apollo-mesos-master-${count.index}" - role = "mesos_masters" + Name = "apollo-mesos-master-${count.index}" + role = "mesos_masters" } connection { - user = "${var.master_server_username}" + user = "${var.master_server_username}" host = "${element(azurerm_network_interface.master_network_interface.*.private_ip_address, count.index)}" - private_key = "${file("${var.ssh_private_key_file}")}" # openssh format - bastion_host = "${azurerm_public_ip.bastion_publicip.ip_address}" + private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + bastion_host = "${azurerm_public_ip.bastion_publicip.ip_address}" bastion_user = "${var.bastion_server_username}" - bastion_private_key = "${file("${var.ssh_private_key_file}")}" # openssh format + bastion_private_key = "${file("${var.ssh_private_key_file}")}" # openssh format } # Do some early bootstrapping of the CoreOS machines. This will install From 2f65fa91e289eaa28df9db441b21b31e2870ae74 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 23 May 2016 08:13:23 +0100 Subject: [PATCH 33/53] Addition of public azure infrastructure --- .../public-cloud/agent-cloud-config.yml.tpl | 48 ++++++ .../public-cloud/master-cloud-config.yml.tpl | 19 +++ .../public-cloud/mesos-agent-publicips.tf | 8 + .../mesos-agents-availability-set.tf | 11 ++ .../azurerm/public-cloud/mesos-agents.tf | 104 +++++++++++++ .../public-cloud/mesos-master-publicips.tf | 8 + .../mesos-masters-availability-set.tf | 11 ++ .../azurerm/public-cloud/mesos-masters.tf | 103 +++++++++++++ .../public-cloud/network-security-group.tf | 39 +++++ terraform/azurerm/public-cloud/provider.tf | 9 ++ .../azurerm/public-cloud/resource-group.tf | 10 ++ terraform/azurerm/public-cloud/storage.tf | 66 ++++++++ .../template_file.etcd_discovery_url.tf | 12 ++ terraform/azurerm/public-cloud/variables.tf | 141 ++++++++++++++++++ .../public-cloud/virtual-network-subnets.tf | 17 +++ .../azurerm/public-cloud/virtual-network.tf | 12 ++ 16 files changed, 618 insertions(+) create mode 100644 terraform/azurerm/public-cloud/agent-cloud-config.yml.tpl create mode 100644 terraform/azurerm/public-cloud/master-cloud-config.yml.tpl create mode 100644 terraform/azurerm/public-cloud/mesos-agent-publicips.tf create mode 100644 terraform/azurerm/public-cloud/mesos-agents-availability-set.tf create mode 100644 terraform/azurerm/public-cloud/mesos-agents.tf create mode 100644 terraform/azurerm/public-cloud/mesos-master-publicips.tf create mode 100644 terraform/azurerm/public-cloud/mesos-masters-availability-set.tf create mode 100644 terraform/azurerm/public-cloud/mesos-masters.tf create mode 100644 terraform/azurerm/public-cloud/network-security-group.tf create mode 100644 terraform/azurerm/public-cloud/provider.tf create mode 100644 terraform/azurerm/public-cloud/resource-group.tf create mode 100644 terraform/azurerm/public-cloud/storage.tf create mode 100644 terraform/azurerm/public-cloud/template_file.etcd_discovery_url.tf create mode 100644 terraform/azurerm/public-cloud/variables.tf create mode 100644 terraform/azurerm/public-cloud/virtual-network-subnets.tf create mode 100644 terraform/azurerm/public-cloud/virtual-network.tf diff --git a/terraform/azurerm/public-cloud/agent-cloud-config.yml.tpl b/terraform/azurerm/public-cloud/agent-cloud-config.yml.tpl new file mode 100644 index 00000000..d47f1372 --- /dev/null +++ b/terraform/azurerm/public-cloud/agent-cloud-config.yml.tpl @@ -0,0 +1,48 @@ +#cloud-config + +coreos: + units: + - name: format-ebs-volume.service + command: start + content: | + [Unit] + Description=Formats the ebs volume if needed + Before=docker.service + [Service] + Type=oneshot + RemainAfterExit=yes + ExecStart=/bin/bash -c '(/usr/sbin/blkid -t TYPE=ext4 | grep /dev/xvdb) || (/usr/sbin/wipefs -fa /dev/xvdb && /usr/sbin/mkfs.ext4 /dev/xvdb)' + - name: var-lib-docker.mount + command: start + content: | + [Unit] + Description=Mount ephemeral to /var/lib/docker + Requires=format-ebs-volume.service + After=format-ebs-volume.service + [Mount] + What=/dev/xvdb + Where=/var/lib/docker + Type=ext4 + - name: docker.service + drop-ins: + - name: 10-wait-docker.conf + content: | + [Unit] + After=var-lib-docker.mount + Requires=var-lib-docker.mount + etcd2: + proxy: on + listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 + discovery: ${etcd_discovery_url} + fleet: + metadata: "role=agent,region=${region}" + public-ip: "$public_ipv4" + etcd_servers: "http://localhost:2379" + locksmith: + endpoint: "http://localhost:2379" + units: + - name: etcd2.service + command: start + update: + reboot-strategy: best-effort +manage_etc_hosts: localhost \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/master-cloud-config.yml.tpl b/terraform/azurerm/public-cloud/master-cloud-config.yml.tpl new file mode 100644 index 00000000..e1041f43 --- /dev/null +++ b/terraform/azurerm/public-cloud/master-cloud-config.yml.tpl @@ -0,0 +1,19 @@ +#cloud-config + +coreos: + etcd2: + # $public_ipv4 and $private_ipv4 are populated by the cloud provider + advertise-client-urls: http://$public_ipv4:2379 + initial-advertise-peer-urls: http://$private_ipv4:2380 + listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001 + listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001 + discovery: ${etcd_discovery_url} + fleet: + metadata: "role=master,region=${region}" + public-ip: "$public_ipv4" + units: + - name: etcd2.service + command: start + update: + reboot-strategy: best-effort +manage_etc_hosts: localhost \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/mesos-agent-publicips.tf b/terraform/azurerm/public-cloud/mesos-agent-publicips.tf new file mode 100644 index 00000000..f23960f8 --- /dev/null +++ b/terraform/azurerm/public-cloud/mesos-agent-publicips.tf @@ -0,0 +1,8 @@ +#Create Public IP Address for agent servers +resource "azurerm_public_ip" "agent_publicip" { + name = "AgentPublicIp-${count.index}" + count = "${var.agent_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/mesos-agents-availability-set.tf b/terraform/azurerm/public-cloud/mesos-agents-availability-set.tf new file mode 100644 index 00000000..8e5c8c46 --- /dev/null +++ b/terraform/azurerm/public-cloud/mesos-agents-availability-set.tf @@ -0,0 +1,11 @@ +# Create an availability set for agent servers +resource "azurerm_availability_set" "agent" { + name = "Agent_AvailabilitySet" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" +} + +# Mesos agent availability set outputs +output "mesos_agent_virtual_machine_ids" { + value = "${azurerm_availability_set.agent.id}" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/mesos-agents.tf b/terraform/azurerm/public-cloud/mesos-agents.tf new file mode 100644 index 00000000..c31fb39f --- /dev/null +++ b/terraform/azurerm/public-cloud/mesos-agents.tf @@ -0,0 +1,104 @@ +# Create a network interface for agent server +resource "azurerm_network_interface" "agent_network_interface" { + name = "Agent_NetworkInterface-${count.index}" + count = "${var.agent_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "agentipconfiguration-${count.index}" + subnet_id = "${element(azurerm_subnet.public.*.id, count.index)}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${azurerm_public_ip.agent_publicip.id}" + } +} + +# User profile template +resource "template_file" "agent_cloud_init" { + template = "${file("agent-cloud-config.yml.tpl")}" + depends_on = ["template_file.etcd_discovery_url"] + vars { + etcd_discovery_url = "${file(var.etcd_discovery_url_file)}" + size = "${var.master_count}" + vpc_cidr_block = "${var.vpc_cidr_block}" + region = "${var.region}" + } +} + +# Agent server +resource "azurerm_virtual_machine" "mesos_agent" { + name = "apollo-mesos-agent-${count.index}" + count = "${var.agent_count}" + location = "${var.region}" + availability_set_id = "${azurerm_availability_set.agent.id}" + depends_on = ["azurerm_virtual_machine.mesos_master"] + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.agent_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.agent}" + + storage_image_reference { + publisher = "${var.artifact_agent.publisher}" + offer = "${var.artifact_agent.offer}" + sku = "${var.artifact_agent.sku}" + version = "${var.artifact_agent.version}" + } + + storage_os_disk { + name = "agentdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/agentdisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "Mesos-Agent-${count.index}" + admin_username = "${var.agent_server_username}" + admin_password = "${var.agent_server_password}" + custom_data = "${base64encode(template_file.agent_cloud_init.rendered)}" + } + + os_profile_linux_config { + disable_password_authentication = true + + ssh_keys { + path = "/home/${var.agent_server_username}/.ssh/authorized_keys" + key_data = "${file("${var.ssh_public_key_file}")}" # openssh format + } + } + + tags = { + Name = "apollo-mesos-agent-${count.index}" + role = "mesos_agents" + } +} + +# Mesos agent network interface outputs +output "mesos_agent_network_interface_ids" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.id)}" +} + +output "mesos_agent_network_interface_macaddresses" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.mac_address)}" +} + +output "mesos_agent_network_interface_privateipaddresses" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.private_ip_address)}" +} + +output "mesos_agent_network_interface_virtualmachineids" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.virtual_machine_id)}" +} + +output "mesos_agent_network_interface_applieddnsservers" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.applied_dns_servers)}" +} + +output "mesos_agent_network_interface_internalfqdns" { + value = "${join(",", azurerm_network_interface.agent_network_interface.*.internal_fqdn)}" +} + +# Mesos agent virtual machine outputs +output "mesos_agent_virtual_machine_ids" { + value = "${join(",", azurerm_virtual_machine.mesos_agent.*.id)}" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/mesos-master-publicips.tf b/terraform/azurerm/public-cloud/mesos-master-publicips.tf new file mode 100644 index 00000000..0cdb1286 --- /dev/null +++ b/terraform/azurerm/public-cloud/mesos-master-publicips.tf @@ -0,0 +1,8 @@ +#Create Public IP Address for master servers +resource "azurerm_public_ip" "master_publicip" { + name = "MasterPublicIp-${count.index}" + count = "${var.master_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + public_ip_address_allocation = "static" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/mesos-masters-availability-set.tf b/terraform/azurerm/public-cloud/mesos-masters-availability-set.tf new file mode 100644 index 00000000..2f4f674a --- /dev/null +++ b/terraform/azurerm/public-cloud/mesos-masters-availability-set.tf @@ -0,0 +1,11 @@ +# Create an availability set for master servers +resource "azurerm_availability_set" "master" { + name = "Master_AvailabilitySet" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" +} + +# Mesos master availability set outputs +output "mesos_master_virtual_machine_ids" { + value = "${azurerm_availability_set.master.id}" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/mesos-masters.tf b/terraform/azurerm/public-cloud/mesos-masters.tf new file mode 100644 index 00000000..c61135f5 --- /dev/null +++ b/terraform/azurerm/public-cloud/mesos-masters.tf @@ -0,0 +1,103 @@ +# Create a network interface for master server +resource "azurerm_network_interface" "master_network_interface" { + name = "Master_NetworkInterface-${count.index}" + count = "${var.master_count}" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_security_group_id = "${azurerm_network_security_group.network_security_group.id}" + + ip_configuration { + name = "masteripconfiguration-${count.index}" + subnet_id = "${element(azurerm_subnet.public.*.id, count.index)}" + private_ip_address_allocation = "dynamic" + public_ip_address_id = "${azurerm_public_ip.master_publicip.id}" + } +} + +# User profile template +resource "template_file" "master_cloud_init" { + template = "${file("master-cloud-config.yml.tpl")}" + depends_on = ["template_file.etcd_discovery_url"] + vars { + etcd_discovery_url = "${file(var.etcd_discovery_url_file)}" + size = "${var.master_count}" + vpc_cidr_block = "${var.vpc_cidr_block}" + region = "${var.region}" + } +} + +# Master server +resource "azurerm_virtual_machine" "mesos_master" { + name = "apollo-mesos-master-${count.index}" + count = "${var.master_count}" + location = "${var.region}" + availability_set_id = "${azurerm_availability_set.master.id}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + network_interface_ids = ["${element(azurerm_network_interface.master_network_interface.*.id, count.index)}"] + vm_size = "${var.instance_type.master}" + + storage_image_reference { + publisher = "${var.artifact_master.publisher}" + offer = "${var.artifact_master.offer}" + sku = "${var.artifact_master.sku}" + version = "${var.artifact_master.version}" + } + + storage_os_disk { + name = "masterdisk${count.index}" + vhd_uri = "${azurerm_storage_account.storage_account.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/masterdisk-${count.index}.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "apollo-mesos-master-${count.index}" + admin_username = "${var.master_server_username}" + admin_password = "${var.master_server_password}" + custom_data = "${base64encode(template_file.master_cloud_init.rendered)}" + } + + os_profile_linux_config { + disable_password_authentication = true + + ssh_keys { + path = "/home/${var.master_server_username}/.ssh/authorized_keys" + key_data = "${file("${var.ssh_public_key_file}")}" # openssh format + } + } + + tags { + Name = "apollo-mesos-master-${count.index}" + role = "mesos_masters" + } +} + +# Mesos master network interface outputs +output "mesos_master_network_interface_ids" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.id)}" +} + +output "mesos_master_network_interface_macaddresses" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.mac_address)}" +} + +output "mesos_master_network_interface_privateipaddresses" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.private_ip_address)}" +} + +output "mesos_master_network_interface_virtualmachineids" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.virtual_machine_id)}" +} + +output "mesos_master_network_interface_applieddnsservers" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.applied_dns_servers)}" +} + +output "mesos_master_network_interface_internalfqdns" { + value = "${join(",", azurerm_network_interface.master_network_interface.*.internal_fqdn)}" +} + +# Mesos master virtual machine outputs +output "mesos_master_virtual_machine_ids" { + value = "${join(",", azurerm_virtual_machine.mesos_master.*.id)}" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/network-security-group.tf b/terraform/azurerm/public-cloud/network-security-group.tf new file mode 100644 index 00000000..e0b56035 --- /dev/null +++ b/terraform/azurerm/public-cloud/network-security-group.tf @@ -0,0 +1,39 @@ +#Create Network Security Group +resource "azurerm_network_security_group" "network_security_group" { + name = "AzureRM_NetworkSecurityGroup" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + + security_rule { + name = "AzureRM_SecurityRuleInbound" + priority = 100 + direction = "Inbound" + access = "Allow" + protocol = "*" + source_port_range = "*" + destination_port_range = "*" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "AzureRM_SecurityRuleOutbound" + priority = 101 + direction = "Outbound" + access = "Allow" + protocol = "*" + source_port_range = "*" + destination_port_range = "*" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + tags { + Name = "default-apollo-sg" + } +} + +#Output +output "network_security_group_id" { + value = "${azurerm_network_security_group.network_security_group.id}" +} diff --git a/terraform/azurerm/public-cloud/provider.tf b/terraform/azurerm/public-cloud/provider.tf new file mode 100644 index 00000000..66fd5ba1 --- /dev/null +++ b/terraform/azurerm/public-cloud/provider.tf @@ -0,0 +1,9 @@ +/* Configure auth 2 resource manager authentication. This requires an aplication to be set up in Azure, see +https://www.terraform.io/docs/providers/azurerm/index.html fo details. */ + +provider "azurerm" { + subscription_id = "${var.subscription_id}" + client_id = "${var.client_id}" + client_secret = "${var.client_secret}" + tenant_id = "${var.tenant_id}" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/resource-group.tf b/terraform/azurerm/public-cloud/resource-group.tf new file mode 100644 index 00000000..75be4923 --- /dev/null +++ b/terraform/azurerm/public-cloud/resource-group.tf @@ -0,0 +1,10 @@ +# Create a resource group +resource "azurerm_resource_group" "resource_group" { + name = "AzureRM-Resource-Group" + location = "${var.region}" +} + +#Output +output "resource_group_id" { + value = "${azurerm_resource_group.resource_group.id}" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/storage.tf b/terraform/azurerm/public-cloud/storage.tf new file mode 100644 index 00000000..3aa64e7b --- /dev/null +++ b/terraform/azurerm/public-cloud/storage.tf @@ -0,0 +1,66 @@ +# Create a storage account +resource "azurerm_storage_account" "storage_account" { + name = "${var.storage_account_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" + account_type = "${var.storage_account_type}" +} + +# Create storage container +resource "azurerm_storage_container" "storage_container" { + name = "${var.storage_container_name}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + storage_account_name = "${azurerm_storage_account.storage_account.name}" + container_access_type = "private" + depends_on = ["azurerm_storage_account.storage_account"] +} + +# Storage Account Output +output "storage_account_id" { + value = "${azurerm_storage_account.storage_account.id}" +} + +output "storage_account_primary_location" { + value = "${azurerm_storage_account.storage_account.primary_location}" +} + +output "storage_account_secondary_location" { + value = "${azurerm_storage_account.storage_account.secondary_location}" +} + +output "storage_account_primary_blob_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_blob_endpoint}" +} + +output "storage_account_secondary_blob_endpoint" { + value = "${azurerm_storage_account.storage_account.secondary_blob_endpoint}" +} + +output "storage_account_primary_queue_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_queue_endpoint}" +} + +output "storage_account_secondary_queue_endpoint" { + value = "${azurerm_storage_account.storage_account.secondary_queue_endpoint}" +} + +output "storage_account_primary_table_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_table_endpoint}" +} + +output "storage_account_secondary_table_endpoint" { + value = "${azurerm_storage_account.storage_account.secondary_table_endpoint}" +} + +output "storage_account_primary_file_endpoint" { + value = "${azurerm_storage_account.storage_account.primary_file_endpoint}" +} + +# Storage Container Output +output "storage_container_id" { + value = "${azurerm_storage_container.storage_container.id}" +} + +output "storage_container_properties" { + value = "${azurerm_storage_container.storage_container.properties}" +} diff --git a/terraform/azurerm/public-cloud/template_file.etcd_discovery_url.tf b/terraform/azurerm/public-cloud/template_file.etcd_discovery_url.tf new file mode 100644 index 00000000..631cc0bb --- /dev/null +++ b/terraform/azurerm/public-cloud/template_file.etcd_discovery_url.tf @@ -0,0 +1,12 @@ +# Generate an etcd URL for the cluster +resource "template_file" "etcd_discovery_url" { + # template = "${file(/dev/null)}" + provisioner "local-exec" { + command = "curl https://discovery.etcd.io/new?size=${var.master_count} > ${var.etcd_discovery_url_file}" + } + + # This will regenerate the discovery URL if the cluster size changes, we include the bastion here + vars { + size = "${var.master_count}" + } +} diff --git a/terraform/azurerm/public-cloud/variables.tf b/terraform/azurerm/public-cloud/variables.tf new file mode 100644 index 00000000..c3b62af8 --- /dev/null +++ b/terraform/azurerm/public-cloud/variables.tf @@ -0,0 +1,141 @@ +variable "subscription_id" { + description = "The Azure subscrition identifier (guid)." +} + +variable "client_id" { + description = "The oAuth 2 client id. " +} + +variable "client_secret" { + description = "The oAuth 2 client secret." +} + +variable "tenant_id" { + description = "The oAuth 2 tenant id." +} + +variable "region" { + description = "The deployment azure data centre location." + default = "North Europe" +} + +variable "vpc_cidr_block" { + description = "Cidr block for the VN." + default = "10.0.0.0/16" +} + +variable "private_subnet_cidr_block" { + description = "CIDR for private subnet" + default = "10.0.1.0/24,10.0.2.0/24,10.0.3.0/24" +} + +variable "public_subnet_cidr_block" { + description = "CIDR for public subnet" + default = "10.0.101.0/24,10.0.102.0/24,10.0.103.0/24" +} + +variable "storage_account_name" { + description = "Storage account name" + default = "mesosimages" +} + +# I.E. Standard_GRS +variable "storage_account_type" { + description = "Storage account type" +} + +variable "storage_container_name" { + description = "Storage container name" + default = "mesosimages-container" +} + +variable "artifact_bastion" { + default = { + publisher = "CoreOS" + offer ="CoreOS" + "sku" = "Stable" + "version" = "latest" + } +} + +variable "artifact_master" { + default = { + publisher = "CoreOS" + offer ="CoreOS" + "sku" = "Stable" + "version" = "latest" + } +} + +variable "artifact_agent" { + default = { + publisher = "CoreOS" + offer ="CoreOS" + "sku" = "Stable" + "version" = "latest" + } +} + +variable "instance_type" { + default = { + bastion = "Standard_A0" + master = "Standard_A0" + agent = "Standard_A0" + } +} + +variable "bastion_server_computername" { + description = "Username to access server" + default = "bastion" +} + +variable "bastion_server_username" { + description = "Username to access server" +} + +variable "bastion_server_password" { + description = "Password to access server" +} + +variable "master_server_username" { + description = "Username to access master server" +} + +variable "master_server_password" { + description = "Password to access master server" +} + +variable "agent_server_username" { + description = "Username to access agent server" +} + +variable "agent_server_password" { + description = "Password to access agent server" +} + +variable "master_count" { + description = "The number of masters." + default = "1" +} + +variable "agent_count" { + description = "The number of agents." + default = "1" +} + +variable "docker_version" { + description = "Docker version" + default = "1.9.0-0~trusty" +} + +variable "ssh_public_key_file" { + description = "Public key file path required to connect via ssh" +} + +variable "ssh_private_key_file" { + description = "Public key file path required to connect via ssh" +} + +variable "etcd_discovery_url_file" { + default = "etcd_discovery_url.txt" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/virtual-network-subnets.tf b/terraform/azurerm/public-cloud/virtual-network-subnets.tf new file mode 100644 index 00000000..2dd519ee --- /dev/null +++ b/terraform/azurerm/public-cloud/virtual-network-subnets.tf @@ -0,0 +1,17 @@ +#Create public subnets +resource "azurerm_subnet" "public" { + name = "AzureRM_Public_Subnet-${count.index}" + count = "${length(compact(split(",", var.public_subnet_cidr_block)))}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" + address_prefix = "${element(split(",", var.public_subnet_cidr_block), count.index)}" +} + +# Public subnets output +output "subnet_ids" { + value = "${join(",", azurerm_subnet.public.*.id)}" +} + +output "subnet_ip_configurations" { + value = "${join(",", azurerm_subnet.public.ip_configurations)}" +} \ No newline at end of file diff --git a/terraform/azurerm/public-cloud/virtual-network.tf b/terraform/azurerm/public-cloud/virtual-network.tf new file mode 100644 index 00000000..b7c3a0ff --- /dev/null +++ b/terraform/azurerm/public-cloud/virtual-network.tf @@ -0,0 +1,12 @@ +# Create a virtual network +resource "azurerm_virtual_network" "virtual_network" { + name = "AzureRM-Virtual-Network" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + address_space = ["${var.vpc_cidr_block}"] + location = "${var.region}" +} + +#Output +output "network_confirguration_id" { + value = "${azurerm_virtual_network.virtual_network.id}" +} \ No newline at end of file From a0ca621fa76937ea806090435d75954647dd1eb4 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Mon, 23 May 2016 08:16:10 +0100 Subject: [PATCH 34/53] Fix formatting --- terraform/azurerm/public-cloud/mesos-agents.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/azurerm/public-cloud/mesos-agents.tf b/terraform/azurerm/public-cloud/mesos-agents.tf index c31fb39f..792db690 100644 --- a/terraform/azurerm/public-cloud/mesos-agents.tf +++ b/terraform/azurerm/public-cloud/mesos-agents.tf @@ -65,7 +65,7 @@ resource "azurerm_virtual_machine" "mesos_agent" { path = "/home/${var.agent_server_username}/.ssh/authorized_keys" key_data = "${file("${var.ssh_public_key_file}")}" # openssh format } - } + } tags = { Name = "apollo-mesos-agent-${count.index}" From 24423d4a63f73defadf1118b0f2e52f74499f468 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 25 May 2016 17:53:00 +0100 Subject: [PATCH 35/53] Addition of route tables and gateway --- .../azurerm/private-cloud/bastion-server.tf | 4 +- .../private-cloud/gateway-local-network.tf | 13 +++++ .../azurerm/private-cloud/mesos-agents.tf | 2 +- .../azurerm/private-cloud/mesos-masters.tf | 2 +- terraform/azurerm/private-cloud/provider.tf | 6 +-- .../azurerm/private-cloud/resource-group.tf | 2 +- terraform/azurerm/private-cloud/variables.tf | 36 ++++++------- .../private-cloud/virtual-network-subnets.tf | 54 ++++++++++++++++++- 8 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 terraform/azurerm/private-cloud/gateway-local-network.tf diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index d63fdcf4..266dbf7b 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -7,7 +7,7 @@ resource "azurerm_network_interface" "bastion_network_interface" { ip_configuration { name = "bastionipconfiguration" - subnet_id = "${element(azurerm_subnet.public.*.id, count.index)}" + subnet_id = "${element(azurerm_subnet.public.*.id, 0)}" private_ip_address_allocation = "dynamic" public_ip_address_id = "${azurerm_public_ip.bastion_publicip.id}" } @@ -77,7 +77,7 @@ resource "azurerm_virtual_machine" "bastion" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" + source = "coreos" destination = "/tmp" } diff --git a/terraform/azurerm/private-cloud/gateway-local-network.tf b/terraform/azurerm/private-cloud/gateway-local-network.tf new file mode 100644 index 00000000..39f91649 --- /dev/null +++ b/terraform/azurerm/private-cloud/gateway-local-network.tf @@ -0,0 +1,13 @@ +#Create Public IP Address for local network gateway +resource "azurerm_local_network_gateway" "gateway" { + name = "AzureRM_LocalNetworkGateway" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + location = "${var.region}" + gateway_address = "${azurerm_public_ip.bastion_publicip.ip_address}" + address_space = ["${var.vpc_cidr_block}"] +} + +#Output +output "gateway_local_network_id" { + value = "${azurerm_local_network_gateway.gateway.id}" +} diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index 31349910..63b9b888 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -83,7 +83,7 @@ resource "azurerm_virtual_machine" "mesos_agent" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" + source = "coreos" destination = "/tmp" } diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 24969243..4c1bccb7 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -83,7 +83,7 @@ resource "azurerm_virtual_machine" "mesos_master" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "../../scripts/coreos" + source = "coreos" destination = "/tmp" } diff --git a/terraform/azurerm/private-cloud/provider.tf b/terraform/azurerm/private-cloud/provider.tf index 66fd5ba1..57476fdd 100644 --- a/terraform/azurerm/private-cloud/provider.tf +++ b/terraform/azurerm/private-cloud/provider.tf @@ -3,7 +3,7 @@ https://www.terraform.io/docs/providers/azurerm/index.html fo details. */ provider "azurerm" { subscription_id = "${var.subscription_id}" - client_id = "${var.client_id}" - client_secret = "${var.client_secret}" - tenant_id = "${var.tenant_id}" + client_id = "${var.client_id}" + client_secret = "${var.client_secret}" + tenant_id = "${var.tenant_id}" } \ No newline at end of file diff --git a/terraform/azurerm/private-cloud/resource-group.tf b/terraform/azurerm/private-cloud/resource-group.tf index 75be4923..32a6ac68 100644 --- a/terraform/azurerm/private-cloud/resource-group.tf +++ b/terraform/azurerm/private-cloud/resource-group.tf @@ -1,6 +1,6 @@ # Create a resource group resource "azurerm_resource_group" "resource_group" { - name = "AzureRM-Resource-Group" + name = "AzureRM-Resource-Group" location = "${var.region}" } diff --git a/terraform/azurerm/private-cloud/variables.tf b/terraform/azurerm/private-cloud/variables.tf index d1dbf583..3df7bf60 100644 --- a/terraform/azurerm/private-cloud/variables.tf +++ b/terraform/azurerm/private-cloud/variables.tf @@ -26,35 +26,35 @@ variable "vpc_cidr_block" { variable "private_subnet_cidr_block" { description = "CIDR for private subnet" - default = "10.0.1.0/24,10.0.2.0/24,10.0.3.0/24" + default = "10.0.1.0/24,10.0.2.0/24,10.0.3.0/24" } variable "public_subnet_cidr_block" { description = "CIDR for public subnet" - default = "10.0.101.0/24,10.0.102.0/24,10.0.103.0/24" + default = "10.0.101.0/24,10.0.102.0/24,10.0.103.0/24" } variable "storage_account_name" { - description = "Storage account name" - default = "mesosimages" + description = "Storage account name" + default = "mesosimages" } # I.E. Standard_GRS variable "storage_account_type" { - description = "Storage account type" + description = "Storage account type" } variable "storage_container_name" { - description = "Storage container name" - default = "mesosimages-container" + description = "Storage container name" + default = "mesosimages-container" } variable "artifact_bastion" { default = { publisher = "CoreOS" offer ="CoreOS" - "sku" = "Stable" - "version" = "latest" + sku = "Stable" + version = "latest" } } @@ -62,8 +62,8 @@ variable "artifact_master" { default = { publisher = "CoreOS" offer ="CoreOS" - "sku" = "Stable" - "version" = "latest" + sku = "Stable" + version = "latest" } } @@ -71,16 +71,16 @@ variable "artifact_agent" { default = { publisher = "CoreOS" offer ="CoreOS" - "sku" = "Stable" - "version" = "latest" + sku = "Stable" + version = "latest" } } variable "instance_type" { default = { - bastion = "Standard_A0" - master = "Standard_A0" - agent = "Standard_A0" + bastion = "Standard_A0" + master = "Standard_A0" + agent = "Standard_A0" } } @@ -115,12 +115,12 @@ variable "agent_server_password" { variable "master_count" { description = "The number of masters." - default = "1" + default = "1" } variable "agent_count" { description = "The number of agents." - default = "1" + default = "1" } variable "docker_version" { diff --git a/terraform/azurerm/private-cloud/virtual-network-subnets.tf b/terraform/azurerm/private-cloud/virtual-network-subnets.tf index d8953110..669d6cf3 100644 --- a/terraform/azurerm/private-cloud/virtual-network-subnets.tf +++ b/terraform/azurerm/private-cloud/virtual-network-subnets.tf @@ -5,6 +5,23 @@ resource "azurerm_subnet" "public" { resource_group_name = "${azurerm_resource_group.resource_group.name}" virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" address_prefix = "${element(split(",", var.public_subnet_cidr_block), count.index)}" + route_table_id = "${azurerm_route_table.public.id}" +} + +resource "azurerm_route_table" "public" { + name = "AzureRM_Public_Route_Table" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + + route { + name = "AzureRM_Public_Route" + address_prefix = "0.0.0.0/0" + next_hop_type = "Internet" + } + + tags { + environment = "default-public" + } } #Create private subnets @@ -14,6 +31,24 @@ resource "azurerm_subnet" "private" { resource_group_name = "${azurerm_resource_group.resource_group.name}" virtual_network_name = "${azurerm_virtual_network.virtual_network.name}" address_prefix = "${element(split(",", var.private_subnet_cidr_block), count.index)}" + route_table_id = "${azurerm_route_table.private.id}" +} + +resource "azurerm_route_table" "private" { + name = "AzureRM_Private_Route_Table" + location = "${var.region}" + resource_group_name = "${azurerm_resource_group.resource_group.name}" + + route { + name = "AzureRM_Private_Route" + address_prefix = "0.0.0.0/0" + next_hop_type = "VirtualAppliance" + next_hop_in_ip_address = "${azurerm_network_interface.bastion_network_interface.private_ip_address}" + } + + tags { + environment = "default-private" + } } # Public subnets output @@ -25,6 +60,14 @@ output "subnet_ip_configurations" { value = "${join(",", azurerm_subnet.public.ip_configurations)}" } +output "public_route_table_id" { + value = "${azurerm_route_table.public.id}" +} + +output "public_route_table_subnets" { + value = "${join(",", azurerm_route_table.public.subnets)}" +} + # Private subnets output output "subnet_ids" { value = "${join(",", azurerm_subnet.private.*.id)}" @@ -32,4 +75,13 @@ output "subnet_ids" { output "subnet_ip_configurations" { value = "${join(",", azurerm_subnet.private.ip_configurations)}" -} \ No newline at end of file +} + +output "private_route_table_id" { + value = "${azurerm_route_table.private.id}" +} + +output "private_route_table_subnets" { + value = "${join(",", azurerm_route_table.private.subnets)}" +} + From 9b57654f250bce6e89f71e802dc486c0e1b06b29 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Wed, 25 May 2016 18:14:36 +0100 Subject: [PATCH 36/53] Fix formatting --- terraform/azurerm/private-cloud/bastion-server.tf | 2 +- terraform/azurerm/private-cloud/variables.tf | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 266dbf7b..69556d6d 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -119,7 +119,7 @@ output "bastion_network_interface_applieddnsservers" { } output "bastion_network_interface_internalfqdn" { - value = "${azurerm_network_interface.bastion_network_interface.internal_fqdn}" + value = "${azurerm_network_interface.bastion_network_interface.internal_fqdn}" } # Bastion virtual machine outputs diff --git a/terraform/azurerm/private-cloud/variables.tf b/terraform/azurerm/private-cloud/variables.tf index 3df7bf60..1d4a96ea 100644 --- a/terraform/azurerm/private-cloud/variables.tf +++ b/terraform/azurerm/private-cloud/variables.tf @@ -35,18 +35,18 @@ variable "public_subnet_cidr_block" { } variable "storage_account_name" { - description = "Storage account name" - default = "mesosimages" + description = "Storage account name" + default = "mesosimages" } # I.E. Standard_GRS variable "storage_account_type" { - description = "Storage account type" + description = "Storage account type" } variable "storage_container_name" { - description = "Storage container name" - default = "mesosimages-container" + description = "Storage container name" + default = "mesosimages-container" } variable "artifact_bastion" { From ba9c292372933082d684989e2c2504eba279791d Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 07:45:42 +0100 Subject: [PATCH 37/53] Create README.md --- terraform/azurerm/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 terraform/azurerm/README.md diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/terraform/azurerm/README.md @@ -0,0 +1 @@ + From 0c2dc51d04abb9365bc39621b4cf33970a4def1e Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 07:47:45 +0100 Subject: [PATCH 38/53] Delete README.md --- terraform/azurerm/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 terraform/azurerm/README.md diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md deleted file mode 100644 index 8b137891..00000000 --- a/terraform/azurerm/README.md +++ /dev/null @@ -1 +0,0 @@ - From 8587ef0e51018a2f971647097fec328d56eb6c63 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 07:53:53 +0100 Subject: [PATCH 39/53] Create README.md --- terraform/azurerm/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 terraform/azurerm/README.md diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md new file mode 100644 index 00000000..b57c6c1c --- /dev/null +++ b/terraform/azurerm/README.md @@ -0,0 +1,2 @@ +Azure Resource Manager terraform configuration +============================================== From 9eba56a91cb95638a3a378758ef4f681d470f519 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 07:59:39 +0100 Subject: [PATCH 40/53] Update README.md --- terraform/azurerm/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index b57c6c1c..d066a4b7 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -1,2 +1,2 @@ -Azure Resource Manager terraform configuration -============================================== +#### Azure Resource Manager terraform configuration + From 8161be62df24476f5af1220924e7de4c099d6a79 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 08:00:11 +0100 Subject: [PATCH 41/53] Update README.md --- terraform/azurerm/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index d066a4b7..0bbda83f 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -1,2 +1,3 @@ #### Azure Resource Manager terraform configuration +--------------------------------------------------- From b5734426df0317a8434e3e9cbc8e4f5884697892 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 08:16:44 +0100 Subject: [PATCH 42/53] Update README.md --- terraform/azurerm/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index 0bbda83f..f6f83418 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -1,3 +1,7 @@ -#### Azure Resource Manager terraform configuration +### Azure Resource Manager terraform configuration --------------------------------------------------- +This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by reverse engineering existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. + +The configuration is based on Terraform's Azure Resource Manager provider, https://www.terraform.io/docs/providers/azurerm/index.html. +To allow terrafom to create the infrastructure within Azure the following information is require by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication in your Azure subscription follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. From e7713af5e399175a83d173f3bcf2b745a31e3a3b Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 08:17:41 +0100 Subject: [PATCH 43/53] Update README.md --- terraform/azurerm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index f6f83418..42309f8a 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -4,4 +4,4 @@ This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by reverse engineering existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. The configuration is based on Terraform's Azure Resource Manager provider, https://www.terraform.io/docs/providers/azurerm/index.html. -To allow terrafom to create the infrastructure within Azure the following information is require by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication in your Azure subscription follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. +To allow terrafom to create the infrastructure within your Azure subscription the following information is require by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. From b0e357ff42b67fcd315e24811a0621a19ef717cc Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 08:24:05 +0100 Subject: [PATCH 44/53] Update README.md --- terraform/azurerm/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index 42309f8a..a3935a29 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -3,5 +3,5 @@ This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by reverse engineering existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. -The configuration is based on Terraform's Azure Resource Manager provider, https://www.terraform.io/docs/providers/azurerm/index.html. -To allow terrafom to create the infrastructure within your Azure subscription the following information is require by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. +The configuration is based on Terraform's ARM provider, https://www.terraform.io/docs/providers/azurerm/index.html. +To allow terrafom to create the infrastructure within your Azure subscription the following information is required by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. From 76e8517fec89f24189601203e2f976bd47b7d3e8 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 08:27:37 +0100 Subject: [PATCH 45/53] update path to script files --- terraform/azurerm/private-cloud/bastion-server.tf | 2 +- terraform/azurerm/private-cloud/mesos-agents.tf | 2 +- terraform/azurerm/private-cloud/mesos-masters.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/azurerm/private-cloud/bastion-server.tf b/terraform/azurerm/private-cloud/bastion-server.tf index 69556d6d..83d7fc42 100644 --- a/terraform/azurerm/private-cloud/bastion-server.tf +++ b/terraform/azurerm/private-cloud/bastion-server.tf @@ -77,7 +77,7 @@ resource "azurerm_virtual_machine" "bastion" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "coreos" + source = "../../scripts/coreos" destination = "/tmp" } diff --git a/terraform/azurerm/private-cloud/mesos-agents.tf b/terraform/azurerm/private-cloud/mesos-agents.tf index 63b9b888..31349910 100644 --- a/terraform/azurerm/private-cloud/mesos-agents.tf +++ b/terraform/azurerm/private-cloud/mesos-agents.tf @@ -83,7 +83,7 @@ resource "azurerm_virtual_machine" "mesos_agent" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "coreos" + source = "../../scripts/coreos" destination = "/tmp" } diff --git a/terraform/azurerm/private-cloud/mesos-masters.tf b/terraform/azurerm/private-cloud/mesos-masters.tf index 4c1bccb7..24969243 100644 --- a/terraform/azurerm/private-cloud/mesos-masters.tf +++ b/terraform/azurerm/private-cloud/mesos-masters.tf @@ -83,7 +83,7 @@ resource "azurerm_virtual_machine" "mesos_master" { # Do some early bootstrapping of the CoreOS machines. This will install # python and pip so we can use as the ansible_python_interpreter in our playbooks provisioner "file" { - source = "coreos" + source = "../../scripts/coreos" destination = "/tmp" } From 726d1045022bd9de35ec6f9e553f83360bc02f05 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 08:47:56 +0100 Subject: [PATCH 46/53] Update README.md --- terraform/azurerm/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index a3935a29..b5c508ce 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -1,7 +1,9 @@ ### Azure Resource Manager terraform configuration --------------------------------------------------- -This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by reverse engineering existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. +This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by attempting to reverse engineering existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. The configuration is based on Terraform's ARM provider, https://www.terraform.io/docs/providers/azurerm/index.html. To allow terrafom to create the infrastructure within your Azure subscription the following information is required by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. + +Connection to the server instances is via ssh authenticated by a public / private key certificate in openssh format. I used Putty to generate the public / private key files. There was an issue certificate only authentication **so please use Terraform verion v0.6.16 or higher**. From 2ee172af064c69939c98e480a629fd3b3c67ee2c Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 08:57:26 +0100 Subject: [PATCH 47/53] Update README.md --- terraform/azurerm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index b5c508ce..7e1faf30 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -1,7 +1,7 @@ ### Azure Resource Manager terraform configuration --------------------------------------------------- -This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by attempting to reverse engineering existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. +This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by attempting to reverse engineering and match the existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. The configuration is based on Terraform's ARM provider, https://www.terraform.io/docs/providers/azurerm/index.html. To allow terrafom to create the infrastructure within your Azure subscription the following information is required by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. From e08dd7a48e4630d48483691f5308b6769460b069 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Thu, 26 May 2016 09:04:45 +0100 Subject: [PATCH 48/53] Create README.md --- terraform/azurerm/private-cloud/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 terraform/azurerm/private-cloud/README.md diff --git a/terraform/azurerm/private-cloud/README.md b/terraform/azurerm/private-cloud/README.md new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/terraform/azurerm/private-cloud/README.md @@ -0,0 +1 @@ + From 7baefffe5b3a611ec2d546cc25d52c75914a91ab Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 31 May 2016 08:22:13 +0100 Subject: [PATCH 49/53] Add images folder --- terraform/azurerm/images/ARMArchitecture.png | Bin 0 -> 28738 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 terraform/azurerm/images/ARMArchitecture.png diff --git a/terraform/azurerm/images/ARMArchitecture.png b/terraform/azurerm/images/ARMArchitecture.png new file mode 100644 index 0000000000000000000000000000000000000000..078833de518ad7cc7ccfc796b4e2e80b1ce3681e GIT binary patch literal 28738 zcmbrlcRbu(&^E5u=%RN*L=Yu9tM^``6QYaWSrJ|I8g=#F5=19D(QEWxR}ZT!%e!*l z_wRY$&->@^40t*2F0Y^bzS`z^Q=@9_|aSj6se#L3Z zg#`W&(M?lM5}|sG>Hz))#aco|0s-M$9QM6AD*QX9v%J0=0s?N&(;wo1Q>i8Vz26Gb z658G-$L#^cG&%vNnShfPYvZ}{Lt^&TONK8N8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G<*edmS`tk0HxWn|L=E$K;9wV zgGaWm9s%72UwOgs5g;-cnZH#qvZgEj9ILVO?jjhD9zbZs-_!z`jre}2+fmAg-~Ves z${^{+4;TFb_LncX>;B!sSRBAEl+MFelPA*t^Cpx6iIT41oO#a9{eMv?rZndwca3qK z=J$jv`;&js(C%0}(S2Qgy$sx4rUXD&00-ltWIk#l-M~M%s9o~HwL`xbn#VuL5>LAovB7(!2M?yl$lI->Yu;J ziMlH&ALtHzKmI9~kOirw!Z@@`=H?hGJo-$_7FAZBe0Gb6u}Yuq2Yxs*h2ls|XEGSH+C#BsH(+6V4`n@K8*2NkjId z)1zY|?jd`>zjPGK|HuMaoS>8$tad*NAC=Nd-Y$P8Xz_g{WE0$KIDaqt=^CJc!Y|Ea zq=7epCUAvR+6@7SfRc(4Dp6`tJWoUcsGGO)N9!lR8z_O2W4&|ZK7_^)ltG3N<){nA zce>t^fnd_y2EgZac*F#_UbwhH26wp@;`S@-7>!kQhk*G z9fopvT!QFFX+U|rAR)BZk=MpXPe}e?gvPoS1?1Epq*ig@m%k2h({TKnLA0>$ zOYxL?E#UMa|HpY~6}Xc{(eplip9csfm?{>ZwQ2#eR5zilWU-X8F7ywjOopM>Yq|sM ze?SrrWp=3bw;2Yr0@pxzPy8Th&9(-#*&_?7SK!@w*VKi)a`bNZdB3MR!4lSBP&c)} zLP-XjN-6X0Y~Wty|9xX^45alro7f5^6ftoC>{0P~(`vEZpI8a|dNHqQ9Ubxz#9Ul$}%W4ccm-GmaS2&df1yc>|n$S_3x zDy3rKg&@%wN`d#Ly8sLF;DO)k9ske2+7kqJ_o>l>{CBEP&zXR{e^jUSP4!-5Y{UK! D9cqV$ literal 0 HcmV?d00001 From 7cea6d724a4d5049bced4ece10acfdc6fd057f21 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 31 May 2016 08:26:28 +0100 Subject: [PATCH 50/53] Update README.md --- terraform/azurerm/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index 7e1faf30..3c0283eb 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -7,3 +7,7 @@ The configuration is based on Terraform's ARM provider, https://www.terraform.io To allow terrafom to create the infrastructure within your Azure subscription the following information is required by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. Connection to the server instances is via ssh authenticated by a public / private key certificate in openssh format. I used Putty to generate the public / private key files. There was an issue certificate only authentication **so please use Terraform verion v0.6.16 or higher**. + +The infrastructure is configured in line with the ARM architecture as shown in the diagram below. + +![architecture](images/ARMArchitecture.png) From 4be27383006827acbd0491646826c9f5b7c318cf Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 31 May 2016 08:31:56 +0100 Subject: [PATCH 51/53] Update README.md --- terraform/azurerm/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/azurerm/README.md b/terraform/azurerm/README.md index 3c0283eb..ee4c9feb 100644 --- a/terraform/azurerm/README.md +++ b/terraform/azurerm/README.md @@ -3,11 +3,11 @@ This folder contains the terraform configuration for a public and private infrastructure provisioned in Azure and is created by attempting to reverse engineering and match the existing AWS architecture, https://github.com/Capgemini/Apollo/tree/master/terraform/aws. -The configuration is based on Terraform's ARM provider, https://www.terraform.io/docs/providers/azurerm/index.html. -To allow terrafom to create the infrastructure within your Azure subscription the following information is required by the 'provider.tf' file, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. +The configuration is based on Terraform's ARM provider found here, https://www.terraform.io/docs/providers/azurerm/index.html. +Before Terrafom can create infrastructure within your Azure subscription the following information is required by the 'provider.tf' file including, subscription id, client id, client secret, tenant id. To set up oAuth authentication follow this guide https://www.terraform.io/docs/providers/azurerm/index.html. -Connection to the server instances is via ssh authenticated by a public / private key certificate in openssh format. I used Putty to generate the public / private key files. There was an issue certificate only authentication **so please use Terraform verion v0.6.16 or higher**. +Connection to the server instances is via ssh authenticated by a public / private key certificate in openssh format. Putty was used to generate the public / private key files. There was an issue with certificate only authentication **so please use Terraform verion v0.6.16 or higher**. -The infrastructure is configured in line with the ARM architecture as shown in the diagram below. +The infrastructure is configured inline with the ARM architecture as shown in the diagram below. Terraform does not yet support creating Load Balance resources thus it was not possible to replicate this feature from AWS. ![architecture](images/ARMArchitecture.png) From 81c8910798334cd1ed006cd798a96acd57e02fc3 Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 31 May 2016 08:33:28 +0100 Subject: [PATCH 52/53] Update README.md --- terraform/azurerm/private-cloud/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/azurerm/private-cloud/README.md b/terraform/azurerm/private-cloud/README.md index 8b137891..c7898586 100644 --- a/terraform/azurerm/private-cloud/README.md +++ b/terraform/azurerm/private-cloud/README.md @@ -1 +1,2 @@ - +#### Azure Resource Manager - Private cloud +--------------------------------------------------- From f484bd4424a7dddce0221b3a421141cbffc21dfb Mon Sep 17 00:00:00 2001 From: heywoodj Date: Tue, 31 May 2016 08:34:14 +0100 Subject: [PATCH 53/53] Delete README.md --- terraform/azurerm/private-cloud/README.md | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 terraform/azurerm/private-cloud/README.md diff --git a/terraform/azurerm/private-cloud/README.md b/terraform/azurerm/private-cloud/README.md deleted file mode 100644 index c7898586..00000000 --- a/terraform/azurerm/private-cloud/README.md +++ /dev/null @@ -1,2 +0,0 @@ -#### Azure Resource Manager - Private cloud ----------------------------------------------------