我有一份工作,有一个名为“Terraform Plan”的步骤,ID 为“plan”。我想打印此步骤的标准输出和标准错误。但不幸的是我无法获取该信息。
回显 ${{ toJSON(steps.plan) }}
echo {
"outputs": {
"tfplan_identifier": "tfplan-expected"
},
"outcome": "failure",
"conclusion": "success"
}
如何获取标准输出和标准错误。
${{ steps.plan.outputs.stderr }}
返回 null。
plan:
needs: [conflict, format, validate, lint, security]
name: plan
runs-on: ubuntu-latest
outputs:
tfplan_identifier: ${{ steps.plan.outputs.tfplan_identifier }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-east-2
aws-access-key-id: ${{ secrets.TERRAFORM_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.TERRAFORM_AWS_SECRET_ACCESS_KEY }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.7
terraform_wrapper: false
- name: Terraform Init
id: init
run: terraform init -backend-config=prod.s3.tfbackend
- name: Terraform Workspace
run: terraform workspace select prod || terraform workspace new prod
- name: Terraform Plan
id: plan
continue-on-error: true
run: |
tfplan_identifier=tfplan-expected
echo "tfplan_identifier=$tfplan_identifier" >> $GITHUB_OUTPUT
terraform plan -var-file="prod.tfvars" -input=false -no-color -out=${tfplan_identifier}
terraform show -no-color tfplan-actual > plan.log
- name: Output
run: |
echo ${{ toJSON(steps.plan) }}
echo ${{ steps.plan.outputs.stderr }}
```
请将其更改为以下块,