Browse Source
Merge pull request #120 from jdamata/master
add the -refresh option to plan and apply
pull/128/head
Jacob McCann
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
16 additions and
0 deletions
-
DOCS.md
-
main.go
-
plugin.go
|
|
@ -269,3 +269,6 @@ parallelism |
|
|
|
|
|
|
|
tf_data_dir |
|
|
|
: changes the location where Terraform keeps its per-working-directory data, such as the current remote backend configuration. |
|
|
|
|
|
|
|
disable_refresh |
|
|
|
: (default: `false`) - whether or not to disable refreshing state before `plan` and `apply` commands. |
|
|
|
|
|
@ -114,6 +114,11 @@ func main() { |
|
|
|
Usage: "changes the location where Terraform keeps its per-working-directory data, such as the current remote backend configuration", |
|
|
|
EnvVar: "PLUGIN_TF_DATA_DIR", |
|
|
|
}, |
|
|
|
cli.BoolFlag{ |
|
|
|
Name: "disable_refresh", |
|
|
|
Usage: "whether or not to disable refreshing state before `plan` and `apply` commands", |
|
|
|
EnvVar: "PLUGIN_DISABLE_REFRESH", |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
if err := app.Run(os.Args); err != nil { |
|
|
@ -163,6 +168,7 @@ func run(c *cli.Context) error { |
|
|
|
Targets: c.StringSlice("targets"), |
|
|
|
VarFiles: c.StringSlice("var_files"), |
|
|
|
TerraformDataDir: c.String("tf_data_dir"), |
|
|
|
DisableRefresh: c.Bool("disable_refresh"), |
|
|
|
}, |
|
|
|
Netrc: Netrc{ |
|
|
|
Login: c.String("netrc.username"), |
|
|
|
|
|
@ -34,6 +34,7 @@ type ( |
|
|
|
Targets []string |
|
|
|
VarFiles []string |
|
|
|
TerraformDataDir string |
|
|
|
DisableRefresh bool |
|
|
|
} |
|
|
|
|
|
|
|
// Netrc is credentials for cloning
|
|
|
@ -270,6 +271,9 @@ func tfApply(config Config) *exec.Cmd { |
|
|
|
if config.InitOptions.LockTimeout != "" { |
|
|
|
args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout)) |
|
|
|
} |
|
|
|
if config.DisableRefresh { |
|
|
|
args = append(args, "-refresh=false") |
|
|
|
} |
|
|
|
args = append(args, getTfoutPath()) |
|
|
|
|
|
|
|
return exec.Command( |
|
|
@ -328,6 +332,9 @@ func tfPlan(config Config, destroy bool) *exec.Cmd { |
|
|
|
if config.InitOptions.LockTimeout != "" { |
|
|
|
args = append(args, fmt.Sprintf("-lock-timeout=%s", config.InitOptions.LockTimeout)) |
|
|
|
} |
|
|
|
if config.DisableRefresh { |
|
|
|
args = append(args, "-refresh=false") |
|
|
|
} |
|
|
|
return exec.Command( |
|
|
|
"terraform", |
|
|
|
args..., |
|
|
|