From 9bcb95c8d02d7fd7fe929fc3ecff989ad3e4b6d8 Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 3 Oct 2019 16:34:37 +0100 Subject: [PATCH 01/15] fixing 0.12 init issue --- .gitignore | 2 ++ group/main.tf | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a3d7314..4058a64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.tfstate* .terraform/ spec/reports/* + +.idea/ \ No newline at end of file diff --git a/group/main.tf b/group/main.tf index b95cbd8..319d4b6 100644 --- a/group/main.tf +++ b/group/main.tf @@ -53,7 +53,7 @@ data "template_cloudinit_config" "cloud_config" { ## Creates launch configuration & security group module "lc" { - source = "lc" + source = "./lc" ### Resource labels stack_item_fullname = "${var.stack_item_fullname}" @@ -90,7 +90,7 @@ module "lc" { ## Creates auto scaling group module "asg" { - source = "asg" + source = "./asg" ### Resource tags stack_item_label = "${var.stack_item_label}" From a82e83be48d47ae90fe556e8d04add6b17789fca Mon Sep 17 00:00:00 2001 From: torz Date: Fri, 4 Oct 2019 15:18:42 +0100 Subject: [PATCH 02/15] updated to 0.12 syntax --- group/lc/main.tf | 93 +++++++++++++++-------------- group/lc/outputs.tf | 8 ++- group/lc/variables.tf | 53 +++++++++-------- group/lc/versions.tf | 4 ++ group/main.tf | 135 +++++++++++++++++++++--------------------- group/outputs.tf | 9 +-- group/variables.tf | 101 +++++++++++++++---------------- group/versions.tf | 4 ++ 8 files changed, 212 insertions(+), 195 deletions(-) create mode 100644 group/lc/versions.tf create mode 100644 group/versions.tf diff --git a/group/lc/main.tf b/group/lc/main.tf index d45ac9a..1145264 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -3,13 +3,13 @@ ## Creates security group resource "aws_security_group" "sg_asg" { description = "${var.stack_item_fullname} security group" - name_prefix = "${length(var.lc_sg_name_prefix_override) > 0 ? format("%s-", var.lc_sg_name_prefix_override) : format("%s-asg-", var.stack_item_label)}" - vpc_id = "${var.vpc_id}" + name_prefix = length(var.lc_sg_name_prefix_override) > 0 ? format("%s-", var.lc_sg_name_prefix_override) : format("%s-asg-", var.stack_item_label) + vpc_id = var.vpc_id - tags { - application = "${var.stack_item_fullname}" + tags = { + application = var.stack_item_fullname managed_by = "terraform" - Name = "${length(var.lc_sg_name_prefix_override) > 0 ? var.lc_sg_name_prefix_override : format("%s-asg", var.stack_item_label)}" + Name = length(var.lc_sg_name_prefix_override) > 0 ? var.lc_sg_name_prefix_override : format("%s-asg", var.stack_item_label) } lifecycle { @@ -19,26 +19,28 @@ resource "aws_security_group" "sg_asg" { ## Creates launch configuration resource "aws_launch_configuration" "lc" { - count = "${length(var.ebs_vol_device_name) > 0 ? 0 : 1}" + count = length(var.ebs_vol_device_name) > 0 ? 0 : 1 - associate_public_ip_address = "${var.associate_public_ip_address}" - ebs_optimized = "${var.ebs_optimized}" - enable_monitoring = "${var.enable_monitoring}" - iam_instance_profile = "${var.instance_profile}" - image_id = "${var.ami}" - instance_type = "${var.instance_type}" - key_name = "${var.key_name}" + associate_public_ip_address = var.associate_public_ip_address + ebs_optimized = var.ebs_optimized + enable_monitoring = var.enable_monitoring + iam_instance_profile = var.instance_profile + image_id = var.ami + instance_type = var.instance_type + key_name = var.key_name name_prefix = "${var.stack_item_label}-" - placement_tenancy = "${var.placement_tenancy}" - security_groups = ["${distinct(concat(list(aws_security_group.sg_asg.id), compact(var.security_groups)))}"] - spot_price = "${var.spot_price}" - user_data = "${var.user_data}" + placement_tenancy = var.placement_tenancy + security_groups = distinct( + concat([aws_security_group.sg_asg.id], compact(var.security_groups)), + ) + spot_price = var.spot_price + user_data = var.user_data root_block_device { - delete_on_termination = "${var.root_vol_del_on_term}" - iops = "${var.root_vol_type == "io1" ? var.root_vol_iops : "0" }" - volume_size = "${length(var.root_vol_size) > 0 ? var.root_vol_size : "8"}" - volume_type = "${var.root_vol_type}" + delete_on_termination = var.root_vol_del_on_term + iops = var.root_vol_type == "io1" ? var.root_vol_iops : "0" + volume_size = length(var.root_vol_size) > 0 ? var.root_vol_size : "8" + volume_type = var.root_vol_type } lifecycle { @@ -47,39 +49,42 @@ resource "aws_launch_configuration" "lc" { } resource "aws_launch_configuration" "lc_ebs" { - count = "${length(var.ebs_vol_device_name) > 0 ? 1 : 0}" + count = length(var.ebs_vol_device_name) > 0 ? 1 : 0 - associate_public_ip_address = "${var.associate_public_ip_address}" - ebs_optimized = "${var.ebs_optimized}" - enable_monitoring = "${var.enable_monitoring}" - iam_instance_profile = "${var.instance_profile}" - image_id = "${var.ami}" - instance_type = "${var.instance_type}" - key_name = "${var.key_name}" + associate_public_ip_address = var.associate_public_ip_address + ebs_optimized = var.ebs_optimized + enable_monitoring = var.enable_monitoring + iam_instance_profile = var.instance_profile + image_id = var.ami + instance_type = var.instance_type + key_name = var.key_name name_prefix = "${var.stack_item_label}-" - placement_tenancy = "${var.placement_tenancy}" - security_groups = ["${distinct(concat(list(aws_security_group.sg_asg.id), compact(var.security_groups)))}"] - spot_price = "${var.spot_price}" - user_data = "${var.user_data}" + placement_tenancy = var.placement_tenancy + security_groups = distinct( + concat([aws_security_group.sg_asg.id], compact(var.security_groups)), + ) + spot_price = var.spot_price + user_data = var.user_data root_block_device { - delete_on_termination = "${var.root_vol_del_on_term}" - iops = "${var.root_vol_type == "io1" ? var.root_vol_iops : "0" }" - volume_size = "${length(var.root_vol_size) > 0 ? var.root_vol_size : "0"}" - volume_type = "${var.root_vol_type}" + delete_on_termination = var.root_vol_del_on_term + iops = var.root_vol_type == "io1" ? var.root_vol_iops : "0" + volume_size = length(var.root_vol_size) > 0 ? var.root_vol_size : "0" + volume_type = var.root_vol_type } ebs_block_device { - delete_on_termination = "${var.ebs_vol_del_on_term}" - device_name = "${var.ebs_vol_device_name}" - encrypted = "${length(var.ebs_vol_snapshot_id) > 0 ? "" : var.ebs_vol_encrypted}" - iops = "${var.ebs_vol_type == "io1" ? var.ebs_vol_iops : "0" }" - snapshot_id = "${var.ebs_vol_snapshot_id}" - volume_size = "${length(var.ebs_vol_snapshot_id) > 0 ? "0" : var.ebs_vol_size}" - volume_type = "${var.ebs_vol_type}" + delete_on_termination = var.ebs_vol_del_on_term + device_name = var.ebs_vol_device_name + encrypted = length(var.ebs_vol_snapshot_id) > 0 ? "" : var.ebs_vol_encrypted + iops = var.ebs_vol_type == "io1" ? var.ebs_vol_iops : "0" + snapshot_id = var.ebs_vol_snapshot_id + volume_size = length(var.ebs_vol_snapshot_id) > 0 ? "0" : var.ebs_vol_size + volume_type = var.ebs_vol_type } lifecycle { create_before_destroy = true } } + diff --git a/group/lc/outputs.tf b/group/lc/outputs.tf index 71b97af..5271632 100644 --- a/group/lc/outputs.tf +++ b/group/lc/outputs.tf @@ -1,9 +1,13 @@ # Outputs output "lc_id" { - value = "${coalesce(join(",",aws_launch_configuration.lc.*.id),join(",",aws_launch_configuration.lc_ebs.*.id))}" + value = coalesce( + join(",", aws_launch_configuration.lc.*.id), + join(",", aws_launch_configuration.lc_ebs.*.id), + ) } output "sg_id" { - value = "${aws_security_group.sg_asg.id}" + value = aws_security_group.sg_asg.id } + diff --git a/group/lc/variables.tf b/group/lc/variables.tf index 12939b8..5fb4b2b 100644 --- a/group/lc/variables.tf +++ b/group/lc/variables.tf @@ -2,108 +2,109 @@ ## Resource tags variable "stack_item_fullname" { - type = "string" + type = string } variable "stack_item_label" { - type = "string" + type = string } ## Allow override of resource naming variable "lc_sg_name_prefix_override" { - type = "string" + type = string } ## VPC parameters variable "vpc_id" { - type = "string" + type = string } ## LC parameters variable "associate_public_ip_address" { - type = "string" + type = string } variable "ami" { - type = "string" + type = string } variable "ebs_optimized" { - type = "string" + type = string } variable "ebs_vol_del_on_term" { - type = "string" + type = string } variable "ebs_vol_device_name" { - type = "string" + type = string } variable "ebs_vol_encrypted" { - type = "string" + type = string } variable "ebs_vol_snapshot_id" { - type = "string" + type = string } variable "ebs_vol_iops" { - type = "string" + type = string } variable "ebs_vol_size" { - type = "string" + type = string } variable "ebs_vol_type" { - type = "string" + type = string } variable "enable_monitoring" { - type = "string" + type = string } variable "instance_profile" { - type = "string" + type = string } variable "instance_type" { - type = "string" + type = string } variable "key_name" { - type = "string" + type = string } variable "placement_tenancy" { - type = "string" + type = string } variable "root_vol_del_on_term" { - type = "string" + type = string } variable "root_vol_iops" { - type = "string" + type = string } variable "root_vol_size" { - type = "string" + type = string } variable "root_vol_type" { - type = "string" + type = string } variable "security_groups" { - type = "list" + type = list(string) } variable "spot_price" { - type = "string" + type = string } variable "user_data" { - type = "string" + type = string } + diff --git a/group/lc/versions.tf b/group/lc/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/group/lc/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/group/main.tf b/group/main.tf index 319d4b6..b80719f 100644 --- a/group/main.tf +++ b/group/main.tf @@ -1,31 +1,27 @@ # AWS Auto Scaling Configuration -## Set Terraform version constraint -terraform { - required_version = "> 0.8.0" -} - ## Creates cloudconfig fragments for tagging -data "aws_region" "current" {} +data "aws_region" "current" { +} data "template_file" "name" { - template = "${var.instance_based_naming_enabled == "true" ? file("${path.module}/templates/name.tpl") : ""}" + template = var.instance_based_naming_enabled == "true" ? file("${path.module}/templates/name.tpl") : "" - vars { - name_prefix = "${length(var.instance_name_prefix) > 0 ? var.instance_name_prefix : var.stack_item_label}" - region = "${data.aws_region.current.name}" + vars = { + name_prefix = length(var.instance_name_prefix) > 0 ? var.instance_name_prefix : var.stack_item_label + region = data.aws_region.current.name } } data "template_file" "tags" { - count = "${length(keys(var.instance_tags))}" + count = length(keys(var.instance_tags)) - template = "${element(keys(var.instance_tags),count.index) != "" ? file("${path.module}/templates/tag.tpl") : ""}" + template = element(keys(var.instance_tags), count.index) != "" ? file("${path.module}/templates/tag.tpl") : "" - vars { - key = "${element(keys(var.instance_tags),count.index)}" - region = "${data.aws_region.current.name}" - value = "${lookup(var.instance_tags,element(keys(var.instance_tags),count.index))}" + vars = { + key = element(keys(var.instance_tags), count.index) + region = data.aws_region.current.name + value = var.instance_tags[element(keys(var.instance_tags), count.index)] } } @@ -35,18 +31,18 @@ data "template_cloudinit_config" "cloud_config" { part { content_type = "text/cloud-config" - content = "${var.user_data}" + content = var.user_data } part { content_type = "text/cloud-config" - content = "${data.template_file.name.rendered}" + content = data.template_file.name.rendered merge_type = "list(append)+dict(recurse_array)+str()" } part { content_type = "text/cloud-config" - content = "#cloud-config\nruncmd:\n${join("",data.template_file.tags.*.rendered)}" + content = "#cloud-config\nruncmd:\n${join("", data.template_file.tags.*.rendered)}" merge_type = "list(append)+dict(recurse_array)+str()" } } @@ -56,36 +52,36 @@ module "lc" { source = "./lc" ### Resource labels - stack_item_fullname = "${var.stack_item_fullname}" - stack_item_label = "${var.stack_item_label}" - lc_sg_name_prefix_override = "${var.lc_sg_name_prefix_override}" + stack_item_fullname = var.stack_item_fullname + stack_item_label = var.stack_item_label + lc_sg_name_prefix_override = var.lc_sg_name_prefix_override ### VPC parameters - vpc_id = "${var.vpc_id}" + vpc_id = var.vpc_id ### LC parameters - ami = "${var.ami}" - associate_public_ip_address = "${var.associate_public_ip_address}" - ebs_optimized = "${var.ebs_optimized}" - ebs_vol_del_on_term = "${var.ebs_vol_del_on_term}" - ebs_vol_device_name = "${var.ebs_vol_device_name}" - ebs_vol_encrypted = "${var.ebs_vol_encrypted}" - ebs_vol_iops = "${var.ebs_vol_iops}" - ebs_vol_size = "${var.ebs_vol_size}" - ebs_vol_snapshot_id = "${var.ebs_vol_snapshot_id}" - ebs_vol_type = "${var.ebs_vol_type}" - enable_monitoring = "${var.enable_monitoring}" - instance_profile = "${var.instance_profile}" - instance_type = "${var.instance_type}" - key_name = "${var.key_name}" - placement_tenancy = "${var.placement_tenancy}" - root_vol_del_on_term = "${var.root_vol_del_on_term}" - root_vol_iops = "${var.root_vol_iops}" - root_vol_size = "${var.root_vol_size}" - root_vol_type = "${var.root_vol_type}" - security_groups = ["${var.security_groups}"] - spot_price = "${var.spot_price}" - user_data = "${data.template_cloudinit_config.cloud_config.rendered}" + ami = var.ami + associate_public_ip_address = var.associate_public_ip_address + ebs_optimized = var.ebs_optimized + ebs_vol_del_on_term = var.ebs_vol_del_on_term + ebs_vol_device_name = var.ebs_vol_device_name + ebs_vol_encrypted = var.ebs_vol_encrypted + ebs_vol_iops = var.ebs_vol_iops + ebs_vol_size = var.ebs_vol_size + ebs_vol_snapshot_id = var.ebs_vol_snapshot_id + ebs_vol_type = var.ebs_vol_type + enable_monitoring = var.enable_monitoring + instance_profile = var.instance_profile + instance_type = var.instance_type + key_name = var.key_name + placement_tenancy = var.placement_tenancy + root_vol_del_on_term = var.root_vol_del_on_term + root_vol_iops = var.root_vol_iops + root_vol_size = var.root_vol_size + root_vol_type = var.root_vol_type + security_groups = [var.security_groups] + spot_price = var.spot_price + user_data = data.template_cloudinit_config.cloud_config.rendered } ## Creates auto scaling group @@ -93,37 +89,38 @@ module "asg" { source = "./asg" ### Resource tags - stack_item_label = "${var.stack_item_label}" - stack_item_fullname = "${var.stack_item_fullname}" - asg_name_override = "${var.asg_name_override}" - propagate_name_at_launch = "${var.propagate_name_at_launch}" + stack_item_label = var.stack_item_label + stack_item_fullname = var.stack_item_fullname + asg_name_override = var.asg_name_override + propagate_name_at_launch = var.propagate_name_at_launch ### VPC parameters - subnets = ["${var.subnets}"] + subnets = [var.subnets] ### LC parameters - lc_id = "${module.lc.lc_id}" + lc_id = module.lc.lc_id ### ASG parameters - default_cooldown = "${var.default_cooldown}" - desired_capacity = "${var.desired_capacity}" - enabled_metrics = ["${var.enabled_metrics}"] - force_delete = "${var.force_delete}" - hc_check_type = "${var.hc_check_type}" - hc_grace_period = "${var.hc_grace_period}" - max_size = "${var.max_size}" + default_cooldown = var.default_cooldown + desired_capacity = var.desired_capacity + enabled_metrics = [var.enabled_metrics] + force_delete = var.force_delete + hc_check_type = var.hc_check_type + hc_grace_period = var.hc_grace_period + max_size = var.max_size metrics_granularity = "1Minute" - min_size = "${var.min_size}" - placement_group = "${var.placement_group}" - protect_from_scale_in = "${var.protect_from_scale_in}" - suspended_processes = ["${var.suspended_processes}"] - termination_policies = ["${var.termination_policies}"] - wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}" - additional_asg_tags = "${var.additional_asg_tags}" + min_size = var.min_size + placement_group = var.placement_group + protect_from_scale_in = var.protect_from_scale_in + suspended_processes = [var.suspended_processes] + termination_policies = [var.termination_policies] + wait_for_capacity_timeout = var.wait_for_capacity_timeout + additional_asg_tags = var.additional_asg_tags ### ELB parameters - load_balancers = ["${var.load_balancers}"] - min_elb_capacity = "${var.min_elb_capacity}" - target_group_arns = ["${var.target_group_arns}"] - wait_for_elb_capacity = "${var.wait_for_elb_capacity}" + load_balancers = [var.load_balancers] + min_elb_capacity = var.min_elb_capacity + target_group_arns = [var.target_group_arns] + wait_for_elb_capacity = var.wait_for_elb_capacity } + diff --git a/group/outputs.tf b/group/outputs.tf index 847616b..c4a3c9e 100644 --- a/group/outputs.tf +++ b/group/outputs.tf @@ -1,17 +1,18 @@ # Outputs output "asg_id" { - value = "${module.asg.asg_id}" + value = module.asg.asg_id } output "asg_name" { - value = "${module.asg.asg_name}" + value = module.asg.asg_name } output "lc_id" { - value = "${module.lc.lc_id}" + value = module.lc.lc_id } output "sg_id" { - value = "${module.lc.sg_id}" + value = module.lc.sg_id } + diff --git a/group/variables.tf b/group/variables.tf index 720e288..1be0c9d 100644 --- a/group/variables.tf +++ b/group/variables.tf @@ -2,76 +2,76 @@ ## Resource tags variable "stack_item_fullname" { - type = "string" + type = string description = "Long form descriptive name for this stack item. This value is used to create the 'application' resource tag for resources created by this stack item." } variable "stack_item_label" { - type = "string" + type = string description = "Short form identifier for this stack. This value is used to create the 'Name' resource tag for resources created by this stack item, and also serves as a unique key for re-use." } variable "asg_name_override" { - type = "string" + type = string description = "A string to override the ASG name" default = "" } variable "lc_sg_name_prefix_override" { - type = "string" + type = string description = "A string to override the ASG name" default = "" } variable "propagate_name_at_launch" { - type = "string" + type = string description = "A string to override the ASG name" default = "true" } ## VPC parameters variable "subnets" { - type = "list" + type = list(string) description = "A list of subnet IDs to launch resources in" } variable "vpc_id" { - type = "string" + type = string description = "ID of the target VPC." } ## LC parameters variable "ami" { - type = "string" + type = string description = "Amazon Machine Image (AMI) to associate with the launch configuration." } variable "associate_public_ip_address" { - type = "string" + type = string description = "Flag for associating public IP addresses with instances managed by the auto scaling group." default = "" } variable "ebs_optimized" { - type = "string" + type = string description = "Flag to enable EBS optimization." default = "false" } variable "ebs_vol_del_on_term" { - type = "string" + type = string description = "Whether the volume should be destroyed on instance termination." default = "true" } variable "ebs_vol_device_name" { - type = "string" + type = string description = "The name of the device to mount." default = "" } variable "ebs_vol_encrypted" { - type = "string" + type = string description = "Whether the volume should be encrypted or not. Do not use this option if you are using 'snapshot_id' as the encrypted flag will be determined by the snapshot." default = "" } @@ -81,55 +81,55 @@ http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html For the best per-I/O latency experience, we recommend that you provision an IOPS-to-GiB ratio greater than 2:1. For example, a 2,000 IOPS volume should be smaller than 1,000 GiB. */ variable "ebs_vol_iops" { - type = "string" + type = string description = "The amount of provisioned IOPS" default = "2000" } variable "ebs_vol_size" { - type = "string" + type = string description = "The size of the volume in gigabytes." default = "" } variable "ebs_vol_snapshot_id" { - type = "string" + type = string description = "The Snapshot ID to mount." default = "" } variable "ebs_vol_type" { - type = "string" + type = string description = "The type of volume. Valid values are 'standard', 'gp2' and 'io1'." default = "gp2" } variable "enable_monitoring" { - type = "string" + type = string description = "Flag to enable detailed monitoring." default = "" } variable "instance_based_naming_enabled" { - type = "string" + type = string description = "Flag to enable instance-id based name tagging." default = "" } variable "instance_name_prefix" { - type = "string" + type = string description = "Sring to prepend instance-id based name tags with." default = "" } variable "instance_profile" { - type = "string" + type = string description = "IAM instance profile to associate with the launch configuration." default = "" } variable "instance_tags" { - type = "map" + type = map(string) description = "Map of tags to add to isntances." default = { @@ -138,24 +138,24 @@ variable "instance_tags" { } variable "instance_type" { - type = "string" + type = string description = "EC2 instance type to associate with the launch configuration." } variable "key_name" { - type = "string" + type = string description = "SSH key pair to associate with the launch configuration." default = "" } variable "placement_tenancy" { - type = "string" + type = string description = "The tenancy of the instance. Valid values are 'default' or 'dedicated'." default = "default" } variable "root_vol_del_on_term" { - type = "string" + type = string description = "Whether the volume should be destroyed on instance termination." default = "true" } @@ -165,145 +165,146 @@ http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html For the best per-I/O latency experience, we recommend that you provision an IOPS-to-GiB ratio greater than 2:1. For example, a 2,000 IOPS volume should be smaller than 1,000 GiB. */ variable "root_vol_iops" { - type = "string" + type = string description = "The amount of provisioned IOPS" default = "2000" } variable "root_vol_size" { - type = "string" + type = string description = "The size of the volume in gigabytes." default = "" } variable "root_vol_type" { - type = "string" + type = string description = "The type of volume. Valid values are 'standard', 'gp2' and 'io1'." default = "gp2" } variable "security_groups" { - type = "list" + type = list(string) description = "A list of associated security group IDs" default = [] } variable "spot_price" { - type = "string" + type = string description = "The price to use for reserving spot instances." default = "" } variable "user_data" { - type = "string" + type = string description = "Instance initialization data to associate with the launch configuration." default = "" } ## ASG parameters variable "additional_asg_tags" { - type = "list" + type = list(string) description = "Additional tags to apply at the ASG level, if any" default = [] } variable "default_cooldown" { - type = "string" + type = string description = "The amount of time, in seconds, after a scaling activity completes before another scaling activity can start." default = "" } variable "desired_capacity" { - type = "string" + type = string description = "The number of Amazon EC2 instances that should be running in the group." default = "" } variable "enabled_metrics" { - type = "list" + type = list(string) description = "A list of metrics to collect. The allowed values are 'GroupMinSize', 'GroupMaxSize', 'GroupDesiredCapacity', 'GroupInServiceInstances', 'GroupPendingInstances', 'GroupStandbyInstances', 'GroupTerminatingInstances', 'GroupTotalInstances'." default = [] } variable "force_delete" { - type = "string" + type = string description = "Flag to allow deletion of the auto scaling group without waiting for all instances in the pool to terminate." default = "false" } variable "hc_check_type" { - type = "string" + type = string description = "Type of health check performed by the auto scaling group. Valid values are 'ELB' or 'EC2'." default = "" } variable "hc_grace_period" { - type = "string" + type = string description = "Time allowed after an instance comes into service before checking health." default = "" } variable "max_size" { - type = "string" + type = string description = "Maximum number of instances allowed by the auto scaling group." } variable "min_size" { - type = "string" + type = string description = "Minimum number of instance to be maintained by the auto scaling group." } variable "placement_group" { - type = "string" + type = string description = "The name of the placement group into which you'll launch your instances, if any." default = "" } variable "protect_from_scale_in" { - type = "string" + type = string description = "Allows setting instance protection. The autoscaling group will not select instances with this setting for terminination during scale in events." default = "" } variable "suspended_processes" { - type = "list" + type = list(string) description = "A list of processes to suspend for the AutoScaling Group. The allowed values are 'Launch', 'Terminate', 'HealthCheck', 'ReplaceUnhealthy', 'AZRebalance', 'AlarmNotification', 'ScheduledActions', 'AddToLoadBalancer'. Note that if you suspend either the 'Launch' or 'Terminate' process types, it can prevent your autoscaling group from functioning properly." default = [] } variable "termination_policies" { - type = "list" + type = list(string) description = "A list of policies to decide how the instances in the auto scale group should be terminated. The allowed values are 'OldestInstance', 'NewestInstance', 'OldestLaunchConfiguration', 'ClosestToNextInstanceHour', 'Default'." default = [] } variable "wait_for_capacity_timeout" { - type = "string" + type = string description = "A maximum duration that Terraform should wait for ASG managed instances to become healthy before timing out." default = "" } ## ELB parameters variable "load_balancers" { - type = "list" + type = list(string) description = "List of load balancer names to associate with the auto scaling group." default = [] } variable "min_elb_capacity" { - type = "string" + type = string description = "Minimum number of healthy instances attached to the ELB that must be maintained during updates." default = "" } variable "target_group_arns" { - type = "list" + type = list(string) description = "A list of 'aws_alb_target_group' ARNs, for use with Application Load Balancing" default = [] } variable "wait_for_elb_capacity" { - type = "string" + type = string description = "Setting this will cause Terraform to wait for exactly this number of healthy instances in all attached load balancers on both create and update operations. (Takes precedence over 'min_elb_capacity' behavior.)" default = "" } + diff --git a/group/versions.tf b/group/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/group/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} From 3609edf1ad903365737dffd0dcd5b824aee65afc Mon Sep 17 00:00:00 2001 From: torz Date: Fri, 4 Oct 2019 16:40:44 +0100 Subject: [PATCH 03/15] fix sg arg --- group/main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/group/main.tf b/group/main.tf index b80719f..d81ba9e 100644 --- a/group/main.tf +++ b/group/main.tf @@ -79,7 +79,7 @@ module "lc" { root_vol_iops = var.root_vol_iops root_vol_size = var.root_vol_size root_vol_type = var.root_vol_type - security_groups = [var.security_groups] + security_groups = var.security_groups spot_price = var.spot_price user_data = data.template_cloudinit_config.cloud_config.rendered } @@ -123,4 +123,3 @@ module "asg" { target_group_arns = [var.target_group_arns] wait_for_elb_capacity = var.wait_for_elb_capacity } - From e41af784ef0f434ba6c077780b6e072ce4c9719e Mon Sep 17 00:00:00 2001 From: torz Date: Fri, 4 Oct 2019 16:57:07 +0100 Subject: [PATCH 04/15] fix list var --- group/main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/group/main.tf b/group/main.tf index b80719f..d81ba9e 100644 --- a/group/main.tf +++ b/group/main.tf @@ -79,7 +79,7 @@ module "lc" { root_vol_iops = var.root_vol_iops root_vol_size = var.root_vol_size root_vol_type = var.root_vol_type - security_groups = [var.security_groups] + security_groups = var.security_groups spot_price = var.spot_price user_data = data.template_cloudinit_config.cloud_config.rendered } @@ -123,4 +123,3 @@ module "asg" { target_group_arns = [var.target_group_arns] wait_for_elb_capacity = var.wait_for_elb_capacity } - From 20f420536cf4d648f4c8217e7df9f4d2d0b51cdb Mon Sep 17 00:00:00 2001 From: torz Date: Mon, 7 Oct 2019 10:34:35 +0100 Subject: [PATCH 05/15] update asg/ to 0.12 --- group/asg/main.tf | 91 +++++++++++++++++++++--------------------- group/asg/outputs.tf | 11 ++++- group/asg/variables.tf | 51 +++++++++++------------ group/asg/versions.tf | 4 ++ 4 files changed, 85 insertions(+), 72 deletions(-) create mode 100644 group/asg/versions.tf diff --git a/group/asg/main.tf b/group/asg/main.tf index 50979db..3c2ec2e 100644 --- a/group/asg/main.tf +++ b/group/asg/main.tf @@ -5,13 +5,13 @@ locals { default_asg_tags = [ { key = "application" - value = "${var.stack_item_fullname}" + value = var.stack_item_fullname propagate_at_launch = true }, { key = "Name" - value = "${length(var.asg_name_override) > 0 ? var.asg_name_override : var.stack_item_label}" - propagate_at_launch = "${var.propagate_name_at_launch}" + value = length(var.asg_name_override) > 0 ? var.asg_name_override : var.stack_item_label + propagate_at_launch = var.propagate_name_at_launch }, { key = "managed_by" @@ -22,54 +22,55 @@ locals { } resource "aws_autoscaling_group" "asg" { - count = "${length(var.min_elb_capacity) > 0 || length(var.wait_for_elb_capacity) > 0 ? 0 : 1}" + count = length(var.min_elb_capacity) > 0 || length(var.wait_for_elb_capacity) > 0 ? 0 : 1 - default_cooldown = "${length(var.default_cooldown) > 0 ? var.default_cooldown : "300"}" - desired_capacity = "${length(var.desired_capacity) > 0 ? var.desired_capacity : var.min_size}" - enabled_metrics = ["${compact(var.enabled_metrics)}"] - force_delete = "${var.force_delete}" - health_check_grace_period = "${length(var.hc_grace_period) > 0 ? var.hc_grace_period : "300"}" + default_cooldown = length(var.default_cooldown) > 0 ? var.default_cooldown : "300" + desired_capacity = length(var.desired_capacity) > 0 ? var.desired_capacity : var.min_size + enabled_metrics = compact(var.enabled_metrics) + force_delete = var.force_delete + health_check_grace_period = length(var.hc_grace_period) > 0 ? var.hc_grace_period : "300" health_check_type = "EC2" - launch_configuration = "${var.lc_id}" - max_size = "${var.max_size}" - metrics_granularity = "${var.metrics_granularity}" - min_size = "${var.min_size}" - name = "${length(var.asg_name_override) > 0 ? var.asg_name_override : var.stack_item_label}" - placement_group = "${var.placement_group}" - protect_from_scale_in = "${var.protect_from_scale_in}" - suspended_processes = ["${compact(var.suspended_processes)}"] - target_group_arns = ["${compact(var.target_group_arns)}"] - termination_policies = ["${compact(var.termination_policies)}"] - vpc_zone_identifier = ["${compact(var.subnets)}"] - wait_for_capacity_timeout = "${length(var.wait_for_capacity_timeout) > 0 ? var.wait_for_capacity_timeout : "10m"}" + launch_configuration = var.lc_id + max_size = var.max_size + metrics_granularity = var.metrics_granularity + min_size = var.min_size + name = length(var.asg_name_override) > 0 ? var.asg_name_override : var.stack_item_label + placement_group = var.placement_group + protect_from_scale_in = var.protect_from_scale_in + suspended_processes = compact(var.suspended_processes) + target_group_arns = compact(var.target_group_arns) + termination_policies = compact(var.termination_policies) + vpc_zone_identifier = compact(var.subnets) + wait_for_capacity_timeout = length(var.wait_for_capacity_timeout) > 0 ? var.wait_for_capacity_timeout : "10m" - tags = "${concat(local.default_asg_tags, var.additional_asg_tags)}" + tags = concat(local.default_asg_tags, var.additional_asg_tags) } resource "aws_autoscaling_group" "asg_elb" { - count = "${length(var.min_elb_capacity) > 0 || length(var.wait_for_elb_capacity) > 0 ? 1 : 0}" + count = length(var.min_elb_capacity) > 0 || length(var.wait_for_elb_capacity) > 0 ? 1 : 0 - default_cooldown = "${length(var.default_cooldown) > 0 ? var.default_cooldown : "300"}" - desired_capacity = "${length(var.desired_capacity) > 0 ? var.desired_capacity : var.min_size}" - enabled_metrics = ["${compact(var.enabled_metrics)}"] - force_delete = "${var.force_delete}" - health_check_grace_period = "${length(var.hc_grace_period) > 0 ? var.hc_grace_period : "300"}" - health_check_type = "${length(var.hc_check_type) > 0 ? var.hc_check_type : "ELB"}" - launch_configuration = "${var.lc_id}" - load_balancers = ["${compact(var.load_balancers)}"] - max_size = "${var.max_size}" - metrics_granularity = "${var.metrics_granularity}" - min_elb_capacity = "${length(var.min_elb_capacity) > 0 ? var.min_elb_capacity : "0"}" - min_size = "${var.min_size}" - name = "${length(var.asg_name_override) > 0 ? var.asg_name_override : var.stack_item_label}" - placement_group = "${var.placement_group}" - protect_from_scale_in = "${var.protect_from_scale_in}" - suspended_processes = ["${compact(var.suspended_processes)}"] - target_group_arns = ["${compact(var.target_group_arns)}"] - termination_policies = ["${compact(var.termination_policies)}"] - vpc_zone_identifier = ["${compact(var.subnets)}"] - wait_for_capacity_timeout = "${length(var.wait_for_capacity_timeout) > 0 ? var.wait_for_capacity_timeout : "10m"}" - wait_for_elb_capacity = "${length(var.wait_for_elb_capacity) > 0 ? var.wait_for_elb_capacity : "0"}" + default_cooldown = length(var.default_cooldown) > 0 ? var.default_cooldown : "300" + desired_capacity = length(var.desired_capacity) > 0 ? var.desired_capacity : var.min_size + enabled_metrics = compact(var.enabled_metrics) + force_delete = var.force_delete + health_check_grace_period = length(var.hc_grace_period) > 0 ? var.hc_grace_period : "300" + health_check_type = length(var.hc_check_type) > 0 ? var.hc_check_type : "ELB" + launch_configuration = var.lc_id + load_balancers = compact(var.load_balancers) + max_size = var.max_size + metrics_granularity = var.metrics_granularity + min_elb_capacity = length(var.min_elb_capacity) > 0 ? var.min_elb_capacity : "0" + min_size = var.min_size + name = length(var.asg_name_override) > 0 ? var.asg_name_override : var.stack_item_label + placement_group = var.placement_group + protect_from_scale_in = var.protect_from_scale_in + suspended_processes = compact(var.suspended_processes) + target_group_arns = compact(var.target_group_arns) + termination_policies = compact(var.termination_policies) + vpc_zone_identifier = compact(var.subnets) + wait_for_capacity_timeout = length(var.wait_for_capacity_timeout) > 0 ? var.wait_for_capacity_timeout : "10m" + wait_for_elb_capacity = length(var.wait_for_elb_capacity) > 0 ? var.wait_for_elb_capacity : "0" - tags = "${concat(local.default_asg_tags, var.additional_asg_tags)}" + tags = concat(local.default_asg_tags, var.additional_asg_tags) } + diff --git a/group/asg/outputs.tf b/group/asg/outputs.tf index 9a7eef7..35d1c18 100644 --- a/group/asg/outputs.tf +++ b/group/asg/outputs.tf @@ -1,9 +1,16 @@ # Outputs output "asg_id" { - value = "${coalesce(join(",",aws_autoscaling_group.asg.*.id),join(",",aws_autoscaling_group.asg_elb.*.id))}" + value = coalesce( + join(",", aws_autoscaling_group.asg.*.id), + join(",", aws_autoscaling_group.asg_elb.*.id), + ) } output "asg_name" { - value = "${coalesce(join(",",aws_autoscaling_group.asg.*.name),join(",",aws_autoscaling_group.asg_elb.*.name))}" + value = coalesce( + join(",", aws_autoscaling_group.asg.*.name), + join(",", aws_autoscaling_group.asg_elb.*.name), + ) } + diff --git a/group/asg/variables.tf b/group/asg/variables.tf index 0cf21c2..ae80465 100644 --- a/group/asg/variables.tf +++ b/group/asg/variables.tf @@ -2,109 +2,110 @@ ## Resource tags variable "stack_item_fullname" { - type = "string" + type = string } variable "stack_item_label" { - type = "string" + type = string } variable "additional_asg_tags" { - type = "list" + type = list(string) default = [] } ## Allow override of resource naming variable "asg_name_override" { - type = "string" + type = string } variable "propagate_name_at_launch" { - type = "string" + type = string default = "true" } ## VPC parameters variable "subnets" { - type = "list" + type = list(string) } ## LC parameters variable "lc_id" { - type = "string" + type = string } ## ASG parameters variable "default_cooldown" { - type = "string" + type = string } variable "desired_capacity" { - type = "string" + type = string } variable "enabled_metrics" { - type = "list" + type = list(string) } variable "force_delete" { - type = "string" + type = string } variable "hc_check_type" { - type = "string" + type = string } variable "hc_grace_period" { - type = "string" + type = string } variable "max_size" { - type = "string" + type = string } variable "metrics_granularity" { - type = "string" + type = string } variable "min_size" { - type = "string" + type = string } variable "placement_group" { - type = "string" + type = string } variable "protect_from_scale_in" { - type = "string" + type = string } variable "suspended_processes" { - type = "list" + type = list(string) } variable "termination_policies" { - type = "list" + type = list(string) } variable "wait_for_capacity_timeout" { - type = "string" + type = string } ## ELB parameters variable "load_balancers" { - type = "list" + type = list(string) } variable "min_elb_capacity" { - type = "string" + type = string } variable "target_group_arns" { - type = "list" + type = list(string) } variable "wait_for_elb_capacity" { - type = "string" + type = string } + diff --git a/group/asg/versions.tf b/group/asg/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/group/asg/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} From c76b52761ef75d2f196f72c412b899e5243969e1 Mon Sep 17 00:00:00 2001 From: torz Date: Mon, 7 Oct 2019 10:42:14 +0100 Subject: [PATCH 06/15] remove [s from resource properties --- group/main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/group/main.tf b/group/main.tf index d81ba9e..a9b9a74 100644 --- a/group/main.tf +++ b/group/main.tf @@ -103,7 +103,7 @@ module "asg" { ### ASG parameters default_cooldown = var.default_cooldown desired_capacity = var.desired_capacity - enabled_metrics = [var.enabled_metrics] + enabled_metrics = var.enabled_metrics force_delete = var.force_delete hc_check_type = var.hc_check_type hc_grace_period = var.hc_grace_period @@ -112,14 +112,14 @@ module "asg" { min_size = var.min_size placement_group = var.placement_group protect_from_scale_in = var.protect_from_scale_in - suspended_processes = [var.suspended_processes] - termination_policies = [var.termination_policies] + suspended_processes = var.suspended_processes + termination_policies = var.termination_policies wait_for_capacity_timeout = var.wait_for_capacity_timeout additional_asg_tags = var.additional_asg_tags ### ELB parameters - load_balancers = [var.load_balancers] + load_balancers = var.load_balancers min_elb_capacity = var.min_elb_capacity - target_group_arns = [var.target_group_arns] + target_group_arns = var.target_group_arns wait_for_elb_capacity = var.wait_for_elb_capacity } From 812db62f3c3468201215394733c7d7baaf703253 Mon Sep 17 00:00:00 2001 From: torz Date: Mon, 7 Oct 2019 10:52:10 +0100 Subject: [PATCH 07/15] fix subnet prop --- group/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/group/main.tf b/group/main.tf index a9b9a74..05f19b2 100644 --- a/group/main.tf +++ b/group/main.tf @@ -95,7 +95,7 @@ module "asg" { propagate_name_at_launch = var.propagate_name_at_launch ### VPC parameters - subnets = [var.subnets] + subnets = var.subnets ### LC parameters lc_id = module.lc.lc_id From 3fe1e35fd7fa1cef3966bad6e52ebe298ec8bd5d Mon Sep 17 00:00:00 2001 From: torz Date: Tue, 8 Oct 2019 15:36:51 +0100 Subject: [PATCH 08/15] fixed bool for protect_from_scale_in var --- group/asg/variables.tf | 2 +- group/variables.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/group/asg/variables.tf b/group/asg/variables.tf index ae80465..2628e25 100644 --- a/group/asg/variables.tf +++ b/group/asg/variables.tf @@ -77,7 +77,7 @@ variable "placement_group" { } variable "protect_from_scale_in" { - type = string + type = bool } variable "suspended_processes" { diff --git a/group/variables.tf b/group/variables.tf index 1be0c9d..985b2c4 100644 --- a/group/variables.tf +++ b/group/variables.tf @@ -260,9 +260,9 @@ variable "placement_group" { } variable "protect_from_scale_in" { - type = string + type = bool description = "Allows setting instance protection. The autoscaling group will not select instances with this setting for terminination during scale in events." - default = "" + default = false } variable "suspended_processes" { From cd8d561fd70bf9493e3976db772e0b1b684f2344 Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 17 Oct 2019 10:48:15 +0100 Subject: [PATCH 09/15] encrypt root ebs option --- group/lc/main.tf | 1 + group/lc/variables.tf | 5 +++++ group/main.tf | 1 + group/variables.tf | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/group/lc/main.tf b/group/lc/main.tf index 1145264..8a26c4f 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -41,6 +41,7 @@ resource "aws_launch_configuration" "lc" { iops = var.root_vol_type == "io1" ? var.root_vol_iops : "0" volume_size = length(var.root_vol_size) > 0 ? var.root_vol_size : "8" volume_type = var.root_vol_type + encrypted = var.root_vol_encrypted } lifecycle { diff --git a/group/lc/variables.tf b/group/lc/variables.tf index 5fb4b2b..79d30d9 100644 --- a/group/lc/variables.tf +++ b/group/lc/variables.tf @@ -96,6 +96,11 @@ variable "root_vol_type" { type = string } +variable "root_vol_encrypted" { + type = bool + default = false +} + variable "security_groups" { type = list(string) } diff --git a/group/main.tf b/group/main.tf index 05f19b2..5292804 100644 --- a/group/main.tf +++ b/group/main.tf @@ -79,6 +79,7 @@ module "lc" { root_vol_iops = var.root_vol_iops root_vol_size = var.root_vol_size root_vol_type = var.root_vol_type + root_vol_encrypted = var.root_vol_encrypted security_groups = var.security_groups spot_price = var.spot_price user_data = data.template_cloudinit_config.cloud_config.rendered diff --git a/group/variables.tf b/group/variables.tf index 985b2c4..e416387 100644 --- a/group/variables.tf +++ b/group/variables.tf @@ -182,6 +182,11 @@ variable "root_vol_type" { default = "gp2" } +variable "root_vol_encrypted" { + type = bool + default = false +} + variable "security_groups" { type = list(string) description = "A list of associated security group IDs" From 3c79038857abcf72653af32914e7bf735cb9fc43 Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 17 Oct 2019 10:56:58 +0100 Subject: [PATCH 10/15] no ebs if not set --- group/lc/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/group/lc/main.tf b/group/lc/main.tf index 8a26c4f..2ba8657 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -44,6 +44,8 @@ resource "aws_launch_configuration" "lc" { encrypted = var.root_vol_encrypted } + ebs_block_device {} + lifecycle { create_before_destroy = true } From b5f99b87210ef8047a81f69bd98135dbcce3e4cd Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 17 Oct 2019 11:11:12 +0100 Subject: [PATCH 11/15] ebs hacks --- group/lc/main.tf | 3 --- 1 file changed, 3 deletions(-) diff --git a/group/lc/main.tf b/group/lc/main.tf index 2ba8657..0211318 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -22,7 +22,6 @@ resource "aws_launch_configuration" "lc" { count = length(var.ebs_vol_device_name) > 0 ? 0 : 1 associate_public_ip_address = var.associate_public_ip_address - ebs_optimized = var.ebs_optimized enable_monitoring = var.enable_monitoring iam_instance_profile = var.instance_profile image_id = var.ami @@ -44,8 +43,6 @@ resource "aws_launch_configuration" "lc" { encrypted = var.root_vol_encrypted } - ebs_block_device {} - lifecycle { create_before_destroy = true } From 0d1580e150621a9bd84a1b1385618870005fad8e Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 17 Oct 2019 11:32:07 +0100 Subject: [PATCH 12/15] ignore changes to ebs --- group/lc/main.tf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/group/lc/main.tf b/group/lc/main.tf index 0211318..13900bc 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -22,6 +22,7 @@ resource "aws_launch_configuration" "lc" { count = length(var.ebs_vol_device_name) > 0 ? 0 : 1 associate_public_ip_address = var.associate_public_ip_address + ebs_optimized = var.ebs_optimized enable_monitoring = var.enable_monitoring iam_instance_profile = var.instance_profile image_id = var.ami @@ -43,6 +44,10 @@ resource "aws_launch_configuration" "lc" { encrypted = var.root_vol_encrypted } + lifecycle { + ignore_changes = ["ebs_block_device"] + } + lifecycle { create_before_destroy = true } From fc2f7b7c7bdf01703cf2c234a6fb73ea333221d4 Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 17 Oct 2019 11:34:31 +0100 Subject: [PATCH 13/15] remove duplicate --- group/lc/main.tf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/group/lc/main.tf b/group/lc/main.tf index 13900bc..921b6bd 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -44,12 +44,9 @@ resource "aws_launch_configuration" "lc" { encrypted = var.root_vol_encrypted } - lifecycle { - ignore_changes = ["ebs_block_device"] - } - lifecycle { create_before_destroy = true + ignore_changes = ["ebs_block_device"] } } From f5c8ee273194cc2d6c7c1b5ec2ebc5ee8072e617 Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 17 Oct 2019 11:43:39 +0100 Subject: [PATCH 14/15] ignore all the things --- group/lc/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/group/lc/main.tf b/group/lc/main.tf index 921b6bd..52fdc62 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -87,6 +87,7 @@ resource "aws_launch_configuration" "lc_ebs" { lifecycle { create_before_destroy = true + ignore_changes = ["ebs_block_device"] } } From 43b7d8e9223da0e66d7c81436d85d0a0fa824410 Mon Sep 17 00:00:00 2001 From: torz Date: Thu, 17 Oct 2019 12:01:12 +0100 Subject: [PATCH 15/15] these are not the properties you are looking for --- group/lc/main.tf | 2 -- 1 file changed, 2 deletions(-) diff --git a/group/lc/main.tf b/group/lc/main.tf index 52fdc62..8a26c4f 100644 --- a/group/lc/main.tf +++ b/group/lc/main.tf @@ -46,7 +46,6 @@ resource "aws_launch_configuration" "lc" { lifecycle { create_before_destroy = true - ignore_changes = ["ebs_block_device"] } } @@ -87,7 +86,6 @@ resource "aws_launch_configuration" "lc_ebs" { lifecycle { create_before_destroy = true - ignore_changes = ["ebs_block_device"] } }