This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
access_key = "${var.aws_access_key}" | |
secret_key = "${var.aws_secret_key}" | |
region = "${var.region}" | |
} | |
resource "aws_security_group" "allow_all" { | |
name = "allow_all" | |
description = "Allow all inbound traffic" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_instance" "consul" { | |
ami = "${var.ami}" | |
security_groups = ["${var.security_group}"] | |
key_name = "${var.key_name}" | |
instance_type = "${var.instance_type}" | |
availability_zone = "${var.availability_zone}" | |
count = "${var.count}" | |
tags { | |
Name = "consul_${count.index+1}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws_security_group.allow_all: Creating... | |
description: "" => "Allow all inbound traffic" | |
egress.#: "" => "<computed>" | |
ingress.#: "" => "1" | |
ingress.532441254.cidr_blocks.#: "" => "1" | |
ingress.532441254.cidr_blocks.0: "" => "0.0.0.0/0" | |
ingress.532441254.from_port: "" => "0" | |
ingress.532441254.protocol: "" => "-1" | |
ingress.532441254.security_groups.#: "" => "0" | |
ingress.532441254.self: "" => "0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refreshing Terraform state prior to plan... | |
aws_key_pair.consul: Refreshing state... (ID: consul-key) | |
aws_security_group.allow_all: Refreshing state... (ID: sg-54bdc030) | |
module.consul.aws_instance.consul.0: Refreshing state... (ID: i-8a47e177) | |
module.consul.aws_instance.consul.1: Refreshing state... (ID: i-bd46e040) | |
module.consul.aws_instance.consul.2: Refreshing state... (ID: i-3f46e0c2) | |
The Terraform execution plan has been generated and is shown below. | |
Resources are shown in alphabetical order for quick scanning. Green resources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do you really want to destroy? | |
Terraform will delete all your managed infrastructure. | |
There is no undo. Only 'yes' will be accepted to confirm. | |
Enter a value: yes | |
aws_security_group.allow_all: Refreshing state... (ID: sg-54bdc030) | |
aws_key_pair.consul: Refreshing state... (ID: consul-key) | |
module.consul.aws_instance.consul.0: Refreshing state... (ID: i-8a47e177) | |
module.consul.aws_instance.consul.1: Refreshing state... (ID: i-bd46e040) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws_security_group.allow_all: Creating... | |
description: "" => "Allow all inbound traffic" | |
egress.#: "" => "<computed>" | |
ingress.#: "" => "1" | |
ingress.532441254.cidr_blocks.#: "" => "1" | |
ingress.532441254.cidr_blocks.0: "" => "0.0.0.0/0" | |
ingress.532441254.from_port: "" => "0" | |
ingress.532441254.protocol: "" => "-1" | |
ingress.532441254.security_groups.#: "" => "0" | |
ingress.532441254.self: "" => "0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "atlas" { | |
token = "${var.atlas_token}" | |
} | |
provider "aws" { | |
access_key = "${var.aws_access_key}" | |
secret_key = "${var.aws_secret_key}" | |
region = "${var.region}" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_instance" "metamon" { | |
ami = "${var.ami}" | |
security_groups = ["${var.security_group}"] | |
key_name = "${var.key_name}" | |
instance_type = "${var.instance_type}" | |
availability_zone = "${var.availability_zone}" | |
count = "${var.count}" | |
tags { | |
Name = "metamon_${count.index+1}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_instance" "consul" { | |
ami = "${var.ami}" | |
security_groups = ["${var.security_group}"] | |
key_name = "${var.key_name}" | |
instance_type = "${var.instance_type}" | |
availability_zone = "${var.availability_zone}" | |
count = "${var.count}" | |
tags { | |
Name = "consul_${count.index+1}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -s "ssh_keys/$1-key.pem" ] && [ -s "ssh_keys/$1-key.pub" ]; then | |
echo Using existing $1-key pair... | |
else | |
echo No $1-key pair exists, generating new keys... | |
rm -rf ssh_keys/$1-key.pem | |
rm -rf ssh_keys/$1-key.pub | |
openssl genrsa -out ssh_keys/$1-key.pem 1024 | |
chmod 400 ssh_keys/$1-key.pem | |
ssh-keygen -y -f ssh_keys/$1-key.pem > ssh_keys/$1-key.pub | |
echo ssh_keys/$1-key.pem contents... |