github.com/opentofu/opentofu@v1.7.1/internal/cloud/cloudplan/remote_plan_json.go (about) 1 // Copyright (c) The OpenTofu Authors 2 // SPDX-License-Identifier: MPL-2.0 3 // Copyright (c) 2023 HashiCorp, Inc. 4 // SPDX-License-Identifier: MPL-2.0 5 6 package cloudplan 7 8 import ( 9 "github.com/opentofu/opentofu/internal/plans" 10 ) 11 12 // RemotePlanJSON is a wrapper struct that associates a pre-baked JSON plan with 13 // several pieces of metadata that can't be derived directly from the JSON 14 // contents and must instead be discovered from a tfe.Run or tfe.Plan. The 15 // wrapper is useful for moving data between the Cloud backend (which is the 16 // only thing able to fetch the JSON and determine values for the metadata) and 17 // the command.ShowCommand and views.Show interface (which need to have all of 18 // this information together). 19 type RemotePlanJSON struct { 20 // The raw bytes of json we got from the API. 21 JSONBytes []byte 22 // Indicates whether the json bytes are the "redacted json plan" format, or 23 // the unredacted stable "external json plan" format. These formats are 24 // actually very different under the hood; the redacted one can be decoded 25 // directly into a jsonformat.Plan struct and is intended for formatting a 26 // plan for human consumption, while the unredacted one matches what is 27 // returned by the jsonplan.Marshal() function, cannot be directly decoded 28 // into a public type (it's actually a jsonplan.plan struct), and will 29 // generally be spat back out verbatim. 30 Redacted bool 31 // Normal/destroy/refresh. Required by (jsonformat.Renderer).RenderHumanPlan. 32 Mode plans.Mode 33 // Unchanged/errored. Required by (jsonformat.Renderer).RenderHumanPlan. 34 Qualities []plans.Quality 35 // A human-readable header with a link to view the associated run in the 36 // Terraform Cloud UI. 37 RunHeader string 38 // A human-readable footer with information relevant to the likely next 39 // actions for this plan. 40 RunFooter string 41 }