Skip to content

Instantly share code, notes, and snippets.

@elliotforbes
Created July 3, 2018 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save elliotforbes/b8a00b376ef22bdac1407ae76299a2aa to your computer and use it in GitHub Desktop.
Save elliotforbes/b8a00b376ef22bdac1407ae76299a2aa to your computer and use it in GitHub Desktop.
provider "aws" {
region = "eu-west-1"
}
data "aws_availability_zones" "available" {}
resource "aws_security_group" "instance" {
name = "go-api-instance"
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_launch_configuration" "example" {
image_id = "ami-58d7e821"
instance_type = "t2.micro"
key_name = "testInstanceKeyPair"
security_groups = ["${aws_security_group.instanced.id}"]
user_data = "${file("setup.sh")}"
lifecycle {
create_before_destroy = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment