Skip to content

Commit

Permalink
Update pkg/tfshim/sdk-v2/provider.go
Browse files Browse the repository at this point in the history
Co-authored-by: Ian Wahbe <[email protected]>
  • Loading branch information
VenelinMartinov and iwahbe authored Jun 10, 2024
1 parent 84759f0 commit 52191a2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/tfshim/sdk-v2/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,18 @@ func NewProvider(p *schema.Provider, opts ...providerOption) shim.Provider {
opts: opts,
}

envPRC := os.Getenv("PULUMI_ENABLE_PLAN_RESOURCE_CHANGE")
if cmdutil.IsTruthy(envPRC) {
const envPRCVar = "PULUMI_ENABLE_PLAN_RESOURCE_CHANGE"
envPRC := os.Getenv(envPRCVar)
switch {
case cmdutil.IsTruthy(envPRC):
return newProviderWithPlanResourceChange(p, prov, func(s string) bool { return true })
}

if strings.EqualFold(envPRC, "false") || envPRC == "0" {
case strings.EqualFold(envPRC, "false") || envPRC == "0":
return prov
case "":

Check failure on line 74 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / lint

cannot convert "" (untyped string constant) to type bool

Check failure on line 74 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / lint

cannot convert "" (untyped string constant) to type bool

Check failure on line 74 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / lint

cannot convert "" (untyped string constant) to type bool

Check failure on line 74 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / test (1.21.x, ubuntu-latest)

cannot convert "" (untyped string constant) to type bool

Check failure on line 74 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / test (1.22.x, ubuntu-latest)

cannot convert "" (untyped string constant) to type bool
// Do nothing, we will apply the default below.
default:
// The user set PULUMI_ENABLE_PLAN_RESOURCE_CHANGE to a value that isn't valid.
warn("%s is not a valid value for %s", envPRC, envPRCVar)

Check failure on line 78 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / lint

undefined: warn) (typecheck)

Check failure on line 78 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / lint

undefined: warn) (typecheck)

Check failure on line 78 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / test (1.21.x, ubuntu-latest)

undefined: warn

Check failure on line 78 in pkg/tfshim/sdk-v2/provider.go

View workflow job for this annotation

GitHub Actions / Test and Lint / test (1.22.x, ubuntu-latest)

undefined: warn
}

if opts, err := getProviderOptions(opts); err == nil && opts.planResourceChangeFilter != nil {
Expand Down

0 comments on commit 52191a2

Please sign in to comment.