-
Notifications
You must be signed in to change notification settings - Fork 126
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Use Case
There are a number of instances in which it would be useful to execute Terraform commands (e.g., terraform apply) with the -json
flag. For instance, in order to be able to robustly identify warnings that have been emitted during the execution of a Terraform command, it would be useful to be able to capture the JSON output from the command and subsequently parse and interrogate it.
Proposal
Add the following functions to terraform exec:
ApplyJSON(ctx context.Context, w io.Writer, opts ...ApplyOption) error
PlanJSON(ctx context.Context, w io.Writer, opts ...PlanOption) (bool, error)
RefreshJSON(ctx context.Context, w io.Writer, opts ...RefreshCmdOption) error
DestroyJSON(ctx context.Context, w io.Writer, opts ...DestroyOption) error
Note that Validate(ctx context.Context) (*tfjson.ValidateOutput, error)
is already running terraform refresh with the -json
flag
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request