Skip to content

Failure when plan has objects changed outside of terraform #433

@wyardley

Description

@wyardley

Describe the bug

I'm getting an error about labels (maybe an expected one?) and then a workflow failure at the Run # Post output. step when planning a few states (other states seem to be planning without error).
FWIW, we have a workflow that plans multiple states in parallel in different workflows using a shared workflow.

The common factor seems to be that the failing states have "objects changed outside of Terraform" warnings (see below).

Expected behavior

The state to plan without error

Screenshots

Finalizing artifact upload
Artifact terraform-245-5d8ad38495b4c9aeabbdccb2f90821e0.tfplan.zip successfully finalized. Artifact ID 2685240083
Artifact terraform-245-5d8ad38495b4c9aeabbdccb2f90821e0.tfplan has been successfully uploaded! Final size is 104125 bytes. Artifact ID is 2685240083
Artifact download URL: https://github.com/team-settle/terraform/actions/runs/13641722770/artifacts/2685240083
Run # Post output.
Error: Process completed with exit code 1.

In the details bit under Run # Post output., I don't see any useful output

Additional context

I am thinking the issue may be related to there being an "objects changed outside of Terraform" warning

 Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:

  # module.staging_gke.google_container_cluster.primary has changed
  ~ resource "google_container_cluster" "primary" {
        id                                       = "projects/xxx/locations/us-central1/clusters/yyyy"
      ~ master_version                           = "1.30.9-gke.1046000" -> "1.30.9-gke.1127000"
        name                                     = "yyyy"
        # (34 unchanged attributes hidden)

      ~ node_pool {
            name                        = "default-pool"
          ~ version                     = "1.30.9-gke.1046000" -> "1.30.9-gke.1127000"
            # (7 unchanged attributes hidden)

            # (5 unchanged blocks hidden)
        }
      ~ node_pool {
            name                        = "pool-1"
          ~ version                     = "1.30.9-gke.1046000" -> "1.30.9-gke.1127000"
            # (7 unchanged attributes hidden)

            # (5 unchanged blocks hidden)
        }

        # (38 unchanged blocks hidden)
    }

I also see the labels error mentioned in #432, but I think it's a red herring.

To Reproduce

Try planning a state which has objects that have changed out of band since the state was last planned (for example, a GKE cluster version change from auto-updates). You could likely trigger this by changing a computed value outside of tf.

Existing config:
Other than the steps that checkout the code, run init / lint / tflint / etc. (we run those separately from the builtin hooks for that in this action), all we've got in the config is:

      - name: Provision TF
        uses: op5dev/tf-via-pr@v13
        with:
          working-directory: ${{ inputs.working-directory }}
          command: ${{ github.event_name == 'push' && 'apply' || 'plan' }}
          arg-lock: ${{ github.event_name == 'push' }}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions