diff --git a/README.md b/README.md index e94579d5..cfd2a93c 100644 --- a/README.md +++ b/README.md @@ -133,3 +133,43 @@ jobs: } ] ``` + +## Terraform + +This action runs Terraform commands against AWS environments. It handles AWS authentication by assuming roles based on the specified environment and executes Terraform init, validate, plan (for PRs), or apply (for deployments). + +### Inputs + +- `working-directory` - **Required** Working directory for Terraform commands. +- `environment` - **Required** AWS Environment to authenticate into. Supported values: `shared`, `dev`, `prod`, `audit`, `log_archive`, `sbx`, `uat`. +- `aws-region` - **Optional** AWS Region to authenticate into. Defaults to `us-east-2`. +- `is-pr-workflow` - **Required** Is PR workflow. Set to `true` to run validate and plan, or `false` to run apply. + +### Example usage + +```yaml +name: Terraform Deploy + +on: + pull_request: + branches: [ master ] + push: + branches: [ master ] + +jobs: + terraform: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + + - name: Run Terraform + uses: Basis-Theory/github-actions/terraform@master + with: + working-directory: ./infrastructure + environment: dev + aws-region: us-east-1 + is-pr-workflow: ${{ github.event_name == 'pull_request' }} +```