Test: Pipeline proyectosacc para laboratorio local
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
TF_BACKEND_BUCKET="${TF_BACKEND_BUCKET:-local-terraform-state}"
|
||||
TF_BACKEND_KEY="${TF_BACKEND_KEY:-proyectosacc/local/terraform.tfstate}"
|
||||
TF_BACKEND_REGION="${TF_BACKEND_REGION:-us-east-1}"
|
||||
|
||||
echo "=== Terraform Local Init (Floci) ==="
|
||||
echo "Backend Bucket : ${TF_BACKEND_BUCKET}"
|
||||
echo "Backend Key : ${TF_BACKEND_KEY}"
|
||||
echo "Backend Region : ${TF_BACKEND_REGION}"
|
||||
echo ""
|
||||
|
||||
# Configurar credenciales para Floci
|
||||
export AWS_ACCESS_KEY_ID="000000000000"
|
||||
export AWS_SECRET_ACCESS_KEY="test"
|
||||
export AWS_DEFAULT_REGION="us-east-1"
|
||||
export AWS_ENDPOINT_URL="http://floci:4566"
|
||||
|
||||
# Crear bucket S3 para estado si no existe
|
||||
aws --endpoint-url=${AWS_ENDPOINT_URL} s3 mb s3://${TF_BACKEND_BUCKET} 2>/dev/null || echo "Bucket ya existe o error (ignorado)"
|
||||
|
||||
# Inicializar Terraform con backend S3 local
|
||||
cat > backend.tf <<BACKEND
|
||||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "${TF_BACKEND_BUCKET}"
|
||||
key = "${TF_BACKEND_KEY}"
|
||||
region = "${TF_BACKEND_REGION}"
|
||||
endpoint = "http://floci:4566"
|
||||
access_key = "000000000000"
|
||||
secret_key = "test"
|
||||
skip_credentials_validation = true
|
||||
skip_metadata_api_check = true
|
||||
skip_region_validation = true
|
||||
force_path_style = true
|
||||
}
|
||||
}
|
||||
BACKEND
|
||||
|
||||
echo "✓ Backend local configurado"
|
||||
echo "=== Terraform Local Init completado ==="
|
||||
Reference in New Issue
Block a user