refactor Terraform module, Packer config; bump tool version #s in Vagrantfile

This commit is contained in:
Rob Genova 2017-06-24 16:24:24 -07:00
parent 0de149d900
commit 1e6cb9042f
5 changed files with 30 additions and 22 deletions

View File

@ -52,9 +52,9 @@ Vagrant.configure(2) do |config|
config.vm.synced_folder "../shared/", "/home/vagrant/shared", owner: "vagrant", group: "vagrant"
config.vm.synced_folder "../examples/", "/home/vagrant/examples", owner: "vagrant", group: "vagrant"
# config.vm.provider "virtualbox" do |vb|
# vb.memory = "2048"
# vb.cpus = 2
#end
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = 2
end
end

View File

@ -12,8 +12,6 @@ variable "instance_type" {
variable "key_name" { }
variable "key_file" { }
variable "server_count" {
description = "The number of servers to provision."
default = "3"
@ -41,7 +39,6 @@ module "hashistack" {
ami = "${var.ami}"
instance_type = "${var.instance_type}"
key_name = "${var.key_name}"
key_file = "${var.key_file}"
server_count = "${var.server_count}"
client_count = "${var.client_count}"
cluster_tag_value = "${var.cluster_tag_value}"

View File

@ -1,8 +1,7 @@
region = "us-east-1"
ami = "ami-28a1dd3e"
instance_type = "t2.micro"
ami = "ami-feac99e8"
instance_type = "t2.medium"
key_name = "hashi-us-east-1"
key_file = "/home/vagrant/.ssh/hashi-us-east-1.pem"
server_count = "1"
client_count = "1"
client_count = "4"
cluster_tag_value = "auto-join"

View File

@ -2,7 +2,6 @@ variable "region" { }
variable "ami" { }
variable "instance_type" { }
variable "key_name" { }
variable "key_file" { }
variable "server_count" { }
variable "client_count" { }
variable "cluster_tag_value" { }
@ -22,6 +21,27 @@ resource "aws_security_group" "primary" {
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 50070
to_port = 50070
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 50075
to_port = 50075
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 18080
to_port = 18080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 0
to_port = 0
@ -62,10 +82,6 @@ resource "aws_instance" "primary" {
key_name = "${var.key_name}"
vpc_security_group_ids = ["${aws_security_group.primary.id}"]
count = "${var.server_count}"
connection {
user = "ubuntu"
private_key = "${file("${var.key_file}")}"
}
#Instance tags
tags {
@ -85,10 +101,6 @@ resource "aws_instance" "client" {
vpc_security_group_ids = ["${aws_security_group.primary.id}"]
count = "${var.client_count}"
depends_on = ["aws_instance.primary"]
connection {
user = "ubuntu"
private_key = "${file("${var.key_file}")}"
}
#Instance tags
tags {
@ -103,7 +115,7 @@ resource "aws_instance" "client" {
resource "aws_iam_instance_profile" "instance_profile" {
name_prefix = "hashistack"
roles = ["${aws_iam_role.instance_role.name}"]
role = "${aws_iam_role.instance_role.name}"
}
resource "aws_iam_role" "instance_role" {

View File

@ -2,7 +2,7 @@
"builders": [{
"type": "amazon-ebs",
"region": "us-east-1",
"source_ami": "ami-8e0b9499",
"source_ami": "ami-80861296",
"instance_type": "t2.medium",
"ssh_username": "ubuntu",
"ami_name": "nomad-packer {{timestamp}}",