Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion terraform/platforms/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ module "eco" {
source = "github.com/Quentin-M/etcd-cloud-operator//terraform/platforms/aws"

name = "eco-example"
size = "3"
max_size = "7"
min_size = "3"
desired_capacity = "3"
min_elb_capacity = "3"

instance_type = "t2.small"
instance_disk_size = "30"
Expand Down
14 changes: 9 additions & 5 deletions terraform/platforms/aws/asg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ data "aws_ami" "coreos" {
}

resource "aws_autoscaling_group" "main" {
name = "${var.name}"
name = "${var.name}-${aws_launch_configuration.main.name}"

max_size = "${var.size}"
min_size = "${var.size}"
desired_capacity = "${var.size}"
max_size = "${var.max_size}"
min_size = "${var.min_size}"
desired_capacity = "${var.desired_capacity}"
min_elb_capacity = "${var.min_elb_capacity}"

load_balancers = ["${aws_elb.clients.name}"]
health_check_grace_period = 120
Expand All @@ -50,6 +51,10 @@ resource "aws_autoscaling_group" "main" {
vpc_zone_identifier = ["${var.subnets_ids}"]
launch_configuration = "${aws_launch_configuration.main.name}"

lifecycle {
create_before_destroy = true
}

tags = [
{
key = "Name"
Expand All @@ -60,7 +65,6 @@ resource "aws_autoscaling_group" "main" {
}

resource "aws_launch_configuration" "main" {
name_prefix = "${var.name}"

image_id = "${data.aws_ami.coreos.image_id}"
instance_type = "${var.instance_type}"
Expand Down
16 changes: 14 additions & 2 deletions terraform/platforms/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,20 @@ variable "name" {
description = "Name of the deployment"
}

variable "size" {
description = "Number of etcd members (must be odd)"
variable "max_size" {
description = "Number of max etcd members in ASG (must be odd)"
}

variable "min_size" {
description = "Number of min etcd members in ASG (must be odd)"
}

variable "desired_capacity" {
description = "Number of desired etcd members in ASG (must be odd)"
}

variable "min_elb_capacity" {
description = "Number of minimum elb capacity for ASG (must be same as min_size)"
}

variable "instance_type" {
Expand Down