Skip to content

Commit

Permalink
allow disablign PRC via env var
Browse files Browse the repository at this point in the history
  • Loading branch information
VenelinMartinov committed Jun 10, 2024
1 parent f5a6151 commit 84759f0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/tfshim/sdk-v2/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -62,9 +63,16 @@ func NewProvider(p *schema.Provider, opts ...providerOption) shim.Provider {
tf: p,
opts: opts,
}
if cmdutil.IsTruthy(os.Getenv("PULUMI_ENABLE_PLAN_RESOURCE_CHANGE")) {

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

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

if opts, err := getProviderOptions(opts); err == nil && opts.planResourceChangeFilter != nil {
return newProviderWithPlanResourceChange(p, prov, opts.planResourceChangeFilter)
}
Expand Down

0 comments on commit 84759f0

Please sign in to comment.