diff --git a/sdk/provision/file_provisioner.go b/sdk/provision/file_provisioner.go index 4d5d6041d..ce24d898b 100644 --- a/sdk/provision/file_provisioner.go +++ b/sdk/provision/file_provisioner.go @@ -159,7 +159,7 @@ func (p FileProvisioner) Provision(ctx context.Context, in sdk.ProvisionInput, o argsResolved[i] = result.String() } - out.AddArgs(argsResolved...) + out.PrependArgs(argsResolved...) } } diff --git a/sdk/provisioner.go b/sdk/provisioner.go index 99883ffae..e3be7cc17 100644 --- a/sdk/provisioner.go +++ b/sdk/provisioner.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "path/filepath" + "slices" "time" ) @@ -107,6 +108,11 @@ func (out *ProvisionOutput) AddArgs(args ...string) { out.CommandLine = append(out.CommandLine, args...) } +// PrependArgs can be used to insert additional arguments at the beginning of the command line of the provision output. +func (out *ProvisionOutput) PrependArgs(args ...string) { + out.CommandLine = slices.Insert(out.CommandLine, 1, args...) +} + // AddSecretFile can be used to add a file containing secrets to the provision output. func (out *ProvisionOutput) AddSecretFile(path string, contents []byte) { out.AddFile(path, OutputFile{