This is one of a suite of terraform related actions - find them at dflook/terraform-github-actions.
This action uses the terraform destroy command to destroy all resources in a terraform workspace and then delete the workspace.
-
pathPath to the terraform configuration
- Type: string
- Required
-
workspaceTerraform workspace to destroy and delete
- Type: string
- Required
-
varComma separated list of terraform vars to set
- Type: string
- Optional
-
var_fileComma separated list of tfvars files to use. Paths should be relative to the GitHub Actions workspace
- Type: string
- Optional
-
backend_configComma separated list of terraform backend config values.
- Type: string
- Optional
-
backend_config_fileComma separated list of terraform backend config files to use. Paths should be relative to the GitHub Actions workspace
- Type: string
- Optional
-
parallelismLimit the number of concurrent operations
- Type: number
- Optional
- Default: 10
This example deletes the workspace named after the git branch when the associated PR is closed.
name: Destroy testing workspace
on:
pull_request:
types: [closed]
jobs:
integration:
runs-on: ubuntu-latest
name: Cleanup after integration tests
steps:
- name: Checkout
uses: actions/checkout@v2
- name: terraform destroy
uses: dflook/terraform-destroy-workspace@v1
with:
path: terraform
workspace: ${{ github.head_ref }}