hashicorp / tfc-workflows-github

HCP Terraform starter workflows and github actions to automate Terraform Cloud CI/CD pipelines.
Mozilla Public License 2.0
124 stars 20 forks source link

error retrieving plan data resource not found #21

Closed AHaydar closed 10 months ago

AHaydar commented 10 months ago

Hey, I've been trying to create a run in the first job, then apply the run in the second job, passing the run ID through. However, this isn't working.

Here's the last step of the first job along the outputs of the job:

   - name: Create Apply Run
        uses: hashicorp/tfc-workflows-github/actions/create-run@v1.0.0
        id: create-run
        with:
          workspace: ${{ env.TF_WORKSPACE }}
          configuration_version: ${{ steps.apply-upload.outputs.configuration_version_id }}
    outputs:
      terraform_run_id: ${{ steps.create-run.outputs.run_id }}

So I am passing the run_id to the second job, where I use it in the first step to display the output of the plan as follows:

 steps:
      - uses: hashicorp/tfc-workflows-github/actions/plan-output@v1.0.4
        id: plan-output
        with:
          plan: ${{ needs.first-job.outputs.terraform_run_id }}

However, the first step of the second job is returning the following error:

error retrieving plan data resource not found

{
  "status": "Error"
}

The run_id that's used is the correct one that's been generated in the create_run of the previous job. I would appreciate some help to identify and fix the issue.

AHaydar commented 10 months ago

I figured the plan-output requires a plan_id and I was passing the run_id. Changing this fixed the issue.