Merge branch 'main' into use-tool-versions

This commit is contained in:
Luke van der Hoeven 2023-11-08 11:24:11 -05:00 committed by GitHub
commit 976a82e7ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 50991 additions and 3166 deletions

11
.changes/3.0.0.md Normal file
View file

@ -0,0 +1,11 @@
## 3.0.0 (2023-10-30)
NOTES:
* Updated default runtime to node20 ([#346](https://github.com/hashicorp/setup-terraform/issues/346))
* The wrapper around the installed Terraform binary has been fixed to return the exact STDOUT and STDERR from Terraform when executing commands. Previous versions of setup-terraform may have required workarounds to process the STDOUT in bash, such as filtering out the first line or selectively parsing STDOUT with jq. These workarounds may need to be adjusted with `v3.0.0`, which will now return just the STDOUT/STDERR from Terraform with no errant characters/statements. ([#367](https://github.com/hashicorp/setup-terraform/issues/367))
BUG FIXES:
* Fixed malformed stdout when wrapper is enabled ([#367](https://github.com/hashicorp/setup-terraform/issues/367))

View file

@ -4,7 +4,3 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View file

@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Set Issue to 'Priority = Triage Next'"
uses: leonsteinhaeuser/project-beta-automations@d1c1261558118c0876fdb2b57a649303925e5a70 # v2.1.0
uses: leonsteinhaeuser/project-beta-automations@939000fb1900c9fc4f7b5058a09d9f833ebc6859 # v2.2.1
if: github.event_name == 'issues'
with:
gh_token: ${{ secrets.TF_DEVEX_PROJECT_GITHUB_TOKEN }}
@ -29,7 +29,7 @@ jobs:
operation_mode: custom_field
custom_field_values: '[{\"name\":\"Priority\",\"type\":\"single_select\",\"value\":\"Triage Next\"}]'
- name: "Set Pull Request to 'Priority = Triage Next'"
uses: leonsteinhaeuser/project-beta-automations@d1c1261558118c0876fdb2b57a649303925e5a70 # v2.1.0
uses: leonsteinhaeuser/project-beta-automations@939000fb1900c9fc4f7b5058a09d9f833ebc6859 # v2.2.1
if: github.event_name == 'pull_request'
with:
gh_token: ${{ secrets.TF_DEVEX_PROJECT_GITHUB_TOKEN }}

View file

@ -11,7 +11,7 @@ jobs:
copywrite:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2
- run: copywrite headers --plan
- run: copywrite license --plan

View file

@ -10,6 +10,13 @@ jobs:
check-dist:
name: Check dist/ directory
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@a8533f184b279cfc1b2dd6a96ed2f097ccf81189
with:
node-version: 20.x
node-caching: npm
test:
name: Test
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@a8533f184b279cfc1b2dd6a96ed2f097ccf81189
with:
node-version: 20.x
node-caching: npm

View file

@ -1,5 +1,5 @@
resource "null_resource" "null" {
triggers = {
value = timestamp()
}
resource "random_pet" "pet" {}
output "pet" {
value = random_pet.pet.id
}

View file

@ -37,19 +37,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
# Avoid persisting GITHUB_TOKEN credentials as they take priority over our service account PAT for `git push` operations
# More details: https://github.com/actions/checkout/blob/b4626ce19ce1106186ddf9bb20e706842f11a7c3/adrs/0153-checkout-v2.md#persist-credentials
persist-credentials: false
- name: Batch changes
uses: miniscruff/changie-action@b6d52c80deb236a5b548f8774cd5a18b87da9e9a # v1.0.1
uses: miniscruff/changie-action@6dcc2533cac0495148ed4046c438487e4dceaa23 # v2
with:
version: latest
args: batch ${{ needs.changelog-version.outputs.version }}
- name: Merge changes
uses: miniscruff/changie-action@b6d52c80deb236a5b548f8774cd5a18b87da9e9a # v1.0.1
uses: miniscruff/changie-action@6dcc2533cac0495148ed4046c438487e4dceaa23 # v2
with:
version: latest
args: merge
@ -66,7 +66,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
# Default input is the SHA that initially triggered the workflow. As we created a new commit in the previous job,
@ -77,9 +77,9 @@ jobs:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 18
node-version: 20
- name: Update package version
run: npm version "${{ inputs.versionNumber }}" --git-tag-version false
- name: Git push
@ -95,7 +95,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
# Default input is the SHA that initially triggered the workflow. As we created a new commit in the previous job,
@ -121,7 +121,7 @@ jobs:
permissions:
contents: write # Needed to create GitHub release
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ inputs.versionNumber }}
fetch-depth: 0

View file

@ -1,4 +1,4 @@
name: 'Setup Terraform'
name: 'setup-terraform tests'
on:
push:
@ -20,7 +20,7 @@ jobs:
terraform-versions: [0.11.14, latest]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform - ${{ matrix['terraform-versions'] }}
uses: ./
@ -44,7 +44,7 @@ jobs:
terraform-versions: [0.11.14, latest]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform (no wrapper) - ${{ matrix['terraform-versions'] }}
uses: ./
@ -69,7 +69,7 @@ jobs:
terraform-versions: [~0.12, 0.12.x, <0.13.0]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform - ${{ matrix['terraform-versions'] }}
uses: ./
@ -88,7 +88,7 @@ jobs:
terraform-versions: [~0.12, 0.12.x, <0.13.0]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform (no wrapper) - ${{ matrix['terraform-versions'] }}
uses: ./
@ -109,7 +109,7 @@ jobs:
TF_CLOUD_API_TOKEN: 'XXXXXXXXXXXXXX.atlasv1.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
@ -138,7 +138,7 @@ jobs:
TF_CLOUD_API_TOKEN: 'XXXXXXXXXXXXXX.atlasv1.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
@ -166,7 +166,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
@ -189,7 +189,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
@ -220,7 +220,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
@ -253,29 +253,26 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
shell: bash
working-directory: ./.github/workflows/data/local
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
- name: Terraform Init
shell: bash
run: terraform init
- name: Terraform Format
shell: bash
run: terraform fmt -check
- name: Terraform Plan
id: plan
shell: bash
run: terraform plan
- name: Print Terraform Plan
shell: bash
run: echo "${{ steps.plan.outputs.stdout }}"
terraform-run-local-no-wrapper:
@ -286,10 +283,11 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
shell: bash
working-directory: ./.github/workflows/data/local
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
@ -297,14 +295,78 @@ jobs:
terraform_wrapper: false
- name: Terraform Init
shell: bash
run: terraform init
- name: Terraform Format
shell: bash
run: terraform fmt -check
- name: Terraform Plan
id: plan
shell: bash
run: terraform plan
terraform-stdout-wrapper:
name: 'Terraform STDOUT'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
shell: bash
working-directory: ./.github/workflows/data/local
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
with:
terraform_wrapper: true
- name: Terraform Init
run: terraform init
- name: Terraform Format
run: terraform fmt -check
- name: Terraform Apply
id: apply
run: terraform apply -auto-approve
- name: Terraform Output to JQ
id: output
run: terraform output -json | jq '.pet.value'
terraform-stdout-no-wrapper:
name: 'Terraform STDOUT No Wrapper'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
shell: bash
working-directory: ./.github/workflows/data/local
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: ./
with:
terraform_wrapper: false
- name: Terraform Init
run: terraform init
- name: Terraform Format
run: terraform fmt -check
- name: Terraform Apply
id: apply
run: terraform apply -auto-approve
- name: Terraform Output to JQ
id: output
run: terraform output -json | jq '.pet.value'

View file

@ -1,3 +1,14 @@
## 3.0.0 (2023-10-30)
NOTES:
* Updated default runtime to node20 ([#346](https://github.com/hashicorp/setup-terraform/issues/346))
* The wrapper around the installed Terraform binary has been fixed to return the exact STDOUT and STDERR from Terraform when executing commands. Previous versions of setup-terraform may have required workarounds to process the STDOUT in bash, such as filtering out the first line or selectively parsing STDOUT with jq. These workarounds may need to be adjusted with `v3.0.0`, which will now return just the STDOUT/STDERR from Terraform with no errant characters/statements. ([#367](https://github.com/hashicorp/setup-terraform/issues/367))
BUG FIXES:
* Fixed malformed stdout when wrapper is enabled ([#367](https://github.com/hashicorp/setup-terraform/issues/367))
# [2.0.3] (2022-11-01)
### NOTES

View file

@ -28,7 +28,7 @@ A specific version of Terraform CLI can be installed:
steps:
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.1.7
terraform_version: "1.1.7"
```
Credentials for Terraform Cloud ([app.terraform.io](https://app.terraform.io/)) can be configured:
@ -248,7 +248,7 @@ The action supports the following inputs:
place within the credentials block of the Terraform CLI configuration file.
- `terraform_version` - (optional) The version of Terraform CLI to install. Instead of a full version string,
you can also specify a constraint string (see [Semver Ranges](https://www.npmjs.com/package/semver#ranges)
for available range specifications). Examples are: `<1.2.0`, `~1.1.0`, `1.1.7` (all three installing
for available range specifications). Examples are: `"<1.2.0"`, `"~1.1.0"`, `"1.1.7"` (all three installing
the latest available `1.1` version). Prerelease versions can be specified and a range will stay within the
given tag such as `beta` or `rc`. If no version is given, it will default to `latest`.
- `terraform_wrapper` - (optional) Whether to install a wrapper to wrap subsequent calls of

View file

@ -18,7 +18,7 @@ inputs:
default: 'true'
required: false
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
branding:
icon: 'terminal'

23830
dist/index.js vendored

File diff suppressed because one or more lines are too long

23312
dist/index1.js vendored

File diff suppressed because one or more lines are too long

6805
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "setup-terraform",
"version": "2.0.2",
"version": "3.0.0",
"description": "Setup Terraform CLI for GitHub Actions",
"license": "MPL-2.0",
"publisher": "hashicorp",
@ -19,19 +19,19 @@
"keywords": [],
"author": "",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^5.1.1",
"@actions/github": "^6.0.0",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
"@hashicorp/js-releases": "^1.6.1"
"@hashicorp/js-releases": "^1.7.1"
},
"devDependencies": {
"@vercel/ncc": "^0.36.1",
"@vercel/ncc": "^0.38.1",
"husky": "^8.0.3",
"jest": "^29.5.0",
"nock": "^13.3.1",
"semistandard": "^16.0.1"
"jest": "^29.7.0",
"nock": "^13.3.8",
"semistandard": "^17.0.0"
},
"semistandard": {
"ignore": [

View file

@ -33,13 +33,14 @@ async function checkTerraform () {
const args = process.argv.slice(2);
const options = {
listeners,
ignoreReturnCode: true
ignoreReturnCode: true,
silent: true, // avoid printing command in stdout: https://github.com/actions/toolkit/issues/649
};
const exitCode = await exec(pathToCLI, args, options);
core.debug(`Terraform exited with code ${exitCode}.`);
core.debug(`stdout: ${stdout.contents}`);
core.debug(`stderr: ${stderr.contents}`);
core.debug(`exitcode: ${exitCode}`);
// Pass-through stdout/err as `exec` won't due to `silent: true` option
process.stdout.write(stdout.contents);
process.stderr.write(stderr.contents);
// Set outputs, result, exitcode, and stderr
core.setOutput('stdout', stdout.contents);