- 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
56 lines
1.8 KiB
Terraform
56 lines
1.8 KiB
Terraform
# Backend configuration for Terraform state in Linode Object Storage
|
|
# This module provides the configuration needed for remote state storage
|
|
|
|
terraform {
|
|
required_providers {
|
|
linode = {
|
|
source = "linode/linode"
|
|
version = "~> 2.0"
|
|
}
|
|
random = {
|
|
source = "hashicorp/random"
|
|
version = "~> 3.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "linode_object_storage_bucket" "terraform_state" {
|
|
label = "hapi-terraform-state-${var.environment}"
|
|
region = var.linode_object_storage_cluster
|
|
access_key = var.object_storage_access_key
|
|
secret_key = var.object_storage_secret_key
|
|
}
|
|
|
|
locals {
|
|
backend_config = {
|
|
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
|
|
}
|
|
}
|
|
|
|
output "backend_config" {
|
|
description = "Terraform backend configuration"
|
|
value = local.backend_config
|
|
}
|
|
|
|
output "backend_s3_config" {
|
|
description = "S3-style backend configuration for Terraform"
|
|
value = {
|
|
bucket = local.backend_config.bucket
|
|
key = local.backend_config.key
|
|
region = local.backend_config.region
|
|
endpoint = local.backend_config.endpoint
|
|
encrypt = local.backend_config.encrypt
|
|
access_key = local.backend_config.access_key
|
|
secret_key = local.backend_config.secret_key
|
|
skip_region_validation = local.backend_config.skip_region_validation
|
|
}
|
|
sensitive = true
|
|
}
|