diff --git a/README.md b/README.md index ba58a8f..e16fd8b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ module "fck-nat" { vpc_id = "vpc-abc1234" subnet_id = "subnet-abc1234" # ha_mode = true # Enables high-availability mode - # ha_mode_enabled_metrics = ["GroupInServiceInstances"] # Enables specified Cloudwatch metrics collection for high-availability mode # eip_allocation_ids = ["eipalloc-abc1234"] # Allocation ID of an existing EIP # use_cloudwatch_agent = true # Enables Cloudwatch agent and have metrics reported @@ -79,7 +78,6 @@ module "fck-nat" { | [eip\_allocation\_ids](#input\_eip\_allocation\_ids) | EIP allocation IDs to use for the NAT instance. Automatically assign a public IP if none is provided. Note: Currently only supports at most one EIP allocation. | `list(string)` | `[]` | no | | [encryption](#input\_encryption) | Whether or not to encrypt the EBS volume | `bool` | `true` | no | | [ha\_mode](#input\_ha\_mode) | Whether or not high-availability mode should be enabled via autoscaling group | `bool` | `true` | no | -| [ha\_mode\_enabled\_metrics](#input\_ha\_mode\_enabled\_metrics) | Whether or not to enable autoscaling group cloudwatch metrics collection for specified metrics. Disabled by default or when no metrics were provided | `list(string)` | `[]` | no | | [instance\_type](#input\_instance\_type) | Instance type to use for the NAT instance | `string` | `"t4g.micro"` | no | | [kms\_key\_id](#input\_kms\_key\_id) | Will use the provided KMS key ID to encrypt the EBS volume. Uses the default KMS key if none provided | `string` | `null` | no | | [name](#input\_name) | Name used for resources created within the module | `string` | n/a | yes | @@ -115,4 +113,4 @@ module "fck-nat" { | [security\_group\_id](#output\_security\_group\_id) | Deprecated. The ID of the security group used by fck-nat ENIs | | [security\_group\_ids](#output\_security\_group\_ids) | List of security group IDs used by fck-nat ENIs | | [subnet\_id](#output\_subnet\_id) | Subnet ID to which the fck-nat instance is deployed into | -| [vpc\_id](#output\_vpc\_id) | VPC ID to which the fck-nat instance is deployed into | \ No newline at end of file +| [vpc\_id](#output\_vpc\_id) | VPC ID to which the fck-nat instance is deployed into | diff --git a/asg.tf b/asg.tf index 4c895b9..641dea1 100644 --- a/asg.tf +++ b/asg.tf @@ -1,7 +1,3 @@ -locals { - asg_cw_metrics_enabled = length(var.ha_mode_enabled_metrics) >= 1 -} - resource "aws_autoscaling_group" "main" { count = var.ha_mode ? 1 : 0 @@ -12,8 +8,6 @@ resource "aws_autoscaling_group" "main" { health_check_type = "EC2" vpc_zone_identifier = [var.subnet_id] - enabled_metrics = local.asg_cw_metrics_enabled ? var.ha_mode_enabled_metrics : null - launch_template { id = aws_launch_template.main.id version = "$Latest" @@ -35,6 +29,29 @@ resource "aws_autoscaling_group" "main" { } } + enabled_metrics = [ + "GroupMinSize", + "GroupMaxSize", + "GroupDesiredCapacity", + "GroupInServiceInstances", + "GroupPendingInstances", + "GroupStandbyInstances", + "GroupTerminatingInstances", + "GroupTotalInstances", + "GroupInServiceCapacity", + "GroupPendingCapacity", + "GroupStandbyCapacity", + "GroupTerminatingCapacity", + "GroupTotalCapacity", + "WarmPoolDesiredCapacity", + "WarmPoolWarmedCapacity", + "WarmPoolPendingCapacity", + "WarmPoolTerminatingCapacity", + "WarmPoolTotalCapacity", + "GroupAndWarmPoolDesiredCapacity", + "GroupAndWarmPoolTotalCapacity" + ] + timeouts { delete = "15m" } diff --git a/docs/header.md b/docs/header.md index 4896da7..b7fd0a0 100644 --- a/docs/header.md +++ b/docs/header.md @@ -22,7 +22,6 @@ module "fck-nat" { vpc_id = "vpc-abc1234" subnet_id = "subnet-abc1234" # ha_mode = true # Enables high-availability mode - # ha_mode_enabled_metrics = ["GroupInServiceInstances"] # Enables specified Cloudwatch metrics collection for high-availability mode # eip_allocation_ids = ["eipalloc-abc1234"] # Allocation ID of an existing EIP # use_cloudwatch_agent = true # Enables Cloudwatch agent and have metrics reported diff --git a/examples/full/main.tf b/examples/full/main.tf index 9aa0afd..0943ad9 100644 --- a/examples/full/main.tf +++ b/examples/full/main.tf @@ -12,9 +12,6 @@ module "fck-nat" { vpc_id = aws_vpc.main.id subnet_id = aws_subnet.public.id ha_mode = true - ha_mode_enabled_metrics = [ - "GroupInServiceInstances" - ] update_route_tables = true route_tables_ids = { diff --git a/variables.tf b/variables.tf index 0789a16..8d01029 100644 --- a/variables.tf +++ b/variables.tf @@ -55,12 +55,6 @@ variable "ha_mode" { default = true } -variable "ha_mode_enabled_metrics" { - description = "Whether or not to enable autoscaling group cloudwatch metrics collection for specified metrics. Disabled by default or when no metrics were provided" - type = list(string) - default = [] -} - variable "instance_type" { description = "Instance type to use for the NAT instance" type = string