Introduction
Problem
Generating a JSON version of a saved plan file may fail on Terraform v1.0.1. This issue has been specifically observed in environments which are running a Terraform cloud agent.
Prerequisites
- Terraform v1.0.1
- terraform show JSON
- terraform plan -out=plan.out
- terraform show -json plan.out
Cause
-
In Terraform v1.0.1, we mark the resource instance value with any marks stored in
AttrSensitivePathsto build the SensitiveValues object. -
ResourceInstanceObjectSrc.Decodehandles marking the decoded values with any marks stored inAttrSensitivePaths, therefore re-applying those marks is not necessary and causes the JSON failed issue.
Solution
- This issue was fixed in Terraform v1.0.2.
Additional Information
-
GitHub Issue - https://github.com/hashicorp/terraform/issues/29042
- Pull Request - https://github.com/hashicorp/terraform/pull/29049