Skip to content

Instantly share code, notes, and snippets.

@elliotforbes
Created July 3, 2018 09:50
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/435220017766e0fbf305a492220e2be5 to your computer and use it in GitHub Desktop.
Save elliotforbes/435220017766e0fbf305a492220e2be5 to your computer and use it in GitHub Desktop.
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 9000 &
EOF
lifecycle {
create_before_destroy = true
}
}
resource "aws_autoscaling_group" "example" {
launch_configuration = "${aws_launch_configuration.example.id}"
load_balancers = ["${aws_elb.example.name}"]
availability_zones = ["eu-west-1b"]
min_size = 2
max_size = 5
tag {
key = "Name"
value = "terraform-go-api"
propagate_at_launch = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment