我一直在玩Git操作和terraform,我注意到如果删除
- uses: hashicorp/setup-terraform@v2
因此,基本上,我的terraform命令仍然成功(请参阅下面的工作流代码),但在工作流期间没有安装terraform。为什么会这样,为什么人们还要使用- uses: hashicorp/setup-terraform@v2步骤如果我仍然可以不使用它运行所有的命令呢?
name: "terraform init"
on:
push:
branches:
- dev
defaults:
run:
working-directory: app1/sub
jobs:
Terraform:
name: Terraform Job
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
# - name: Setup Terraform
# id: terraform-setup
# uses: hashicorp/setup-terraform@v1
- name: Terraform Init
id: init
run: terraform init
- name : terra validate
id: val
run: terraform validate
- id: plan
run: terraform plan -no-color
- run: echo ${{ steps.plan.outputs.stdout }}
- run: echo ${{ steps.plan.outputs.stderr }}
- run: echo ${{ steps.plan.outputs.exitcode }}发布于 2022-07-04 15:42:24
Github托管运行程序附带预先安装的工具和包,其中还包括Terraform。
因为您运行的是ubuntu-最新版本,所以它附带安装了Terraform1.2.3。
人们使用hashicorp/setup-terraform@v1的原因是为了指定希望安装在运行程序上的Terraform的版本。
steps:
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.1.7https://stackoverflow.com/questions/72858337
复制相似问题