Skip to content

Instantly share code, notes, and snippets.

@elliotforbes
Created July 3, 2018 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotforbes/61c245bd7a6d94d1b4f8308c90e9068a to your computer and use it in GitHub Desktop.
Save elliotforbes/61c245bd7a6d94d1b4f8308c90e9068a 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"]
}
}
resource "aws_launch_configuration" "example" {
image_id = "ami-58d7e821"
instance_type = "t2.micro"
security_groups = ["${aws_security_group.instance.id}"]
user_data = <<-EOF
#!/bin/bash
echo "Hello, World" > index.html
nohup busybox httpd -f -p 80 &
EOF
lifecycle {
create_before_destroy = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment