Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions helper/resource/additional_cli_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ type ApplyOptions struct {
type PlanOptions struct {
// AllowDeferral will pass the experimental `-allow-deferral` flag to the plan command.
AllowDeferral bool

// NoRefresh will pass the `-refresh=false` flag to the plan command.
NoRefresh bool
}
27 changes: 21 additions & 6 deletions helper/resource/testing_new_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@ func testStepNewConfig(ctx context.Context, t testing.T, c TestCase, wd *plugint
opts = append(opts, tfexec.Destroy(true))
}

if c.AdditionalCLIOptions != nil && c.AdditionalCLIOptions.Plan.AllowDeferral {
opts = append(opts, tfexec.AllowDeferral(true))
if c.AdditionalCLIOptions != nil {
if c.AdditionalCLIOptions.Plan.AllowDeferral {
opts = append(opts, tfexec.AllowDeferral(true))
}
if c.AdditionalCLIOptions.Plan.NoRefresh {
opts = append(opts, tfexec.Refresh(false))
}
}

return wd.CreatePlan(ctx, opts...)
Expand Down Expand Up @@ -250,8 +255,13 @@ func testStepNewConfig(ctx context.Context, t testing.T, c TestCase, wd *plugint
opts = append(opts, tfexec.Destroy(true))
}

if c.AdditionalCLIOptions != nil && c.AdditionalCLIOptions.Plan.AllowDeferral {
opts = append(opts, tfexec.AllowDeferral(true))
if c.AdditionalCLIOptions != nil {
if c.AdditionalCLIOptions.Plan.AllowDeferral {
opts = append(opts, tfexec.AllowDeferral(true))
}
if c.AdditionalCLIOptions.Plan.NoRefresh {
opts = append(opts, tfexec.Refresh(false))
}
}

return wd.CreatePlan(ctx, opts...)
Expand Down Expand Up @@ -319,8 +329,13 @@ func testStepNewConfig(ctx context.Context, t testing.T, c TestCase, wd *plugint
}
}

if c.AdditionalCLIOptions != nil && c.AdditionalCLIOptions.Plan.AllowDeferral {
opts = append(opts, tfexec.AllowDeferral(true))
if c.AdditionalCLIOptions != nil {
if c.AdditionalCLIOptions.Plan.AllowDeferral {
opts = append(opts, tfexec.AllowDeferral(true))
}
if c.AdditionalCLIOptions.Plan.NoRefresh {
opts = append(opts, tfexec.Refresh(false))
}
}

return wd.CreatePlan(ctx, opts...)
Expand Down