Skip to content

Commit

Permalink
Add plan resource change env var (#1983)
Browse files Browse the repository at this point in the history
Adds an env var to enable PlanResourceChange. This should be useful in
debugging.
  • Loading branch information
VenelinMartinov authored May 16, 2024
1 parent 1c1c073 commit fb50112
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/tfshim/sdk-v2/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package sdkv2
import (
"context"
"fmt"
"os"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
testing "github.com/mitchellh/go-testing-interface"
shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
)

var _ = shim.Provider(v2Provider{})
Expand Down Expand Up @@ -59,6 +62,9 @@ func NewProvider(p *schema.Provider, opts ...providerOption) shim.Provider {
tf: p,
opts: opts,
}
if cmdutil.IsTruthy(os.Getenv("PULUMI_ENABLE_PLAN_RESOURCE_CHANGE")) {
return newProviderWithPlanResourceChange(p, prov, func(s string) bool { return true })
}
if opts, err := getProviderOptions(opts); err == nil && opts.planResourceChangeFilter != nil {
return newProviderWithPlanResourceChange(p, prov, opts.planResourceChangeFilter)
}
Expand Down

0 comments on commit fb50112

Please sign in to comment.