From bd4bbf8766a6d77584429bb501526a5f29d3ca6c Mon Sep 17 00:00:00 2001 From: dbernstein Date: Thu, 8 Jun 2023 14:44:34 -0700 Subject: [PATCH] Deployments sync 20230608 (#21) --- duracloud/main.tf | 37 +++++++++++++++++++-------------- duracloud/variables.tf | 10 +++++++++ management-console/main.tf | 36 ++++++++++++++++++++++++++------ management-console/variables.tf | 9 ++++++++ 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/duracloud/main.tf b/duracloud/main.tf index 0d27a35..c757a6f 100644 --- a/duracloud/main.tf +++ b/duracloud/main.tf @@ -214,8 +214,13 @@ resource "aws_elastic_beanstalk_configuration_template" "config" { name = "LoadBalancerType" value = "application" } -} + setting { + namespace = "aws:elasticbeanstalk:environment:process:default" + name = "StickinessEnabled" + value = "true" + } +} resource "aws_elastic_beanstalk_environment" "duracloud" { name = "${var.stack_name}-core" @@ -247,22 +252,22 @@ resource "aws_elastic_beanstalk_environment" "duracloud" { value = var.duracloud_instance_class } -} + setting { + namespace = "aws:autoscaling:asg" + name = "MinSize" + value = var.minimum_instance_count + } -resource "aws_alb_target_group" "duracloud" { - name = "${var.stack_name}-duracloud" - target_type = "alb" - port = 80 - protocol = "TCP" - vpc_id = data.aws_vpc.duracloud.id - stickiness { - type = "app_cookie" - cookie_name = "jsessionid" + setting { + namespace = "aws:autoscaling:asg" + name = "MaxSize" + value = var.maximum_instance_count } -} -resource "aws_alb_target_group_attachment" "duracloud" { - target_group_arn = aws_alb_target_group.duracloud.arn - target_id = aws_elastic_beanstalk_environment.duracloud.load_balancers[0] - port = 80 + setting { + namespace = "aws:elasticbeanstalk:environment:process:default" + name = "HealthCheckPath" + value = "/duradmin/login" + } } + diff --git a/duracloud/variables.tf b/duracloud/variables.tf index 691e881..7933f91 100644 --- a/duracloud/variables.tf +++ b/duracloud/variables.tf @@ -20,3 +20,13 @@ variable "ec2_keypair" { variable "stack_name" { description = "The name of the duracloud stack." } + +variable "minimum_instance_count" { + description = "The minimum number of instances to run" + default = 2 +} + +variable "maximum_instance_count" { + description = "The minimum number of instances to run" + default = 6 +} diff --git a/management-console/main.tf b/management-console/main.tf index 51ba431..f2e1bb1 100644 --- a/management-console/main.tf +++ b/management-console/main.tf @@ -154,10 +154,6 @@ resource "aws_elastic_beanstalk_application" "mc" { max_count = 128 delete_source_from_s3 = true } - - tags = { - Name = "${var.stack_name}-eb-mc-application" - } } resource "aws_elastic_beanstalk_application_version" "default" { @@ -215,8 +211,19 @@ resource "aws_elastic_beanstalk_configuration_template" "config" { name = "LoadBalancerType" value = "application" } -} + setting { + namespace = "aws:elasticbeanstalk:environment:process:default" + name = "HealthCheckPath" + value = "/login" + } + + setting { + namespace = "aws:elasticbeanstalk:environment:process:default" + name = "StickinessEnabled" + value = "true" + } +} resource "aws_elastic_beanstalk_environment" "mc" { name = "${var.stack_name}-management-console" @@ -224,6 +231,7 @@ resource "aws_elastic_beanstalk_environment" "mc" { template_name = aws_elastic_beanstalk_configuration_template.config.name version_label = var.mc_war + setting { namespace = "aws:elasticbeanstalk:container:tomcat:jvmoptions" name = "JVM Options" @@ -242,11 +250,27 @@ resource "aws_elastic_beanstalk_environment" "mc" { value = "HTTPS" } - setting { namespace = "aws:autoscaling:launchconfiguration" name = "InstanceType" value = var.mc_instance_class } + setting { + namespace = "aws:elasticbeanstalk:application" + name = "Application Healthcheck URL" + value = "/login" + } + + setting { + namespace = "aws:autoscaling:asg" + name = "MinSize" + value = var.minimum_instance_count + } + + setting { + namespace = "aws:autoscaling:asg" + name = "MaxSize" + value = var.maximum_instance_count + } } diff --git a/management-console/variables.tf b/management-console/variables.tf index c5d8a5e..17e9850 100644 --- a/management-console/variables.tf +++ b/management-console/variables.tf @@ -22,3 +22,12 @@ variable "stack_name" { description = "The name of the duracloud stack." } +variable "minimum_instance_count" { + description = "The minimum number of instances to run" + default = 2 +} + +variable "maximum_instance_count" { + description = "The minimum number of instances to run" + default = 4 +}