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:
1 parent
341cd05ac5
commit
494f38c1f3
17 files changed
+285
-203
No files matched your search
@@ -4,10 +4,10 @@
|
||||
# Linode Object Storage as Terraform backend
|
||||
# Copy this to your terraform.tfvars or set as environment variables
|
||||
|
||||
linode_token = "<YOUR_LINODE_API_TOKEN>"
|
||||
linode_region = "us-east"
|
||||
environment = "staging" # or "production"
|
||||
project_name = "hapi"
|
||||
linode_token = "<YOUR_LINODE_API_TOKEN>"
|
||||
linode_region = "us-east"
|
||||
environment = "staging" # or "production"
|
||||
project_name = "hapi"
|
||||
|
||||
# Object Storage credentials
|
||||
object_storage_access_key = "<YOUR_ACCESS_KEY>"
|
||||
|
||||
+29
-18
@@ -1,22 +1,35 @@
|
||||
# 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}"
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -29,16 +42,14 @@ output "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
|
||||
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 = {
|
||||
secret_key = local.backend_config.secret_key
|
||||
}
|
||||
sensitive = true
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
# Backend module variables
|
||||
linode_region = "us-east"
|
||||
# Backend module example configuration
|
||||
|
||||
linode_region = "us-east"
|
||||
linode_object_storage_cluster = "us-east-1"
|
||||
object_storage_access_key = "your-access-key"
|
||||
object_storage_secret_key = "your-secret-key"
|
||||
environment = "staging"
|
||||
object_storage_access_key = "your-access-key"
|
||||
object_storage_secret_key = "your-secret-key"
|
||||
environment = "staging"
|
||||
Reference in new issue
Block a user