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
+13
-6
@@ -5,6 +5,7 @@
|
||||
# Environment defaults
|
||||
ENV ?= staging
|
||||
REGION ?= us-east
|
||||
OBJECT_STORAGE_CLUSTER ?= us-east-1
|
||||
|
||||
# Initialize Terraform
|
||||
init:
|
||||
@@ -17,38 +18,39 @@ init-backend:
|
||||
terraform init -reconfigure \
|
||||
-backend-config=bucket=hapi-terraform-state-${ENV} \
|
||||
-backend-config=key=terraform/${ENV}/terraform.tfstate \
|
||||
-backend-config=region=${REGION}
|
||||
-backend-config=region=${OBJECT_STORAGE_CLUSTER}
|
||||
|
||||
# Generate plan
|
||||
plan:
|
||||
@echo "Generating Terraform plan for ${ENV}..."
|
||||
terraform plan -var="environment=${ENV}"
|
||||
terraform plan -var="environment=${ENV}" -var="linode_object_storage_cluster=${OBJECT_STORAGE_CLUSTER}"
|
||||
|
||||
# Apply changes
|
||||
apply:
|
||||
@echo "Applying Terraform changes for ${ENV}..."
|
||||
terraform apply -var="environment=${ENV}"
|
||||
terraform apply -var="environment=${ENV}" -var="linode_object_storage_cluster=${OBJECT_STORAGE_CLUSTER}"
|
||||
|
||||
# Apply with auto-approve
|
||||
apply-auto:
|
||||
@echo "Applying Terraform changes for ${ENV} (auto-approve)..."
|
||||
terraform apply -var="environment=${ENV}" -auto-approve
|
||||
terraform apply -var="environment=${ENV}" -var="linode_object_storage_cluster=${OBJECT_STORAGE_CLUSTER}" -auto-approve
|
||||
|
||||
# Destroy infrastructure
|
||||
destroy:
|
||||
@echo "Destroying Terraform infrastructure for ${ENV}..."
|
||||
terraform destroy -var="environment=${ENV}"
|
||||
terraform destroy -var="environment=${ENV}" -var="linode_object_storage_cluster=${OBJECT_STORAGE_CLUSTER}"
|
||||
|
||||
# Show outputs
|
||||
output:
|
||||
@echo "Terraform outputs:"
|
||||
terraform output
|
||||
terraform output -json | jq -r 'to_entries | .[] | "\(.key) = \(.value.value)"' 2>/dev/null || terraform output
|
||||
|
||||
# Load environment variables
|
||||
env:
|
||||
@echo "Environment variables:"
|
||||
@echo " ENV=${ENV}"
|
||||
@echo " REGION=${REGION}"
|
||||
@echo " OBJECT_STORAGE_CLUSTER=${OBJECT_STORAGE_CLUSTER}"
|
||||
@echo " LINODE_TOKEN=${LINODE_TOKEN}"
|
||||
@echo " OBJECT_STORAGE_ACCESS_KEY=${OBJECT_STORAGE_ACCESS_KEY}"
|
||||
@echo " OBJECT_STORAGE_SECRET_KEY=${OBJECT_STORAGE_SECRET_KEY}"
|
||||
@@ -56,6 +58,11 @@ env:
|
||||
# Run all checks
|
||||
check: init plan apply
|
||||
|
||||
# Validate configuration
|
||||
validate:
|
||||
@echo "Validating Terraform configuration..."
|
||||
terraform validate
|
||||
|
||||
# Clean up local state
|
||||
clean:
|
||||
@echo "Cleaning local Terraform files..."
|
||||
|
||||
Reference in new issue
Block a user