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
variable "name" { | |
description = "The name for the resource" | |
default = "example" | |
} | |
variable "environment" { | |
description = "The env of the app" | |
default = "staging" | |
} |
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_elb" "elb" { | |
name = "${var.name}" | |
security_groups = [ "${aws_security_group.sg.id}" ] | |
cross_zone_load_balancing = true | |
instances = ["${aws_instance.example.id}"] | |
listener { | |
instance_port = "80" | |
instance_protocol = "tcp" | |
lb_port = "80" |
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" "sg" { | |
name = "${var.name}-sg" | |
description = "Allow all inbound traffic" | |
vpc_id = "${var.vpc_id}" | |
ingress { | |
from_port = 22 | |
to_port = 22 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} |
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
provider "aws" { | |
access_key = "ACCESS_KEY_HERE" | |
secret_key = "SECRET_KEY_HERE" | |
region = "us-east-1" | |
} | |
resource "aws_instance" "example" { | |
ami = "ami-c80b0aa2" | |
instance_type = "t2.micro" | |
} |
NewerOlder