Created
August 26, 2014 23:09
-
-
Save thedebugger/989abd81a2375835cc64 to your computer and use it in GitHub Desktop.
All terraform files combined in a single file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_security_group" "allow_all" { | |
name = "allow_all" | |
description = "Allow all inbound traffic" | |
ingress { | |
from_port = 0 | |
to_port = 65535 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
} | |
resource "aws_vpc" "main" { | |
cidr_block = "" | |
} | |
resource "aws_subnet" "main" { | |
vpc_id = "" | |
cidr_block = "" | |
} | |
variable "base_ami" { | |
description = "the AMI to use" | |
default = "" | |
} | |
variable "consul_count" { | |
default = 1 | |
} | |
variable "consul_instance_type" { | |
default = "m1.small" | |
} | |
# specify the runlist | |
variable "consul_provisoner" { | |
default = "chef-client -r 'base, consul-server'" | |
} | |
# TODO: find more info about source_dest_check | |
resource "aws_instance" "consul_server" { | |
ami = "${var.base_ami}" | |
count = 1 | |
source_dest_check = true | |
instance_type = "${var.consul_instance_type}" | |
provisioner "local-exec" { | |
command = "${var.consul_provisoner}" | |
} | |
} | |
provider "aws" { | |
access_key = "" | |
secret_key = "" | |
region = "us-west-2" | |
} | |
variable "service1_instance_type" { | |
default = "m1.small" | |
} | |
# specify the runlist | |
variable "local_provisoner" { | |
default = "chef-client -r 'base, service1'" | |
} | |
resource "aws_instance" "service0" { | |
ami = "${var.base_ami}" | |
count = 1 | |
source_dest_check = true | |
instance_type "${var.service1_instance_type}" | |
provisioner "local-exec" { | |
command = "${var.local_provisoner}" | |
} | |
user_data = "service1" | |
} | |
variable "service2_instance_type" { | |
default = "m1.small" | |
} | |
# specify the runlist | |
variable "local_provisoner" { | |
default = "chef-client -r 'base, service2'" | |
} | |
resource "aws_instance" "service2" { | |
ami = "${var.base_ami}" | |
count = 1 | |
source_dest_check = true | |
instance_type = "${var.service2_instance_type}" | |
provisioner "local-exec" { | |
command = "${var.local_provisoner}" | |
} | |
user_data = "service2" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment