diff --git a/.github/workflows/terraform_gh_runner.yml b/.github/workflows/terraform_gh_runner.yml index 8d2d4f3c..a5229631 100644 --- a/.github/workflows/terraform_gh_runner.yml +++ b/.github/workflows/terraform_gh_runner.yml @@ -56,12 +56,12 @@ jobs: - name: Fetch and write terraform.tfvars run: | - echo ${{ secrets.TF_VARS_FILE }} > terraform.tfvars - chmod 600 terraform.tfvars + echo ${{ secrets.TF_VARS_FILE }} > /tmp/terraform.tfvars + chmod 600 /tmp/terraform.tfvars - name: Run Terraform working-directory: ./github-runners/terraform/base run: | terraform init-backend-config="organization=subspace" -backend-config="workspaces=${{ secrets.WORKSPACE_NAME }}" - terraform plan -var-file=terraform.tfvars - terraform apply -auto-approve -var "gh_token=${{ env.RUNNER_TOKEN }}" + terraform plan -var-file=/tmp/terraform.tfvars + terraform apply -auto-approve -var "gh_token=${{ env.RUNNER_TOKEN }}" -var-file=/tmp/terraform.tfvars diff --git a/.github/workflows/terraform_template_deploy.yml b/.github/workflows/terraform_template_deploy.yml index 13baf4f2..d36e3783 100644 --- a/.github/workflows/terraform_template_deploy.yml +++ b/.github/workflows/terraform_template_deploy.yml @@ -49,8 +49,7 @@ jobs: - name: Decrypt the secrets run: | - chmod +x ./scripts/transcrypt - scripts/transcrypt -c aes-256-cbc -p ${{ secrets.TRANSCRYPT }} -y + bash scripts/transcrypt -c aes-256-cbc -p ${{ secrets.TRANSCRYPT }} -y - uses: hashicorp/setup-terraform@v2 with: @@ -60,11 +59,11 @@ jobs: - name: Setup Remote Config Backend run: | - cat > config.remote.tfbackend < /tmp/config.remote.tfbackend < terraform.tfvars - chmod 600 terraform.tfvars + echo ${{ secrets.TF_VARS_FILE }} > /tmp/terraform.tfvars + chmod 600 /tmp/terraform.tfvars - name: Terraform Plan for ${{ inputs.project }}/${{ inputs.resource }} if: ${{ (inputs.run_destroy == 'no') }} working-directory: ${{ inputs.project }}/${{ inputs.resource }} run: | - terraform plan -var-file=terraform.tfvars + terraform plan -var-file=/tmp/terraform.tfvars - name: Terraform Apply for ${{ inputs.project }}/${{ inputs.resource }} if: ${{ (inputs.run_apply == 'yes') && (inputs.run_destroy == 'no') }} working-directory: ${{ inputs.project }}/${{ inputs.resource }} run: | - terraform apply -auto-approve -var-file=terraform.tfvars + terraform apply -auto-approve -var-file=/tmp/terraform.tfvars - name: Terraform Destroy for ${{ inputs.project }}/${{ inputs.resource }} if: ${{ (inputs.run_destroy == 'yes') }} working-directory: ${{ inputs.project }}/${{ inputs.resource }} run: | - terraform plan -destroy -var-file=terraform.tfvars - terraform destroy -auto-approve -var-file=terraform.tfvars + terraform plan -destroy -var-file=/tmp/terraform.tfvars + terraform destroy -auto-approve -var-file=/tmp/terraform.tfvars diff --git a/.github/workflows/terraform_template_ephemeral_deploy.yml b/.github/workflows/terraform_template_ephemeral_deploy.yml index d436c7f7..4a7fea16 100644 --- a/.github/workflows/terraform_template_ephemeral_deploy.yml +++ b/.github/workflows/terraform_template_ephemeral_deploy.yml @@ -53,8 +53,7 @@ jobs: - name: Decrypt the secrets run: | - chmod +x ./scripts/transcrypt - scripts/transcrypt -c aes-256-cbc -p ${{ secrets.TRANSCRYPT }} -y + bash scripts/transcrypt -c aes-256-cbc -p ${{ secrets.TRANSCRYPT }} -y - uses: hashicorp/setup-terraform@v2 with: @@ -64,11 +63,11 @@ jobs: - name: Setup Remote Config Backend run: | - cat > config.remote.tfbackend < /tmp/config.remote.tfbackend < terraform.tfvars - chmod 600 terraform.tfvars + echo ${{ secrets.TF_VARS_FILE }} > /tmp/terraform.tfvars + chmod 600 /tmp/terraform.tfvars - name: Terraform Plan for ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} if: ${{ (inputs.run_destroy == 'no') }} working-directory: ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} run: | - terraform plan -var-file=terraform.tfvars + terraform plan -var-file=/tmp/terraform.tfvars - name: Terraform Apply for ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} if: ${{ (inputs.run_apply == 'yes') && (inputs.run_destroy == 'no') }} working-directory: ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} run: | - terraform apply -auto-approve -var-file=terraform.tfvars + terraform apply -auto-approve -var-file=/tmp/terraform.tfvars - name: Terraform Destroy for ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} if: ${{ (inputs.run_destroy == 'yes') }} working-directory: ${{ inputs.project }}/${{ inputs.instance }}/${{ inputs.resource }} run: | - terraform plan -destroy -var-file=terraform.tfvars - terraform destroy -auto-approve -var-file=terraform.tfvars + terraform plan -destroy -var-file=/tmp/terraform.tfvars + terraform destroy -auto-approve -var-file=/tmp/terraform.tfvars diff --git a/scripts/transcrypt b/scripts/transcrypt old mode 100644 new mode 100755