-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package terra | ||
|
||
// Show calls terraform show in json mode with the given options and returns stdout from the command. If | ||
// PlanFilePath is set on the options, this will show the plan file. Otherwise, this will show the current state of the | ||
// terraform module at options.TerraformDir. This will fail the test if there is an error in the command. | ||
func Show(options *Options) (string, error) { | ||
// We manually construct the args here instead of using `FormatArgs`, because show only accepts a limited set of | ||
// args. | ||
args := []string{"show", "-no-color", "-json"} | ||
|
||
// Attach plan file path if specified. | ||
if options.PlanFilePath != "" { | ||
args = append(args, options.PlanFilePath) | ||
} | ||
return RunTerraformCommandAndGetStdoutE(options, args...) | ||
} |