diff --git a/.gitea/workflows/sonarqube.yaml b/.gitea/workflows/sonarqube.yaml index e481aa0..57014db 100644 --- a/.gitea/workflows/sonarqube.yaml +++ b/.gitea/workflows/sonarqube.yaml @@ -96,4 +96,18 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_SECRET_KEY }} - run: terraform init + TF_BACKEND_ENDPOINT: ${{ secrets.MINIO_ENDPOINT }} + TF_BACKEND_BUCKET: ${{ secrets.MINIO_BUCKET }} + TF_BACKEND_KEY: ${{ secrets.MINIO_STATE_KEY }} + TF_BACKEND_REGION: "main" + run: | + terraform init \ + -backend-config="endpoints={s3=\"${TF_BACKEND_ENDPOINT}\"}" \ + -backend-config="bucket=${TF_BACKEND_BUCKET}" \ + -backend-config="key=${TF_BACKEND_KEY}" \ + -backend-config="region=${TF_BACKEND_REGION}" \ + -backend-config="skip_credentials_validation=true" \ + -backend-config="skip_metadata_api_check=true" \ + -backend-config="skip_requesting_account_id=true" \ + -backend-config="skip_region_validation=true" \ + -backend-config="use_path_style=true" diff --git a/backend.tf b/backend.tf index 7a16643..356c3c5 100644 --- a/backend.tf +++ b/backend.tf @@ -1,17 +1,6 @@ terraform { backend "s3" { - endpoints = { - s3 = "https://minio.bsdserver.nl:443" - } - - bucket = "home-terraform" - key = "home/vsphere/network/vsphere-resourcegroup-config.tfstate" - - region = "main" - skip_credentials_validation = true - skip_metadata_api_check = true - skip_requesting_account_id = true - skip_region_validation = true - use_path_style = true + # Backend configuration provided via -backend-config flags during terraform init + # This allows for environment-specific and CI/CD-friendly configuration } }