-
Notifications
You must be signed in to change notification settings - Fork 125
Add functions that run Terraform commands with -json flag #353
Copy link
Copy link
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) errorPlanJSON(ctx context.Context, w io.Writer, opts ...PlanOption) (bool, error)RefreshJSON(ctx context.Context, w io.Writer, opts ...RefreshCmdOption) errorDestroyJSON(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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request