Context:
Setting up a GitHub Actions workflow for CXone infrastructure. The goal is to run terraform plan on pull requests to catch drift before merging to main. I have the NICE CXone provider configured with OIDC token exchange. The workflow triggers on pull_request_target.
name: tf-plan
on:
pull_request_target:
types: [opened, synchronize]
jobs:
plan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
- run: terraform init
- run: terraform plan -out=tfplan
Question:
Why does this setting in the workflow cause the plan step to fail with Error: Provider produced inconsistent result after apply when the code hasn’t changed? The state file is stored in remote S3 backend. It seems the provider is fetching live state from the API during the plan, which includes dynamic values like created_date or internal IDs that differ from the committed state file. Is there a flag to ignore these computed fields in the plan output or should I be using terraform refresh before plan?