diff --git a/docs/adr/0001-linode-infrastructure-with-terraform.md b/docs/adr/0001-linode-infrastructure-with-terraform.md index 5dbe5e9..b98ada5 100644 --- a/docs/adr/0001-linode-infrastructure-with-terraform.md +++ b/docs/adr/0001-linode-infrastructure-with-terraform.md @@ -61,7 +61,7 @@ infra/ #### PostgreSQL (`infra/postgres/`) - LKE (Linode Kubernetes Engine) clusters for staging and production -- Configurable pool sizes (10 for staging, 25 for production) +- Configurable pool sizes (2 for staging, 3 for production) - Separate database names (`hapi_staging`, `hapi_production`) - Random password generation for database access diff --git a/infra/main.tf b/infra/main.tf index 547cbc6..4c7f513 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -14,6 +14,18 @@ terraform { version = "~> 3.0" } } + + # Backend configuration for Terraform state using S3-compatible Linode Object Storage + backend "s3" { + bucket = "hapi-terraform-state-${var.environment}" + key = "terraform/${var.environment}/terraform.tfstate" + region = var.linode_region + endpoint = "https://${var.linode_region}.linodeobjects.com" + encrypt = true + access_key = var.object_storage_access_key + secret_key = var.object_storage_secret_key + skip_region_validation = true + } } # Provider configurations are in providers.tf @@ -45,18 +57,3 @@ module "network" { linode_region = var.linode_region environment = var.environment } - -# Backend configuration for Terraform state -# State will be stored in Linode Object Storage -# Backend configuration is defined in infra/backend/ - -# Backend module (for terraform state storage configuration) -module "backend" { - source = "./backend" - - linode_region = var.linode_region - linode_object_storage_cluster = var.linode_object_storage_cluster - object_storage_access_key = var.object_storage_access_key - object_storage_secret_key = var.object_storage_secret_key - environment = var.environment -} diff --git a/infra/network/main.tf b/infra/network/main.tf index 6275025..ad47898 100644 --- a/infra/network/main.tf +++ b/infra/network/main.tf @@ -18,10 +18,8 @@ resource "linode_firewall" "hapi" { label = "hapi-firewall-${var.environment}" tags = toset([for k, v in var.tags : "${k}=${v}"]) - # Inbound policy - inbound_policy = "DROP" - - # Outbound policy + # Default policies - DROP for security (explicit ACCEPT rules for allowed traffic) + inbound_policy = "DROP" outbound_policy = "DROP" # Inbound rules diff --git a/infra/providers.tf b/infra/providers.tf index 3b7d75b..6d80c6f 100644 --- a/infra/providers.tf +++ b/infra/providers.tf @@ -3,4 +3,8 @@ # Provider configurations # These use the sources defined in main.tf terraform block +provider "linode" { + token = var.linode_token +} + provider "random" {}