Browse Source

Fix for handling targets

pull/134/head
Jeff Fairchild 3 years ago
parent
commit
1849700592
No known key found for this signature in database GPG Key ID: 7AC918D1D5F6328E
  1. 1
      go.sum
  2. 2
      plugin.go
  3. 2
      plugin_test.go

1
go.sum

@ -16,4 +16,5 @@ github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/urfave/cli v0.0.0-20161006035353-55f715e28c46 h1:EztUvugq7AA7F3lYLmtFQyvKdcY5pisPt10DqPjRCL8=
github.com/urfave/cli v0.0.0-20161006035353-55f715e28c46/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/sys v0.0.0-20161006025142-8d1157a43547 h1:lieXmNKpDj68llh9S3E0TfOPO3kHHn5jt5d/2nmylEc=
golang.org/x/sys v0.0.0-20161006025142-8d1157a43547/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

2
plugin.go

@ -250,7 +250,7 @@ func tfApply(config Config) *exec.Cmd {
"apply",
}
for _, v := range config.Targets {
args = append(args, "--target", fmt.Sprintf("%s", v))
args = append(args, fmt.Sprintf("-target=%s", v))
}
if config.Parallelism > 0 {
args = append(args, fmt.Sprintf("-parallelism=%d", config.Parallelism))

2
plugin_test.go

@ -89,7 +89,7 @@ func TestPlugin(t *testing.T) {
{
"with targets",
args{config: Config{Targets: []string{"target1", "target2"}}},
exec.Command("terraform", "apply", "--target", "target1", "--target", "target2", "plan.tfout"),
exec.Command("terraform", "apply", "-target=target1", "-target=target2", "plan.tfout"),
},
}

Loading…
Cancel
Save