From dc89a016e791ef5ffc511657fa7d3dbdc55ffa2b Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Mon, 3 Jul 2023 18:05:05 +0530 Subject: [PATCH 01/20] added the variable and override block to have ASG launch with ABS --- .../autoscaling_group.tf | 15 ++++++++ autoscaling_with_launch_template/variables.tf | 36 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/autoscaling_with_launch_template/autoscaling_group.tf b/autoscaling_with_launch_template/autoscaling_group.tf index 7f84caa..8ac3d52 100644 --- a/autoscaling_with_launch_template/autoscaling_group.tf +++ b/autoscaling_with_launch_template/autoscaling_group.tf @@ -17,6 +17,12 @@ resource "aws_autoscaling_group" "default" { min_elb_capacity = var.min_elb_capacity wait_for_elb_capacity = var.wait_for_elb_capacity protect_from_scale_in = var.protect_from_scale_in + burstable_performance = var.burstable_performance + excluded_instance_types = var.excluded_instance_types + architecture_type = var.architecture_type + instance_generation = var.instance_generation + memory_mib = var.memory_mib + vcpu_count = var.vcpu_count mixed_instances_policy { launch_template { @@ -65,6 +71,15 @@ resource "aws_autoscaling_group" "default" { instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" } + override { + instance_requirements { + burstable_performance = var.burstable_performance + excluded_instance_types = var.excluded_instance_types + instance_generations = var.instance_generation + memory_mib = var.memory_mib + vcpu_count = var.vcpu_count + } + } } instances_distribution { diff --git a/autoscaling_with_launch_template/variables.tf b/autoscaling_with_launch_template/variables.tf index a91bcd5..1428eee 100644 --- a/autoscaling_with_launch_template/variables.tf +++ b/autoscaling_with_launch_template/variables.tf @@ -65,6 +65,42 @@ variable "instance_types" { description = "List of instance type, ordered priority, less index more priority" } +variable "burstable_performance" { + description = "Enable burstable performance instances" + type = bool + default = false +} + +variable "excluded_instance_types" { + description = "List of excluded instance types" + type = list(string) + default = [] +} + +variable "architecture_type" { + description = "Architecture type for instance selection" + type = string + default = "x86_64" +} + +variable "instance_generations" { + description = "Instance generation for instance selection" + type = string + default = "current" +} + +variable "memory_mib" { + description = "Minimum memory (in MiB) for ABS instance selection" + type = number + default = 2048 +} + +variable "vcpu_count" { + description = "Minimum number of vCPUs for ABS instance selection" + type = number + default = 2 +} + variable "notification_enabled" { description = "If enabled SNS notification will be sent out" default = false From 7f39ff79d3b46aeb73c586363ef2fe46591cf5e5 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Mon, 3 Jul 2023 18:32:51 +0530 Subject: [PATCH 02/20] updated the code in autoscaling group also to hv ABS variables defined --- autoscaling_group/autoscaling_group.tf | 15 ++++++++ autoscaling_group/variables.tf | 36 +++++++++++++++++++ .../autoscaling_group.tf | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index 0c92994..9e6f781 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -19,6 +19,12 @@ resource "aws_autoscaling_group" "default" { wait_for_elb_capacity = var.wait_for_elb_capacity protect_from_scale_in = var.protect_from_scale_in capacity_rebalance = var.capacity_rebalance + burstable_performance = var.burstable_performance + excluded_instance_types = var.excluded_instance_types + architecture_type = var.architecture_type + instance_generations = var.instance_generations + memory_mib = var.memory_mib + vcpu_count = var.vcpu_count dynamic "initial_lifecycle_hook" { for_each = var.initial_lifecycle_hooks @@ -76,6 +82,15 @@ resource "aws_autoscaling_group" "default" { override { instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" } + override { + instance_requirements { + burstable_performance = var.burstable_performance + excluded_instance_types = var.excluded_instance_types + instance_generations = var.instance_generation + memory_mib = var.memory_mib + vcpu_count = var.vcpu_count + } + } } instances_distribution { on_demand_allocation_strategy = var.on_demand_allocation_strategy diff --git a/autoscaling_group/variables.tf b/autoscaling_group/variables.tf index 8ce0d5c..09e8025 100644 --- a/autoscaling_group/variables.tf +++ b/autoscaling_group/variables.tf @@ -83,6 +83,42 @@ variable "instance_types" { type = list(string) } +variable "burstable_performance" { + description = "Enable burstable performance instances" + type = bool + default = false +} + +variable "excluded_instance_types" { + description = "List of excluded instance types" + type = list(string) + default = [] +} + +variable "architecture_type" { + description = "Architecture type for instance selection" + type = string + default = "x86_64" +} + +variable "instance_generations" { + description = "Instance generation for instance selection" + type = string + default = "current" +} + +variable "memory_mib" { + description = "Minimum memory (in MiB) for ABS instance selection" + type = number + default = 2048 +} + +variable "vcpu_count" { + description = "Minimum number of vCPUs for ABS instance selection" + type = number + default = 2 +} + variable "launch_template_id" { description = "Template ID" } diff --git a/autoscaling_with_launch_template/autoscaling_group.tf b/autoscaling_with_launch_template/autoscaling_group.tf index 8ac3d52..1359546 100644 --- a/autoscaling_with_launch_template/autoscaling_group.tf +++ b/autoscaling_with_launch_template/autoscaling_group.tf @@ -20,7 +20,7 @@ resource "aws_autoscaling_group" "default" { burstable_performance = var.burstable_performance excluded_instance_types = var.excluded_instance_types architecture_type = var.architecture_type - instance_generation = var.instance_generation + instance_generations = var.instance_generations memory_mib = var.memory_mib vcpu_count = var.vcpu_count From c2f5b226d5d54ff64f39cd7119044585d9874cd3 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Mon, 3 Jul 2023 18:35:49 +0530 Subject: [PATCH 03/20] corrected the variable --- autoscaling_group/autoscaling_group.tf | 2 +- autoscaling_with_launch_template/autoscaling_group.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index 9e6f781..4ba4666 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -86,7 +86,7 @@ resource "aws_autoscaling_group" "default" { instance_requirements { burstable_performance = var.burstable_performance excluded_instance_types = var.excluded_instance_types - instance_generations = var.instance_generation + instance_generations = var.instance_generations memory_mib = var.memory_mib vcpu_count = var.vcpu_count } diff --git a/autoscaling_with_launch_template/autoscaling_group.tf b/autoscaling_with_launch_template/autoscaling_group.tf index 1359546..87404eb 100644 --- a/autoscaling_with_launch_template/autoscaling_group.tf +++ b/autoscaling_with_launch_template/autoscaling_group.tf @@ -75,7 +75,7 @@ resource "aws_autoscaling_group" "default" { instance_requirements { burstable_performance = var.burstable_performance excluded_instance_types = var.excluded_instance_types - instance_generations = var.instance_generation + instance_generations = var.instance_generations memory_mib = var.memory_mib vcpu_count = var.vcpu_count } From 18d5b7da7b4524ca61a5f59cacacfdeb75f6eb0a Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Mon, 3 Jul 2023 19:16:24 +0530 Subject: [PATCH 04/20] corrected the variable datatype --- autoscaling_group/variables.tf | 4 ++-- autoscaling_with_launch_template/variables.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autoscaling_group/variables.tf b/autoscaling_group/variables.tf index 09e8025..692f706 100644 --- a/autoscaling_group/variables.tf +++ b/autoscaling_group/variables.tf @@ -85,8 +85,8 @@ variable "instance_types" { variable "burstable_performance" { description = "Enable burstable performance instances" - type = bool - default = false + type = string + default = "included" } variable "excluded_instance_types" { diff --git a/autoscaling_with_launch_template/variables.tf b/autoscaling_with_launch_template/variables.tf index 1428eee..d534ca2 100644 --- a/autoscaling_with_launch_template/variables.tf +++ b/autoscaling_with_launch_template/variables.tf @@ -67,8 +67,8 @@ variable "instance_types" { variable "burstable_performance" { description = "Enable burstable performance instances" - type = bool - default = false + type = string + default = "included" } variable "excluded_instance_types" { From 6d3fd9eeefef024a2fa2af4335f1d5b28c03e8ec Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Mon, 3 Jul 2023 21:39:51 +0530 Subject: [PATCH 05/20] added the cpu_manufacturer variable --- autoscaling_group/autoscaling_group.tf | 2 ++ autoscaling_group/variables.tf | 6 ++++++ autoscaling_with_launch_template/autoscaling_group.tf | 2 ++ autoscaling_with_launch_template/variables.tf | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index 4ba4666..8a4d1ad 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -25,6 +25,7 @@ resource "aws_autoscaling_group" "default" { instance_generations = var.instance_generations memory_mib = var.memory_mib vcpu_count = var.vcpu_count + cpu_manufacturers = var.cpu_manufacturers dynamic "initial_lifecycle_hook" { for_each = var.initial_lifecycle_hooks @@ -89,6 +90,7 @@ resource "aws_autoscaling_group" "default" { instance_generations = var.instance_generations memory_mib = var.memory_mib vcpu_count = var.vcpu_count + cpu_manufacturers = var.cpu_manufacturers } } } diff --git a/autoscaling_group/variables.tf b/autoscaling_group/variables.tf index 692f706..cdedd2c 100644 --- a/autoscaling_group/variables.tf +++ b/autoscaling_group/variables.tf @@ -95,6 +95,12 @@ variable "excluded_instance_types" { default = [] } +variable "cpu_manufacturers" { + description = "CPU manufacturer for instance selection" + type = list(string) + default = [] +} + variable "architecture_type" { description = "Architecture type for instance selection" type = string diff --git a/autoscaling_with_launch_template/autoscaling_group.tf b/autoscaling_with_launch_template/autoscaling_group.tf index 87404eb..4b2b41c 100644 --- a/autoscaling_with_launch_template/autoscaling_group.tf +++ b/autoscaling_with_launch_template/autoscaling_group.tf @@ -23,6 +23,7 @@ resource "aws_autoscaling_group" "default" { instance_generations = var.instance_generations memory_mib = var.memory_mib vcpu_count = var.vcpu_count + cpu_manufacturers = var.cpu_manufacturers mixed_instances_policy { launch_template { @@ -78,6 +79,7 @@ resource "aws_autoscaling_group" "default" { instance_generations = var.instance_generations memory_mib = var.memory_mib vcpu_count = var.vcpu_count + cpu_manufacturers = var.cpu_manufacturers } } } diff --git a/autoscaling_with_launch_template/variables.tf b/autoscaling_with_launch_template/variables.tf index d534ca2..1b41e2c 100644 --- a/autoscaling_with_launch_template/variables.tf +++ b/autoscaling_with_launch_template/variables.tf @@ -77,6 +77,12 @@ variable "excluded_instance_types" { default = [] } +variable "cpu_manufacturers" { + description = "CPU manufacturer for instance selection" + type = list(string) + default = [] +} + variable "architecture_type" { description = "Architecture type for instance selection" type = string From d3f12c1ce9f656289daf072e11b66d32b727c98b Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Mon, 3 Jul 2023 22:02:10 +0530 Subject: [PATCH 06/20] updated versions --- autoscaling_group/versions.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoscaling_group/versions.tf b/autoscaling_group/versions.tf index 6bfa801..27dcd10 100644 --- a/autoscaling_group/versions.tf +++ b/autoscaling_group/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 0.13" + required_version = ">= 1.5" required_providers { aws = { source = "hashicorp/aws" - version = "3.76.1" + version = "5.6.2" } } } From 1c95604804b7d36f6201ee74944000b95c9a1d58 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Mon, 3 Jul 2023 22:04:25 +0530 Subject: [PATCH 07/20] rolled back the versions --- autoscaling_group/versions.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoscaling_group/versions.tf b/autoscaling_group/versions.tf index 27dcd10..6bfa801 100644 --- a/autoscaling_group/versions.tf +++ b/autoscaling_group/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.5" + required_version = ">= 0.13" required_providers { aws = { source = "hashicorp/aws" - version = "5.6.2" + version = "3.76.1" } } } From 3d2379c63681f623b8d23f9d9f47f3020d01497c Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Tue, 4 Jul 2023 14:47:24 +0530 Subject: [PATCH 08/20] removed the variables from 22-27 --- autoscaling_group/autoscaling_group.tf | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index 8a4d1ad..496823a 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -19,13 +19,7 @@ resource "aws_autoscaling_group" "default" { wait_for_elb_capacity = var.wait_for_elb_capacity protect_from_scale_in = var.protect_from_scale_in capacity_rebalance = var.capacity_rebalance - burstable_performance = var.burstable_performance - excluded_instance_types = var.excluded_instance_types - architecture_type = var.architecture_type - instance_generations = var.instance_generations - memory_mib = var.memory_mib - vcpu_count = var.vcpu_count - cpu_manufacturers = var.cpu_manufacturers + dynamic "initial_lifecycle_hook" { for_each = var.initial_lifecycle_hooks From 368301743457d7ad9253f0200cab328a6daa628f Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Tue, 4 Jul 2023 15:00:09 +0530 Subject: [PATCH 09/20] updated the instance_requirement block --- autoscaling_group/autoscaling_group.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index 496823a..cda89c9 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -77,8 +77,8 @@ resource "aws_autoscaling_group" "default" { override { instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" } - override { - instance_requirements { + + instance_requirements { burstable_performance = var.burstable_performance excluded_instance_types = var.excluded_instance_types instance_generations = var.instance_generations @@ -86,7 +86,7 @@ resource "aws_autoscaling_group" "default" { vcpu_count = var.vcpu_count cpu_manufacturers = var.cpu_manufacturers } - } + } instances_distribution { on_demand_allocation_strategy = var.on_demand_allocation_strategy From 30ca12ac0d3735e242e8c286fb4eaf53fbe855a2 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Tue, 4 Jul 2023 15:20:22 +0530 Subject: [PATCH 10/20] updated --- autoscaling_group/autoscaling_group.tf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index cda89c9..f898cc3 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -78,14 +78,23 @@ resource "aws_autoscaling_group" "default" { instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" } + override { instance_requirements { burstable_performance = var.burstable_performance excluded_instance_types = var.excluded_instance_types - instance_generations = var.instance_generations - memory_mib = var.memory_mib - vcpu_count = var.vcpu_count + instance_generations = var.instance_generations + memory_mib { + min = 1024 + max = 2048 + } + vcpu_count { + min = 2 + max = 8 + } cpu_manufacturers = var.cpu_manufacturers } + } + } instances_distribution { From ac0f9fb1a511580aeba16119b18161606dfed888 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Tue, 4 Jul 2023 17:07:56 +0530 Subject: [PATCH 11/20] removed instance type --- autoscaling_group/autoscaling_group.tf | 44 ++------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index f898cc3..ba68e50 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -38,54 +38,14 @@ resource "aws_autoscaling_group" "default" { version = var.launch_template_version } - override { - instance_type = length(var.instance_types) >= 1 ? var.instance_types.0 : "" - } - - override { - instance_type = length(var.instance_types) >= 2 ? var.instance_types.1 : "" - } - - override { - instance_type = length(var.instance_types) >= 3 ? var.instance_types.2 : "" - } - - override { - instance_type = length(var.instance_types) >= 4 ? var.instance_types.3 : "" - } - - override { - instance_type = length(var.instance_types) >= 5 ? var.instance_types.4 : "" - } - - override { - instance_type = length(var.instance_types) >= 6 ? var.instance_types.5 : "" - } - - override { - instance_type = length(var.instance_types) >= 7 ? var.instance_types.6 : "" - } - - override { - instance_type = length(var.instance_types) >= 8 ? var.instance_types.7 : "" - } - - override { - instance_type = length(var.instance_types) >= 9 ? var.instance_types.8 : "" - } - - override { - instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" - } - override { instance_requirements { burstable_performance = var.burstable_performance excluded_instance_types = var.excluded_instance_types instance_generations = var.instance_generations memory_mib { - min = 1024 - max = 2048 + min = 2048 + max = 8192 } vcpu_count { min = 2 From db98c715077494b8d5fffb7afafdba173c5e7b3e Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Tue, 4 Jul 2023 23:32:34 +0530 Subject: [PATCH 12/20] added provider file --- autoscaling_group/autoscaling_group.tf | 1 - autoscaling_group/provider.tf | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 autoscaling_group/provider.tf diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index ba68e50..9ec16de 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -55,7 +55,6 @@ resource "aws_autoscaling_group" "default" { } } - } instances_distribution { on_demand_allocation_strategy = var.on_demand_allocation_strategy diff --git a/autoscaling_group/provider.tf b/autoscaling_group/provider.tf new file mode 100644 index 0000000..307ce86 --- /dev/null +++ b/autoscaling_group/provider.tf @@ -0,0 +1,10 @@ + +terraform { + required_version = ">= 1.5.0" + required_providers { + aws = { + source = "hashicorp/aws" + version = "5.6.0" + } + } +} From 556e62bdd9aedf6ea9f646f046f3c3dd615bf864 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Tue, 4 Jul 2023 23:41:47 +0530 Subject: [PATCH 13/20] updated the version --- autoscaling_group/autoscaling_group.tf | 2 +- autoscaling_group/provider.tf | 10 ---------- autoscaling_group/versions.tf | 4 ++-- 3 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 autoscaling_group/provider.tf diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index 9ec16de..30511e4 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -39,7 +39,7 @@ resource "aws_autoscaling_group" "default" { } override { - instance_requirements { + instance_requirements { burstable_performance = var.burstable_performance excluded_instance_types = var.excluded_instance_types instance_generations = var.instance_generations diff --git a/autoscaling_group/provider.tf b/autoscaling_group/provider.tf deleted file mode 100644 index 307ce86..0000000 --- a/autoscaling_group/provider.tf +++ /dev/null @@ -1,10 +0,0 @@ - -terraform { - required_version = ">= 1.5.0" - required_providers { - aws = { - source = "hashicorp/aws" - version = "5.6.0" - } - } -} diff --git a/autoscaling_group/versions.tf b/autoscaling_group/versions.tf index 6bfa801..307ce86 100644 --- a/autoscaling_group/versions.tf +++ b/autoscaling_group/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 0.13" + required_version = ">= 1.5.0" required_providers { aws = { source = "hashicorp/aws" - version = "3.76.1" + version = "5.6.0" } } } From 8724e5d6b78ac77477923e1f12cc2f408a2f5ce2 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Wed, 5 Jul 2023 00:01:05 +0530 Subject: [PATCH 14/20] updated the version --- autoscaling_group/versions.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoscaling_group/versions.tf b/autoscaling_group/versions.tf index 307ce86..58d0cfc 100644 --- a/autoscaling_group/versions.tf +++ b/autoscaling_group/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.5.0" + required_version = "~> 0.13" required_providers { aws = { source = "hashicorp/aws" - version = "5.6.0" + version = "~> 4.60.0" } } } From 19e12db60f858f22f513d64ccaaa465f171aec6c Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Wed, 5 Jul 2023 00:12:54 +0530 Subject: [PATCH 15/20] update variable value --- autoscaling_group/variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoscaling_group/variables.tf b/autoscaling_group/variables.tf index cdedd2c..3bcb4d6 100644 --- a/autoscaling_group/variables.tf +++ b/autoscaling_group/variables.tf @@ -109,8 +109,8 @@ variable "architecture_type" { variable "instance_generations" { description = "Instance generation for instance selection" - type = string - default = "current" + type = list(string) + default = ["current"] } variable "memory_mib" { From 610ae28a1fd3db18485db5e291b5505af6824a86 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Wed, 5 Jul 2023 00:22:59 +0530 Subject: [PATCH 16/20] updated the mem and cpu block --- autoscaling_group/autoscaling_group.tf | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/autoscaling_group/autoscaling_group.tf b/autoscaling_group/autoscaling_group.tf index 30511e4..d7e4682 100644 --- a/autoscaling_group/autoscaling_group.tf +++ b/autoscaling_group/autoscaling_group.tf @@ -44,12 +44,10 @@ resource "aws_autoscaling_group" "default" { excluded_instance_types = var.excluded_instance_types instance_generations = var.instance_generations memory_mib { - min = 2048 - max = 8192 + min = var.memory_mib } vcpu_count { - min = 2 - max = 8 + min = var.vcpu_count } cpu_manufacturers = var.cpu_manufacturers } From ee972e955778d9bcb132d00409a0b65693bf5ef0 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Wed, 5 Jul 2023 00:35:47 +0530 Subject: [PATCH 17/20] removed the asg_with_lt folder changes --- .../autoscaling_group.tf | 12 +----- autoscaling_with_launch_template/variables.tf | 42 ------------------- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/autoscaling_with_launch_template/autoscaling_group.tf b/autoscaling_with_launch_template/autoscaling_group.tf index 4b2b41c..f0f0bff 100644 --- a/autoscaling_with_launch_template/autoscaling_group.tf +++ b/autoscaling_with_launch_template/autoscaling_group.tf @@ -71,17 +71,7 @@ resource "aws_autoscaling_group" "default" { override { instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" } - - override { - instance_requirements { - burstable_performance = var.burstable_performance - excluded_instance_types = var.excluded_instance_types - instance_generations = var.instance_generations - memory_mib = var.memory_mib - vcpu_count = var.vcpu_count - cpu_manufacturers = var.cpu_manufacturers - } - } + } instances_distribution { diff --git a/autoscaling_with_launch_template/variables.tf b/autoscaling_with_launch_template/variables.tf index 1b41e2c..a91bcd5 100644 --- a/autoscaling_with_launch_template/variables.tf +++ b/autoscaling_with_launch_template/variables.tf @@ -65,48 +65,6 @@ variable "instance_types" { description = "List of instance type, ordered priority, less index more priority" } -variable "burstable_performance" { - description = "Enable burstable performance instances" - type = string - default = "included" -} - -variable "excluded_instance_types" { - description = "List of excluded instance types" - type = list(string) - default = [] -} - -variable "cpu_manufacturers" { - description = "CPU manufacturer for instance selection" - type = list(string) - default = [] -} - -variable "architecture_type" { - description = "Architecture type for instance selection" - type = string - default = "x86_64" -} - -variable "instance_generations" { - description = "Instance generation for instance selection" - type = string - default = "current" -} - -variable "memory_mib" { - description = "Minimum memory (in MiB) for ABS instance selection" - type = number - default = 2048 -} - -variable "vcpu_count" { - description = "Minimum number of vCPUs for ABS instance selection" - type = number - default = 2 -} - variable "notification_enabled" { description = "If enabled SNS notification will be sent out" default = false From b35f4b9a082c0edc0aebe1a464f8b804ffc66171 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Wed, 5 Jul 2023 00:37:29 +0530 Subject: [PATCH 18/20] removed the var from asg_with_lt folder asg file --- autoscaling_with_launch_template/autoscaling_group.tf | 9 --------- 1 file changed, 9 deletions(-) diff --git a/autoscaling_with_launch_template/autoscaling_group.tf b/autoscaling_with_launch_template/autoscaling_group.tf index f0f0bff..68e2837 100644 --- a/autoscaling_with_launch_template/autoscaling_group.tf +++ b/autoscaling_with_launch_template/autoscaling_group.tf @@ -17,13 +17,6 @@ resource "aws_autoscaling_group" "default" { min_elb_capacity = var.min_elb_capacity wait_for_elb_capacity = var.wait_for_elb_capacity protect_from_scale_in = var.protect_from_scale_in - burstable_performance = var.burstable_performance - excluded_instance_types = var.excluded_instance_types - architecture_type = var.architecture_type - instance_generations = var.instance_generations - memory_mib = var.memory_mib - vcpu_count = var.vcpu_count - cpu_manufacturers = var.cpu_manufacturers mixed_instances_policy { launch_template { @@ -71,9 +64,7 @@ resource "aws_autoscaling_group" "default" { override { instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" } - } - instances_distribution { on_demand_allocation_strategy = var.on_demand_allocation_strategy on_demand_base_capacity = var.on_demand_base_capacity From 0e5860e997a16290eea6a8708f36f1ddc897faee Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Wed, 5 Jul 2023 00:38:31 +0530 Subject: [PATCH 19/20] space corrected --- autoscaling_with_launch_template/autoscaling_group.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoscaling_with_launch_template/autoscaling_group.tf b/autoscaling_with_launch_template/autoscaling_group.tf index 68e2837..a0804ee 100644 --- a/autoscaling_with_launch_template/autoscaling_group.tf +++ b/autoscaling_with_launch_template/autoscaling_group.tf @@ -64,7 +64,9 @@ resource "aws_autoscaling_group" "default" { override { instance_type = length(var.instance_types) >= 10 ? var.instance_types.9 : "" } + } + instances_distribution { on_demand_allocation_strategy = var.on_demand_allocation_strategy on_demand_base_capacity = var.on_demand_base_capacity From a254c1cac7305929cda5ad3b49efdbea3cb4e831 Mon Sep 17 00:00:00 2001 From: priya-sharmaa Date: Wed, 5 Jul 2023 12:09:32 +0530 Subject: [PATCH 20/20] change the ondemand allocation strategy --- autoscaling_group/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoscaling_group/variables.tf b/autoscaling_group/variables.tf index 3bcb4d6..cb8eb98 100644 --- a/autoscaling_group/variables.tf +++ b/autoscaling_group/variables.tf @@ -154,7 +154,7 @@ variable "min_elb_capacity" { variable "on_demand_allocation_strategy" { description = "Strategy to use when launching on-demand instances. Valid values: prioritized. Default: prioritized" - default = "prioritized" + default = "lowest-price" } variable "on_demand_base_capacity" {