01a: update Linode Terraform for provider v2

- Update all modules to use Linode provider v2 (linode/linode ~> 2.0)
- Replace deprecated cluster attribute with region in all modules
- Update firewall to use ipv4/ipv6 instead of cidrs (TCP/UDP protocols)
- Update LKE endpoint output to use api_endpoints[0] instead of deprecated hostname
- Add OBJECT_STORAGE_CLUSTER variable for object storage configuration
- Update Makefile with new variables and validate target
- Add storage/outputs.tf for standardized object storage outputs
- Update .env and .env.example with clean format (no inline comments)
- Update all terraform.tfvars.example files for consistency
This commit is contained in:
Bobby committed 2026-11-17 22:09:31 -05:00
1 parent 341cd05ac5
commit 494f38c1f3
17 files changed
+285 -203

No files matched your search

+22 -9
View File
@@ -1,12 +1,25 @@
# PostgreSQL module for HAPI
# Creates separate database instances for staging and production
terraform {
required_providers {
linode = {
source = "linode/linode"
version = "~> 2.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}
# Object Storage buckets for PostgreSQL state
resource "linode_object_storage_bucket" "state" {
for_each = toset(["staging", "production"])
label = "hapi-postgres-state-${each.key}"
cluster = var.linode_object_storage_cluster
region = var.linode_object_storage_cluster
access_key = var.object_storage_access_key
secret_key = var.object_storage_secret_key
}
@@ -14,12 +27,12 @@ resource "linode_object_storage_bucket" "state" {
resource "linode_lke_cluster" "postgres" {
for_each = toset(["staging", "production"])
region = var.linode_region
label = "hapi-postgres-${each.key}"
region = var.linode_region
label = "hapi-postgres-${each.key}"
k8s_version = var.linode_lke_version
tags = merge(var.tags, { Environment = each.key })
tags = toset([for k, v in merge(var.tags, { Environment = each.key }) : "${k}=${v}"])
pools {
pool {
count = each.key == "production" ? 2 : 1
type = var.linode_node_type
}
@@ -29,19 +42,19 @@ resource "linode_lke_cluster" "postgres" {
locals {
databases = {
staging = {
name = "hapi_staging"
name = "hapi_staging"
pool_size = 2
}
production = {
name = "hapi_production"
name = "hapi_production"
pool_size = 3
}
}
}
output "endpoint" {
description = "PostgreSQL endpoint"
value = linode_lke_cluster.postgres[var.environment].hostname
description = "PostgreSQL endpoint (Kubernetes API endpoint)"
value = linode_lke_cluster.postgres[var.environment].api_endpoints[0]
}
output "port" {