From d24fe3f719a8c0c084544a794fae1d00fd3aa05c Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Tue, 17 May 2022 12:32:47 +0200 Subject: [PATCH] fix(uti): Terraform settings Signed-off-by: Peter Mikus Change-Id: Ica539512f3129391551938541d00d9e9d1560af3 --- .../main.tf | 33 ++++++++++++++++++++++ .../variables.tf | 33 ++++++++++++++++++++++ .../terraform-aws-fdio-csit-dash-env/main.tf | 15 ++++++++-- 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/main.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/main.tf index 7fbf50c711..fd570ab575 100644 --- a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/main.tf +++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/main.tf @@ -422,6 +422,39 @@ resource "aws_elastic_beanstalk_environment" "environment" { value = aws_iam_instance_profile.ec2_iam_instance_profile.name } + # aws:autoscaling:updatepolicy:rollingupdate + setting { + namespace = "aws:autoscaling:updatepolicy:rollingupdate" + name = "RollingUpdateEnabled" + value = var.autoscaling_updatepolicy_rolling_update_enabled + } + + setting { + namespace = "aws:autoscaling:updatepolicy:rollingupdate" + name = "RollingUpdateType" + value = var.autoscaling_updatepolicy_rolling_update_type + } + + setting { + namespace = "aws:autoscaling:updatepolicy:rollingupdate" + name = "MinInstancesInService" + value = var.autoscaling_updatepolicy_min_instance_in_service + } + + # aws:elasticbeanstalk:command + setting { + namespace = "aws:elasticbeanstalk:command" + name = "DeploymentPolicy" + value = var.command_deployment_policy + } + + # aws:autoscaling:updatepolicy:rollingupdate + setting { + namespace = "aws:autoscaling:updatepolicy:rollingupdate" + name = "MaxBatchSize" + value = var.updatepolicy_max_batch_size + } + # aws:elasticbeanstalk:healthreporting:system setting { namespace = "aws:elasticbeanstalk:healthreporting:system" diff --git a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/variables.tf b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/variables.tf index c2a1ea3cf7..b0c41899b7 100644 --- a/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/variables.tf +++ b/fdio.infra.terraform/terraform-aws-elastic-beanstalk-environment/variables.tf @@ -163,6 +163,39 @@ variable "environment_process_default_unhealthy_threshold_count" { default = 3 } +# aws:autoscaling:updatepolicy:rollingupdate +variable "autoscaling_updatepolicy_rolling_update_enabled" { + description = "Whether to enable rolling update." + type = bool + default = true +} + +variable "autoscaling_updatepolicy_rolling_update_type" { + description = "`Health` or `Immutable`. Set it to `Immutable` to apply the configuration change to a fresh group of instances." + type = string + default = "Immutable" +} + +variable "autoscaling_updatepolicy_min_instance_in_service" { + description = "Minimum number of instances in service during update." + type = number + default = 1 +} + +# aws:elasticbeanstalk:command +variable "command_deployment_policy" { + description = "Use the DeploymentPolicy option to set the deployment type. The following values are supported: `AllAtOnce`, `Rolling`, `RollingWithAdditionalBatch`, `Immutable`, `TrafficSplitting`." + type = string + default = "Rolling" +} + +# aws:autoscaling:updatepolicy:rollingupdate +variable "updatepolicy_max_batch_size" { + description = "Maximum number of instances to update at once." + type = number + default = 1 +} + # aws:elasticbeanstalk:healthreporting:system variable "healthreporting_system_type" { description = "Whether to enable enhanced health reporting for this environment" diff --git a/fdio.infra.terraform/terraform-aws-fdio-csit-dash-env/main.tf b/fdio.infra.terraform/terraform-aws-fdio-csit-dash-env/main.tf index 3e70b4ddf8..65dc59f999 100644 --- a/fdio.infra.terraform/terraform-aws-fdio-csit-dash-env/main.tf +++ b/fdio.infra.terraform/terraform-aws-fdio-csit-dash-env/main.tf @@ -34,9 +34,9 @@ module "elastic_beanstalk_environment" { environment_application = module.elastic_beanstalk_application.application_name environment_description = module.elastic_beanstalk_application.application_description environment_name = "fdio-csit-dash-env" - environment_solution_stack_name = "64bit Amazon Linux 2 v3.3.12 running Python 3.8" + environment_solution_stack_name = "64bit Amazon Linux 2 v3.3.13 running Python 3.8" environment_tier = "WebServer" - environment_wait_for_ready_timeout = "20m" + environment_wait_for_ready_timeout = "25m" environment_version_label = "" # aws:ec2:instances @@ -58,6 +58,17 @@ module "elastic_beanstalk_environment" { environment_process_default_port = 5000 environment_process_default_unhealthy_threshold_count = 3 + # aws:autoscaling:updatepolicy:rollingupdate + autoscaling_updatepolicy_rolling_update_enabled = true + autoscaling_updatepolicy_rolling_update_type = "Immutable" + autoscaling_updatepolicy_min_instance_in_service = 1 + + # aws:elasticbeanstalk:command + command_deployment_policy = "Rolling" + + # aws:autoscaling:updatepolicy:rollingupdate + updatepolicy_max_batch_size = 1 + # aws:elasticbeanstalk:healthreporting:system healthreporting_system_type = "enhanced" -- 2.16.6