| index 21afdcbca..8c0966392 100644 |
| --- a/infra/modules/region-host/main.tf |
| +++ b/infra/modules/region-host/main.tf |
| @@ -9,6 +9,8 @@ |
| # not include this region's bucket — a wrong-region wake fails loudly at |
| # the IAM layer. |
| |
| +data "aws_region" "current" {} |
| + |
| data "aws_ami" "debian_arm64" { |
| most_recent = true |
| owners = [var.ami_owner] |
| @@ -180,3 +182,21 @@ resource "aws_eip" "host" { |
| instance = aws_instance.host.id |
| tags = { Name = var.name } |
| } |
| + |
| +# HA ladder rung 0 (2026-08-12 spec): system-status failure recovers the |
| +# instance onto healthy hardware, keeping instance id, EIP and volumes. |
| +resource "aws_cloudwatch_metric_alarm" "host_auto_recover" { |
| + count = var.enable_auto_recovery ? 1 : 0 |
| + alarm_name = "${var.name}-auto-recover" |
| + namespace = "AWS/EC2" |
| + metric_name = "StatusCheckFailed_System" |
| + statistic = "Maximum" |
| + period = 60 |
| + evaluation_periods = 2 |
| + threshold = 1 |
| + comparison_operator = "GreaterThanOrEqualToThreshold" |
| + alarm_actions = ["arn:aws:automate:${data.aws_region.current.name}:ec2:recover"] |
| + dimensions = { |
| + InstanceId = aws_instance.host.id |
| + } |
| +} |