Change message sent to remote backend if -target used
This commit is contained in:
parent
16f1f3b739
commit
650a272a1d
|
@ -760,6 +760,10 @@ func (m *mockRuns) Create(ctx context.Context, options tfe.RunCreateOptions) (*t
|
||||||
TargetAddrs: options.TargetAddrs,
|
TargetAddrs: options.TargetAddrs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.Message != nil {
|
||||||
|
r.Message = *options.Message
|
||||||
|
}
|
||||||
|
|
||||||
if pc != nil {
|
if pc != nil {
|
||||||
r.PolicyChecks = []*tfe.PolicyCheck{pc}
|
r.PolicyChecks = []*tfe.PolicyCheck{pc}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,9 +209,14 @@ in order to capture the filesystem context the remote workspace expects:
|
||||||
"Failed to upload configuration files", errors.New("operation timed out"))
|
"Failed to upload configuration files", errors.New("operation timed out"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queueMessage := "Queued manually using Terraform"
|
||||||
|
if op.Targets != nil {
|
||||||
|
queueMessage = "Queued manually via Terraform using -target"
|
||||||
|
}
|
||||||
|
|
||||||
runOptions := tfe.RunCreateOptions{
|
runOptions := tfe.RunCreateOptions{
|
||||||
IsDestroy: tfe.Bool(op.Destroy),
|
IsDestroy: tfe.Bool(op.Destroy),
|
||||||
Message: tfe.String("Queued manually using Terraform"),
|
Message: tfe.String(queueMessage),
|
||||||
ConfigurationVersion: cv,
|
ConfigurationVersion: cv,
|
||||||
Workspace: w,
|
Workspace: w,
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,6 +301,10 @@ func TestRemote_planWithTarget(t *testing.T) {
|
||||||
if diff := cmp.Diff([]string{"null_resource.foo"}, run.TargetAddrs); diff != "" {
|
if diff := cmp.Diff([]string{"null_resource.foo"}, run.TargetAddrs); diff != "" {
|
||||||
t.Errorf("wrong TargetAddrs in the created run\n%s", diff)
|
t.Errorf("wrong TargetAddrs in the created run\n%s", diff)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !strings.Contains(run.Message, "using -target") {
|
||||||
|
t.Fatalf("incorrrect Message on the created run: %s", run.Message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue