Browse Source

Merge 2b267cbd5f into 24156d51b0

pull/133/merge
Michal Knapcok 3 years ago
committed by GitHub
parent
commit
07b67decea
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      DOCS.md
  2. 6
      main.go
  3. 4
      plugin.go

3
DOCS.md

@ -272,3 +272,6 @@ tf_data_dir
disable_refresh disable_refresh
: (default: `false`) - whether or not to disable refreshing state before `plan` and `apply` commands. : (default: `false`) - whether or not to disable refreshing state before `plan` and `apply` commands.
detailed_exitcode
: (default: `false`) - whether or not to use flag `-detailed-exitcode` with `plan` command.

6
main.go

@ -119,6 +119,11 @@ func main() {
Usage: "whether or not to disable refreshing state before `plan` and `apply` commands", Usage: "whether or not to disable refreshing state before `plan` and `apply` commands",
EnvVar: "PLUGIN_DISABLE_REFRESH", EnvVar: "PLUGIN_DISABLE_REFRESH",
}, },
cli.BoolFlag{
Name: "detailed_exitcode",
Usage: "whether or not to use flag `-detailed-exitcode` with `plan` command",
EnvVar: "PLUGIN_DETAILED_EXITCODE",
},
} }
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {
@ -169,6 +174,7 @@ func run(c *cli.Context) error {
VarFiles: c.StringSlice("var_files"), VarFiles: c.StringSlice("var_files"),
TerraformDataDir: c.String("tf_data_dir"), TerraformDataDir: c.String("tf_data_dir"),
DisableRefresh: c.Bool("disable_refresh"), DisableRefresh: c.Bool("disable_refresh"),
DetailedExitcode: c.Bool("detailed_exitcode"),
}, },
Netrc: Netrc{ Netrc: Netrc{
Login: c.String("netrc.username"), Login: c.String("netrc.username"),

4
plugin.go

@ -35,6 +35,7 @@ type (
VarFiles []string VarFiles []string
TerraformDataDir string TerraformDataDir string
DisableRefresh bool DisableRefresh bool
DetailedExitcode bool
} }
// Netrc is credentials for cloning // Netrc is credentials for cloning
@ -325,6 +326,9 @@ func tfPlan(config Config, destroy bool) *exec.Cmd {
if config.DisableRefresh { if config.DisableRefresh {
args = append(args, "-refresh=false") args = append(args, "-refresh=false")
} }
if config.DetailedExitcode {
args = append(args, "-detailed-exitcode")
}
return exec.Command( return exec.Command(
"terraform", "terraform",
args..., args...,

Loading…
Cancel
Save