我正在使用 Github actions 设置 Terragrunt 管道,并使用 Gruntwork IO Terragrunt action。
name: Deploy customer changes
on: push
env:
TF_VERSION: 1.5.1
TG_VERSION: 0.55.21
permissions:
id-token: write
contents: read
jobs:
terragrunt-plan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Plan
uses: gruntwork-io/terragrunt-action@v2
env:
INPUT_PRE_EXEC_1: |
git config --global url."https://oauth2:${{ secrets.ABC_TEST_ORG_CICD_TOKEN }}@github.com".insteadOf "ssh://[email protected]"
with:
tf_version: ${{ env.TF_VERSION }}
tg_version: ${{ env.TG_VERSION }}
tg_dir: ${{ env.WORKING_DIR }}/00_aft
tg_command: plan -out $(pwd)terragrunt.tfplan
现在,我想输出 Terragrunt 计划文件以将其传递给下一个作业(应用,不是这个问题的一部分)。这是上述文件的最后一行。
tg_command: plan -out $(pwd)terragrunt.tfplan
这可行,但我不知道为什么。对我来说,它应该带有
/
或使用带有环境变量的路径,例如
tg_command: plan -out {{ github.workspace }}/terragrunt.tfplan
tg_command: plan -out "{{ github.workspace }}/terragrunt.tfplan"
tg_command: plan -out $(pwd)/terragrunt.tfplan
我检查过
$(pwd)
是否有尾随 /
,但没有。
我使用此命令时遇到的错误是
╷
│ Error: Failed to write plan file
│
│ The plan file could not be written: open
│ /home/runner/work/<path>/terragrunt.tfplan:
│ no such file or directory.
╵
我还尝试在填充之前创建一个空计划文件,但没有成功。
我错过了什么?
我设法通过命令组合使其工作。 查看我提出的Github问题的评论