Skip to content

Instantly share code, notes, and snippets.

@phinze
Created April 2, 2015 23:35
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 phinze/f4ddceabfebcd3a85590 to your computer and use it in GitHub Desktop.
Save phinze/f4ddceabfebcd3a85590 to your computer and use it in GitHub Desktop.
resource "aws_vpc" "web" {
cidr_block = "10.0.0.0/16"
}
resource "aws_subnet" "web-2a" {
vpc_id = "${aws_vpc.web.id}"
cidr_block = "10.0.1.0/24"
availability_zone = "us-west-2a"
}
resource "aws_subnet" "web-2b" {
vpc_id = "${aws_vpc.web.id}"
cidr_block = "10.0.2.0/24"
availability_zone = "us-west-2b"
}
resource "aws_subnet" "web-2c" {
vpc_id = "${aws_vpc.web.id}"
cidr_block = "10.0.3.0/24"
availability_zone = "us-west-2c"
}
resource "aws_launch_configuration" "web" {
/* old ami */
/* image_id = "ami-21f78e11" */
/* new ami */
image_id = "ami-03d2fd33"
instance_type = "t1.micro"
user_data = "foobar-user-data-change"
lifecycle {
create_before_destroy = true
}
}
resource "aws_autoscaling_group" "web" {
name = "web"
min_size = 3
max_size = 3
availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
launch_configuration = "${aws_launch_configuration.web.id}"
vpc_zone_identifier = [
"${aws_subnet.web-2a.id}",
"${aws_subnet.web-2b.id}",
"${aws_subnet.web-2c.id}",
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment