Skip to content

Instantly share code, notes, and snippets.

@Vidimensional
Created February 24, 2016 16:08
Show Gist options
  • Save Vidimensional/d1a3c8dbfb1de45b7e72 to your computer and use it in GitHub Desktop.
Save Vidimensional/d1a3c8dbfb1de45b7e72 to your computer and use it in GitHub Desktop.
AutoScaling with Terraform (mah o menoh)
variable "access_key" {}
variable "secret_key" {}
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "eu-west-1"
}
resource "aws_launch_configuration" "as_conf2" {
name = "web_config2"
image_id = "ami-91ca6ae2"
instance_type = "m1.small"
user_data = "${file("userdata.sh")}"
}
resource "aws_autoscaling_group" "bar" {
availability_zones = ["eu-west-1a"]
name = "foobar3-terraform-test"
max_size = 5
desired_capacity = 2
min_size = 2
health_check_grace_period = 300
health_check_type = "ELB"
force_delete = true
launch_configuration = "${aws_launch_configuration.as_conf2.name}"
tag {
key = "foo"
value = "bar"
propagate_at_launch = true
}
tag {
key = "lorem"
value = "ipsum"
propagate_at_launch = false
}
}
echo "$( date ) me he ejecutao!" > /opt/important_info
@Vidimensional
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment