This commit is contained in:
Daniel Flook 2022-05-04 08:58:37 +01:00
Родитель 22daf28c18
Коммит 4bc7e8d6db
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9459036D5AF34B20
13 изменённых файлов: 51 добавлений и 51 удалений

2
.github/release_template.md поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
This is one of a suite of terraform related actions - find them at [dflook/terraform-github-actions](https://github.com/dflook/terraform-github-actions).
You can see the changes for this release in the [CHANGELOG](https://github.com/dflook/terraform-github-actions/blob/master/CHANGELOG.md)
You can see the changes for this release in the [CHANGELOG](https://github.com/dflook/terraform-github-actions/blob/main/CHANGELOG.md)
You can specify the action version as:

2
.github/workflows/base-image.yaml поставляемый
Просмотреть файл

@ -3,7 +3,7 @@ name: Update base image
on:
push:
branches:
- master
- main
paths:
- image/Dockerfile-base
- .github/workflows/base-image.yaml

Просмотреть файл

@ -15,7 +15,7 @@ When using an action you can specify the version as:
## [1.24.0] - 2022-05-03
### Added
- New `to_add`, `to_change` and `to_destroy` outputs for the [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan) action that contain the number of resources that would be added, changed or deleted by the plan.
- New `to_add`, `to_change` and `to_destroy` outputs for the [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) action that contain the number of resources that would be added, changed or deleted by the plan.
These can be used in an [if expression](https://docs.github.com/en/enterprise-server@3.2/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif) in a workflow to conditionally run steps, e.g. when the plan would destroy something.
@ -24,20 +24,20 @@ When using an action you can specify the version as:
### Changed
- Input variables no longer help identify the plan comment. Each PR comment is still identified by it's configured terraform backend state file. This is a very subtle change but enables better reporting of why an apply operation is aborted, e.g. "plan has changed" vs "plan not found".
This means that if you have more than one [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan) action for the same `path` and backend but with different variables, you should ensure they use different `label`s.
This means that if you have more than one [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) action for the same `path` and backend but with different variables, you should ensure they use different `label`s.
- The workflow output when an apply has been aborted because of changes in the plan has been clarified - thanks [toast-gear](https://github.com/toast-gear)!
### Fixed
- Pre-release terraform versions now won't be used when selecting the latest terraform version.
- Invalid terraform files that contained an unterminated string would take an extremely long time to parse before failing the job.
- [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/master/terraform-validate) now automatically sets `terraform.workspace` to `default` when validating a module that uses a `remote` or `cloud` backend.
- [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/main/terraform-validate) now automatically sets `terraform.workspace` to `default` when validating a module that uses a `remote` or `cloud` backend.
## [1.22.2] - 2022-02-28
### Fixed
- The PR plan comment was incorrectly including resource refresh lines when there were changes to outputs but not resources, while using Terraform >=0.15.4. As well as being noisy, this could lead to failures to apply due to incorrectly detecting changes in the plan.
- Removed incorrect deprecation warning in [dflook/terraform-destroy](https://github.com/dflook/terraform-github-actions/tree/master/terraform-destroy). Thanks [dgrenner](https://github.com/dgrenner)!
- Removed incorrect deprecation warning in [dflook/terraform-destroy](https://github.com/dflook/terraform-github-actions/tree/main/terraform-destroy). Thanks [dgrenner](https://github.com/dgrenner)!
## [1.22.1] - 2022-01-24
@ -48,9 +48,9 @@ When using an action you can specify the version as:
### Added
- Workspace management for Terraform Cloud/Enterprise has been reimplemented to avoid issues with the `terraform workspace` command when using the `remote` backend or a cloud config block:
- [dflook/terraform-new-workspace](https://github.com/dflook/terraform-github-actions/tree/master/terraform-new-workspace) can now create the first workspace
- [dflook/terraform-destroy-workspace](https://github.com/dflook/terraform-github-actions/tree/master/terraform-destroy-workspace) can now delete the last remaining workspace
- [dflook/terraform-new-workspace](https://github.com/dflook/terraform-github-actions/tree/master/terraform-new-workspace) and [dflook/terraform-destroy-workspace](https://github.com/dflook/terraform-github-actions/tree/master/terraform-destroy-workspace) work with a `remote` backend that specifies a workspace by `name`
- [dflook/terraform-new-workspace](https://github.com/dflook/terraform-github-actions/tree/main/terraform-new-workspace) can now create the first workspace
- [dflook/terraform-destroy-workspace](https://github.com/dflook/terraform-github-actions/tree/main/terraform-destroy-workspace) can now delete the last remaining workspace
- [dflook/terraform-new-workspace](https://github.com/dflook/terraform-github-actions/tree/main/terraform-new-workspace) and [dflook/terraform-destroy-workspace](https://github.com/dflook/terraform-github-actions/tree/main/terraform-destroy-workspace) work with a `remote` backend that specifies a workspace by `name`
- The terraform version to use will now be detected from additional places:
@ -61,35 +61,35 @@ When using an action you can specify the version as:
The best way to specify the version is using a [`required_version`](https://www.terraform.io/docs/configuration/terraform.html#specifying-a-required-terraform-version) constraint.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) docs for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) docs for details.
### Changed
As a result of the above terraform version detection additions, note these changes:
- Actions always use the terraform version set in the remote workspace when using TFC/E, if it exists. This mostly effects [dflook/terraform-fmt](https://github.com/dflook/terraform-github-actions/tree/master/terraform-fmt), [dflook/terraform-fmt-check](https://github.com/dflook/terraform-github-actions/tree/master/terraform-fmt-check) and [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/master/terraform-validate).
- Actions always use the terraform version set in the remote workspace when using TFC/E, if it exists. This mostly effects [dflook/terraform-fmt](https://github.com/dflook/terraform-github-actions/tree/main/terraform-fmt), [dflook/terraform-fmt-check](https://github.com/dflook/terraform-github-actions/tree/main/terraform-fmt-check) and [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/main/terraform-validate).
- If the terraform version is not specified anywhere then new workspaces will be created with the latest terraform version. Existing workspaces will use the terraform version that was last used for that workspace.
- If you want to always use the latest terraform version, instead of not specifying a version you now need to set an open-ended version constraint (e.g. `>1.0.0`)
- All actions now support the inputs and environment variables related to the backend, for discovering the terraform version from a TFC/E workspace or remote state. This add the inputs `workspace`, `backend_config`, `backend_config_file`, and the `TERRAFORM_CLOUD_TOKENS` environment variable to the [dflook/terraform-fmt](https://github.com/dflook/terraform-github-actions/tree/master/terraform-fmt), [dflook/terraform-fmt-check](https://github.com/dflook/terraform-github-actions/tree/master/terraform-fmt-check) and [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/master/terraform-validate) actions.
- All actions now support the inputs and environment variables related to the backend, for discovering the terraform version from a TFC/E workspace or remote state. This add the inputs `workspace`, `backend_config`, `backend_config_file`, and the `TERRAFORM_CLOUD_TOKENS` environment variable to the [dflook/terraform-fmt](https://github.com/dflook/terraform-github-actions/tree/main/terraform-fmt), [dflook/terraform-fmt-check](https://github.com/dflook/terraform-github-actions/tree/main/terraform-fmt-check) and [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/main/terraform-validate) actions.
- :warning: Some unused packages were removed from the container image, most notably Python 2.
## [1.21.1] - 2021-12-12
### Fixed
- [dflook/terraform-new-workspace](https://github.com/dflook/terraform-github-actions/tree/master/terraform-new-workspace) support for Terraform v1.1.0.
- [dflook/terraform-new-workspace](https://github.com/dflook/terraform-github-actions/tree/main/terraform-new-workspace) support for Terraform v1.1.0.
This stopped working after a change in the behaviour of terraform init.
There is an outstanding [issue in Terraform v1.1.0](https://github.com/hashicorp/terraform/issues/30129) using the `remote` backend that prevents creating a new workspace when no workspaces currently exist.
If you are affected by this, you can pin to an earlier version of Terraform using one of methods listed in the [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) docs.
If you are affected by this, you can pin to an earlier version of Terraform using one of methods listed in the [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) docs.
## [1.21.0] - 2021-12-04
### Added
- A new `workspace` input for [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/master/terraform-validate)
- A new `workspace` input for [dflook/terraform-validate](https://github.com/dflook/terraform-github-actions/tree/main/terraform-validate)
allows validating usage of `terraform.workspace` in the terraform code.
Terraform doesn't initialize `terraform.workspace` based on the backend configuration when running a validate operation.
@ -103,12 +103,12 @@ As a result of the above terraform version detection additions, note these chang
## [1.20.0] - 2021-12-03
### Added
- New `text_plan_path` and `json_plan_path` outputs for [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/master/terraform-apply)
to match the outputs for [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan).
- New `text_plan_path` and `json_plan_path` outputs for [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/main/terraform-apply)
to match the outputs for [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan).
These are paths to the generated plan in human-readable and JSON formats.
If the plan generated by [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan) is different from the plan generated by [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/master/terraform-apply) the apply step will fail with `failure-reason` set to `plan-changed`.
If the plan generated by [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) is different from the plan generated by [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/main/terraform-apply) the apply step will fail with `failure-reason` set to `plan-changed`.
These new outputs make it easier to inspect the differences.
## [1.19.0] - 2021-11-01
@ -121,7 +121,7 @@ As a result of the above terraform version detection additions, note these chang
## [1.18.0] - 2021-10-30
### Added
- A new `replace` input for [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan#inputs) and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/master/terraform-apply#inputs)
- A new `replace` input for [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan#inputs) and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/main/terraform-apply#inputs)
This instructs terraform to replace the specified resources, and is available with terraform versions that support replace (v0.15.2 onwards).
@ -131,7 +131,7 @@ As a result of the above terraform version detection additions, note these chang
random_password.database
```
- A `target` input for [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan#inputs) to match [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/master/terraform-apply#inputs)
- A `target` input for [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan#inputs) to match [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/main/terraform-apply#inputs)
`target` limits the plan to the specified resources and their dependencies. This change removes the restriction that `target` can only be used with `auto_approve`.

Просмотреть файл

@ -67,14 +67,14 @@ jobs:
```
#### apply.yaml
This workflow runs when the PR is merged into the master branch, and applies the planned changes.
This workflow runs when the PR is merged into the main branch, and applies the planned changes.
```yaml
name: Apply terraform plan
on:
push:
branches:
- master
- main
jobs:
apply:
@ -93,7 +93,7 @@ jobs:
```
### Linting
This workflow runs on every push to non-master branches and checks the terraform configuration is valid.
This workflow runs on every push to non-main branches and checks the terraform configuration is valid.
For extra strictness, we check the files are in the canonical format.
<p align="center">
@ -109,7 +109,7 @@ name: Lint
on:
push:
branches:
- '!master'
- '!main'
jobs:
validate:
@ -208,7 +208,7 @@ name: Check terraform file formatting
on:
push:
branches:
- master
- main
jobs:
format:

Просмотреть файл

@ -3,7 +3,7 @@ name: Apply plan
on:
push:
branches:
- master
- main
jobs:
plan:

Просмотреть файл

@ -3,7 +3,7 @@ name: Fix terraform formatting
on:
push:
branches:
- master
- main
jobs:
fix_formatting:

Просмотреть файл

@ -3,7 +3,7 @@ name: Validate changes
on:
push:
branches:
- '!master'
- '!main'
jobs:
fmt-check:

Просмотреть файл

@ -11,7 +11,7 @@ This is to ensure that the action only applies changes that have been reviewed b
You can instead set `auto_approve: true` which will generate a plan and apply it immediately, without looking for a plan attached to a PR.
## Demo
This a demo of the process for apply a terraform change using the [`dflook/terraform-plan`](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan) and [`dflook/terraform-apply`](https://github.com/dflook/terraform-github-actions/tree/master/terraform-apply) actions.
This a demo of the process for apply a terraform change using the [`dflook/terraform-plan`](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) and [`dflook/terraform-apply`](https://github.com/dflook/terraform-github-actions/tree/main/terraform-apply) actions.
<p align="center">
<img src="planapply.gif" width="1000">
@ -22,7 +22,7 @@ This a demo of the process for apply a terraform change using the [`dflook/terra
To make best use of this action, require that the plan is always reviewed
before merging the PR to approve. You can enforce this in github by
going to the branch settings for the repo and enable protection for
the master branch:
the main branch:
1. Enable 'Require pull request reviews before merging'
2. Check 'Dismiss stale pull request approvals when new commits are pushed'
@ -238,7 +238,7 @@ These input values must be the same as any `terraform-plan` for the same configu
```
Running this action will produce a `service_hostname` output with the same value.
See [terraform-output](https://github.com/dflook/terraform-github-actions/tree/master/terraform-output) for details.
See [terraform-output](https://github.com/dflook/terraform-github-actions/tree/main/terraform-output) for details.
## Environment Variables
@ -351,7 +351,7 @@ These input values must be the same as any `terraform-plan` for the same configu
### Apply PR approved plans
This example workflow runs for every push to master. If the commit
This example workflow runs for every push to main. If the commit
came from a PR that has been merged, applies the plan from the PR.
```yaml
@ -360,7 +360,7 @@ name: Apply
on:
push:
branches:
- master
- main
jobs:
apply:
@ -380,7 +380,7 @@ jobs:
### Always apply changes
This example workflow runs for every push to master.
This example workflow runs for every push to main.
Changes are planned and applied.
```yaml
@ -389,7 +389,7 @@ name: Apply
on:
push:
branches:
- master
- main
jobs:
apply:
@ -440,7 +440,7 @@ jobs:
This workflow applies a plan on demand, triggered by someone
commenting `terraform apply` on the PR. The plan is taken
from an existing comment generated by the [`dflook/terraform-plan`](https://github.com/dflook/terraform-github-actions/tree/master/terraform-plan)
from an existing comment generated by the [`dflook/terraform-plan`](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan)
action.
```yaml
@ -475,7 +475,7 @@ name: Apply plan
on:
push:
branches:
- master
- main
jobs:
plan:

Просмотреть файл

@ -20,7 +20,7 @@ If any files are not correctly formatted a failing GitHub check will be added fo
* `workspace`
Terraform workspace to inspect when discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
- Type: string
- Optional
@ -28,7 +28,7 @@ If any files are not correctly formatted a failing GitHub check will be added fo
* `backend_config`
List of terraform backend config values, one per line. This is used for discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
```yaml
with:
@ -41,7 +41,7 @@ If any files are not correctly formatted a failing GitHub check will be added fo
* `backend_config_file`
List of terraform backend config files to use, one per line. This is used for discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
Paths should be relative to the GitHub Actions workspace
```yaml

Просмотреть файл

@ -17,7 +17,7 @@ This action uses the `terraform fmt` command to reformat files in a directory in
* `workspace`
Terraform workspace to inspect when discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
- Type: string
- Optional
@ -25,7 +25,7 @@ This action uses the `terraform fmt` command to reformat files in a directory in
* `backend_config`
List of terraform backend config values, one per line. This is used for discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
```yaml
with:
@ -38,7 +38,7 @@ This action uses the `terraform fmt` command to reformat files in a directory in
* `backend_config_file`
List of terraform backend config files to use, one per line. This is used for discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
Paths should be relative to the GitHub Actions workspace
```yaml
@ -77,7 +77,7 @@ This action uses the `terraform fmt` command to reformat files in a directory in
## Example usage
This example automatically creates a pull request to fix any formatting
problems that get merged into the master branch.
problems that get merged into the main branch.
```yaml
name: Fix terraform file formatting
@ -85,7 +85,7 @@ name: Fix terraform file formatting
on:
push:
branches:
- master
- main
jobs:
format:

Просмотреть файл

@ -12,7 +12,7 @@ If the triggering event relates to a PR it will add a comment on the PR containi
The `GITHUB_TOKEN` environment variable must be set for the PR comment to be added.
The action can be run on other events, which prints the plan to the workflow log.
The [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/master/terraform-apply) action can be used to apply the generated plan.
The [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/main/terraform-apply) action can be used to apply the generated plan.
## Inputs

Просмотреть файл

@ -81,7 +81,7 @@ output "service_hostname" {
}
```
Running this action will produce a `service_hostname` output with the same value.
See [terraform-output](https://github.com/dflook/terraform-github-actions/tree/master/terraform-output) for details.
See [terraform-output](https://github.com/dflook/terraform-github-actions/tree/main/terraform-output) for details.
## Example usage
@ -93,7 +93,7 @@ name: Send request
on:
push:
branches:
- master
- main
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

Просмотреть файл

@ -28,7 +28,7 @@ If the terraform configuration is not valid, the build is failed.
Terraform workspace to use for the `terraform.workspace` value while validating. Note that for remote operations in Terraform Cloud/Enterprise, this is always `default`.
Also used for discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
- Type: string
- Optional
@ -37,7 +37,7 @@ If the terraform configuration is not valid, the build is failed.
* `backend_config`
List of terraform backend config values, one per line. This is used for discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
```yaml
with:
@ -50,7 +50,7 @@ If the terraform configuration is not valid, the build is failed.
* `backend_config_file`
List of terraform backend config files to use, one per line. This is used for discovering the terraform version to use, if not otherwise specified.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/master/terraform-version#terraform-version-action) for details.
See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.
Paths should be relative to the GitHub Actions workspace
```yaml