name: Terraform Destroy on: workflow_dispatch: inputs: working_directory: description: "Working directory for the module" required: false default: "terraform" type: string tfvars_file: description: "Which tfvars file to use" required: true default: "single.tfvars.example" type: choice options: - single.tfvars.example - multi.tfvars.example jobs: destroy: runs-on: ubuntu-latest defaults: run: shell: bash working-directory: ${{ inputs.working_directory }} steps: - name: Checkout uses: actions/checkout@v4 - name: Check files & Select tfvars shell: bash run: | cd terraform ls cp "${{ inputs.tfvars_file || 'single.tfvars.example' }}" terraform.tfvars cat terraform.tfvars - name: Setup Terraform uses: hashicorp/setup-terraform@v4 - name: Terraform Init run: terraform init - name: Terraform Destroy Plan run: terraform plan -destroy -out=tfplan continue-on-error: false - name: Terraform Destroy run: terraform destroy -auto-approve