From 91710fca3250b4d2ef6cdaf12c31fe04d502d362 Mon Sep 17 00:00:00 2001 From: Doug Jacobs Date: Wed, 19 Jul 2017 12:30:06 -0700 Subject: [PATCH] Commenting out code for creating 2nd interface on VMs. Not needed. Changing machine to t2.micro to save money. --- aws.tf | 119 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/aws.tf b/aws.tf index d15c56d..306b5d5 100644 --- a/aws.tf +++ b/aws.tf @@ -92,7 +92,7 @@ variable "aws_ami" { } variable "aws_instance_type" { - default = "t2.large" + default = "t2.micro" } # how many VMs to spin up. @@ -102,67 +102,68 @@ variable "num_nodes" { default = "3" } -# ============================================ -# networks + +### commenting out - 2nd interface not needed for vxlan testing on aws - doug. +## ============================================ +## networks +## +## vars +## for convenience, we are using a pre-defined security group, its +## associated vpc and subnet. +## +## for the second interface, define a new subnet inside the vpc. # -# vars -# for convenience, we are using a pre-defined security group, its -# associated vpc and subnet. +## eth1 - vxlan network +#resource "aws_network_interface" "netplugin_vxlan_interface" { +# subnet_id = "${aws_subnet.netplugin_vxlan_subnet.id}" +# security_groups = ["${var.our_security_group_id}"] +# count = "${var.num_nodes}" # -# for the second interface, define a new subnet inside the vpc. - - -# eth1 - vxlan network -resource "aws_network_interface" "netplugin_vxlan_interface" { - subnet_id = "${aws_subnet.netplugin_vxlan_subnet.id}" - security_groups = ["${var.our_security_group_id}"] - count = "${var.num_nodes}" - - # tell which instance(s) this interface belongs to - attachment { - instance = "${element(aws_instance.jenkins_netplugin.*.id, count.index)}" - device_index = 1 - } -} - -resource "aws_subnet" "netplugin_vxlan_subnet" { - vpc_id = "${var.our_vpc_id}" - # creates a different subnet using buildnum to generate a number - # between 100 and 200 - cidr_block = "172.31.${var.buildnum%100 + 100}.0/24" - availability_zone = "${var.aws_availability_zone}" -} - - -# ============================================ -# post-launch commands +# # tell which instance(s) this interface belongs to +# attachment { +# instance = "${element(aws_instance.jenkins_netplugin.*.id, count.index)}" +# device_index = 1 +# } +#} # -# these will be run on each instance after it is launched - -variable "ssh_user" { - default = "centos" -} - -# setup eth1 with IP# for all instances -resource "null_resource" "configure-interfaces" { - count = "${var.num_nodes}" - triggers { - jenkins_netplugin_instance_ids = "${join(",", aws_instance.jenkins_netplugin.*.id)}" - } - - provisioner "remote-exec" { - inline = ["sudo /sbin/ip addr add '172.31.${var.buildnum%100}.1${count.index}/24' dev eth1 && sudo /sbin/ip link set dev eth1 up"] - } - - connection { - type = "ssh" - user = "${var.ssh_user}" - private_key = "${file(var.key_path)}" - agent = false - host = "${element(aws_instance.jenkins_netplugin.*.public_ip, count.index)}" - } - -} +#resource "aws_subnet" "netplugin_vxlan_subnet" { +# vpc_id = "${var.our_vpc_id}" +# # creates a different subnet using buildnum to generate a number +# # between 100 and 200 +# cidr_block = "172.31.${var.buildnum%100 + 100}.0/24" +# availability_zone = "${var.aws_availability_zone}" +#} +# +# +## ============================================ +## post-launch commands +## +## these will be run on each instance after it is launched +# +#variable "ssh_user" { +# default = "centos" +#} +# +## setup eth1 with IP# for all instances +#resource "null_resource" "configure-interfaces" { +# count = "${var.num_nodes}" +# triggers { +# jenkins_netplugin_instance_ids = "${join(",", aws_instance.jenkins_netplugin.*.id)}" +# } +# +# provisioner "remote-exec" { +# inline = ["sudo /sbin/ip addr add '172.31.${var.buildnum%100}.1${count.index}/24' dev eth1 && sudo /sbin/ip link set dev eth1 up"] +# } +# +# connection { +# type = "ssh" +# user = "${var.ssh_user}" +# private_key = "${file(var.key_path)}" +# agent = false +# host = "${element(aws_instance.jenkins_netplugin.*.public_ip, count.index)}" +# } +# +#} # WIP - have not tried the ansible command yet. # need to strip out the hardcoded IP#'s and use something like: