Created
July 3, 2018 14:02
-
-
Save elliotforbes/61c245bd7a6d94d1b4f8308c90e9068a to your computer and use it in GitHub Desktop.
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" { | |
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