diff --git a/README.md b/README.md index bb85e92..d6ca641 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ These input values must be the same as any [`dflook/terraform-plan`](https://git A friendly name for the environment the Terraform configuration is for. This will be used in the PR comment for easy identification. - It must be the same as the `label` used in the corresponding [`dflook/terraform-plan`](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) command. + It must be the same as the `label` used in the corresponding [`dflook/terraform-plan`](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) action. - Type: string - Optional @@ -157,11 +157,33 @@ These input values must be the same as any [`dflook/terraform-plan`](https://git - Optional - Default: false +* `plan_path` + + Path to a plan file to apply. This would have been generated by a previous [`dflook/terraform-plan`](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) action. + + The default behaviour when this is not set is to generate a plan from the current configuration and compare it to the plan attached to the PR comment. + If it is logically the same, the plan will be applied. + + When this is set to a plan file, the plan will not be generated again. If it is the exact same plan as the one attached to the PR comment, it will be applied. + This will be faster than generating a new plan. + + There are downsides to applying a stored plan: + - The plan may contain sensitive information so must be stored securely, possibly outside of GitHub. + - It does not account for any changes that have occurred since it was generated, and may no longer be correct. + - Plans must be generated and applied in strict order. Multiple open PRs will cause conflicts if they are applied out of order. + - Plans are not portable between platforms. + - Terraform and provider versions must match between the plan generation and apply. + + When `auto_approve` is set to `true`, the plan will be applied without checking if it is the same as the one attached to the PR comment. + + - Type: string + - Optional + * `auto_approve` - When set to `true`, generated plans are always applied. + When set to `true`, plans are always applied. - The default is `false`, which requires plans to have been approved through a pull request. + The default is `false`, which requires plans to have been added to a pull request comment. - Type: bool - Optional diff --git a/action.yaml b/action.yaml index 438772d..27c8aba 100644 --- a/action.yaml +++ b/action.yaml @@ -55,6 +55,10 @@ inputs: description: Create and apply a plan to destroy all resources required: false default: "false" + plan_path: + description: Path to the plan file to apply. + required: false + default: "" outputs: text_plan_path: @@ -68,7 +72,7 @@ outputs: runs: using: docker - image: docker://danielflook/terraform-github-actions@sha256:58b279738cab51c9bb4b8201afeff9e585ce72f9a30ee0490896ad8827e7e96b + image: docker://danielflook/terraform-github-actions@sha256:4c0a6f98ddafa03699d7fb059010f6b5f88d5a8903d1d2e66660ec799de9efad entrypoint: /entrypoints/apply.sh branding: