forgejo/terraform/data.tf
Adam Moussa e4982b87ad
feat(terraform): migrate forgejo to HCP Terraform (PLAT-80) (#100)
* feat(terraform): migrate forgejo to HCP Terraform

Move the prod host onto workspace forgejo-prod in the After Hours VPC and freeze CDK push deploys so cutover can happen without applying into seahaven-prod.

* fix(terraform): restore forgejo.db from the dump tarball

Boot restore was copying data/ and repos/ and leaving the sqlite file at the archive root, so a volume restore started Forgejo with no database.
2026-09-29 22:49:21 +00:00

33 lines
887 B
HCL

data "aws_vpc" "this" {
id = var.existing_vpc_id
}
data "aws_subnet" "public" {
for_each = toset(var.existing_public_subnet_ids)
id = each.value
}
data "aws_subnet" "instance" {
id = local.instance_subnet_id
}
check "vpc_cidr" {
assert {
condition = data.aws_vpc.this.cidr_block == local.vpc_cidr
error_message = "existing_vpc_id must be the After Hours VPC ${local.vpc_cidr}."
}
}
check "public_subnets_in_vpc" {
assert {
condition = alltrue([for subnet in data.aws_subnet.public : subnet.vpc_id == var.existing_vpc_id])
error_message = "existing_public_subnet_ids must all belong to existing_vpc_id."
}
}
check "alb_subnet_azs" {
assert {
condition = length(distinct([for subnet in data.aws_subnet.public : subnet.availability_zone])) >= 2
error_message = "ALB subnets must cover at least two availability zones."
}
}