7factor/Run Terraform
Runs various Terraform commands using the Terraform CLI.
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Activelast commit Feb 10, 2026
- License
- MIT
Pinned Snippet
uses: 7factor/action-terraform@3b89a273371ae434962a65fa9dcafc99dddd8cf2 # v3.2.0tags can be moved; commit SHAs can't. why a SHA?
Inputs
| name | description | required | default |
|---|---|---|---|
| github-token | The GitHub token to use | no | ${{ github.token }} |
| tf-cli | The actual Terraform cli to use | no | terraform |
| directory | The directory containing the Terraform configuration | no | . |
| workspace | The Terraform workspace to use | no | — |
| workspace-select | Whether to run terraform workspace select. Requires workspace input and the TF_WORKSPACE env var to not be set. | no | true |
| workspace-create-if-missing | Whether to create the workspace if it does not exist. Requires workspace-select input to be true. | no | true |
| init | Whether to run terraform init | no | true |
| init-args | Additional arguments to pass to terraform init | no | — |
| backend-file | The path to the backend file to use, if not present in the terraform config directory. | no | — |
| partial-backend | The backend to use in a partial backend configuration. For example, "s3". See https://developer.hashicorp.com/terraform/language/backend#partial-configuration | no | — |
| backend-config-content | The content of the backend config file to use. For use with partial backend configuration. See https://developer.hashicorp.com/terraform/language/backend#partial-configuration | no | — |
| fmt | Whether to run terraform fmt | no | true |
| validate | Whether to run terraform validate | no | true |
| action | The main terraform action to run ("plan", "apply", "test", or "output") | no | — |
| action-args | Additional arguments to pass to terraform plan, apply, test, or output | no | — |
| destroy | Whether to destroy the infrastructure | no | false |
| output | Whether to run terraform output separate from the main action (for logging purposes) | no | false |
| output-args | Additional arguments to pass to terraform output (for the output input) | no | — |
| metadata | Whether to run terraform output in JSON format and produce a flattened "metadata" output that can be used as json tfvars. | no | false |
| tfvars-content | The content of the variable file to use. | no | — |
| tfvars-json-content | The content of the variable file to use in JSON format. | no | — |
| plan-file-name | The name to the plan file to use. If not provided, a plan file will not be used. | no | — |
| encrypted-plan-password | The password to use to encrypt the plan artifact. If not provided, the plan will not be encrypted. | no | — |
| plan-retention-days | Duration after which the plan artifact will expire in days. 0 means using the default value defined in the repository settings. Actual values can range from 1 to 90 (public repositories) or 400 (private repositories). | no | 0 |
| comment | Whether to comment on the PR with the results | no | true |
| comment-header | The header to use in the PR comment | no | — |
| comment-identifier | The identifier to use in the PR comment | no | — |
Outputs
| name | description |
|---|---|
| fmt-outcome | The outcome of the terraform fmt command |
| fmt-stdout | The stdout of the terraform fmt command |
| fmt-stderr | The stderr of the terraform fmt command |
| init-outcome | The outcome of the terraform init command |
| init-stdout | The stdout of the terraform init command |
| init-stderr | The stderr of the terraform init command |
| workspace-outcome | The outcome of the terraform workspace select command |
| workspace-stdout | The stdout of the terraform workspace select command |
| workspace-stderr | The stderr of the terraform workspace select command |
| validate-outcome | The outcome of the terraform validate command |
| validate-stdout | The stdout of the terraform validate command |
| validate-stderr | The stderr of the terraform validate command |
| test-outcome | The outcome of the terraform test command |
| test-stdout | The stdout of the terraform test command |
| test-stderr | The stderr of the terraform test command |
| plan-outcome | The outcome of the terraform plan command |
| plan-stdout | The stdout of the terraform plan command |
| plan-stderr | The stderr of the terraform plan command |
| apply-outcome | The outcome of the terraform apply command |
| apply-stdout | The stdout of the terraform apply command |
| apply-stderr | The stderr of the terraform apply command |
| output-outcome | The outcome of the terraform output command |
| output-stdout | The stdout of the terraform output command |
| output-stderr | The stderr of the terraform output command |
| metadata | The metadata (output vars in JSON format) from the terraform state |