diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index d1984a1..454ef8b 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -44,7 +44,7 @@ env: GITHUB_APP_INSTALLATION_ID: ${{ inputs.gh_app_installation_id || vars.GH_APP_INSTALLATION_ID }} GITHUB_APP_PEM_FILE: ${{ secrets.gh_app_pem_file || secrets.GH_APP_PEM_FILE }} TF_WORKSPACE: ${{ inputs.gh_owner || vars.GH_OWNER }} - TF_VAR_path: iac/${{ inputs.path || 'test.yaml' }} + TF_VAR_path: ../iac/${{ inputs.path || 'test.yaml' }} jobs: terraform: @@ -74,12 +74,12 @@ jobs: - name: Terraform init id: init - run: terraform init + run: terraform -chdir=terraform init - name: Terraform plan id: plan if: github.event_name == 'pull_request' - run: terraform plan -no-color -input=false + run: terraform -chdir=terraform plan -no-color -input=false continue-on-error: true - name: Terraform plan as the PR comment @@ -138,4 +138,4 @@ jobs: - name: Terraform apply if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: terraform apply -auto-approve -input=false + run: terraform -chdir=terraform apply -auto-approve -input=false diff --git a/README.md b/README.md index 1e19938..0685e2f 100644 --- a/README.md +++ b/README.md @@ -211,9 +211,9 @@ export GITHUB_APP_PEM_FILE=$(cat ) export TF_WORKSPACE="$GITHUB_OWNER" export TF_VAR_path="test.yaml" -terraform init -terraform plan -terraform apply +terraform -chdir=terraform init +terraform -chdir=terraform plan +terraform -chdir=terraform apply ``` ## Testing diff --git a/.terraform.lock.hcl b/terraform/.terraform.lock.hcl similarity index 100% rename from .terraform.lock.hcl rename to terraform/.terraform.lock.hcl diff --git a/config.tf b/terraform/config.tf similarity index 100% rename from config.tf rename to terraform/config.tf diff --git a/input.tf b/terraform/input.tf similarity index 100% rename from input.tf rename to terraform/input.tf diff --git a/main.tf b/terraform/main.tf similarity index 100% rename from main.tf rename to terraform/main.tf