Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: 25 refresh instances #39

Closed
wants to merge 3 commits into from
Closed
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
35 changes: 25 additions & 10 deletions instances/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
version = "~> 3.22"
}
}
backend "remote" {
Expand Down Expand Up @@ -30,16 +30,31 @@ variable "perm_env" {
}
}

resource "aws_autoscaling_group" "dev_api" {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question we have: do we need to create this autoscaling group or will Terraform build it?

name = "backend-dev"
max_size = 5 # does this seem appropriate?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this was set to a max of 3, but that was arbitrary! 5 seems like a a good end target, assuming we dial in appropriate scaling triggers.

min_size = 1
health_check_type = "ELB"
capacity_rebalance = true
force_delete = false
vpc_zone_identifier = [module.perm_env_data.subnet]

resource "aws_instance" "api" {
ami = module.perm_env_data.backend_ami
instance_type = "m4.large"
vpc_security_group_ids = [module.perm_env_data.security_group]
monitoring = true
private_ip = "172.31.0.80"
subnet_id = module.perm_env_data.subnet
tags = {
Name = "${var.perm_env.name} backend"
timeouts {
delete = "15m"
}

tag {
key = "Name"
value = "${var.perm_env.name} backend"
propagate_at_launch = true
}

instance_refresh {
strategy = "Rolling"
preferences {
# note that the default is 90 but the example uses 50
min_healthy_percentage = 50
}
}
}

Expand Down