Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Make PULUMI_FORCE_NEW_FROM_SUBTYPES the default #3771

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ quality and higher fidelity with the Azure platform.

To learn how to configure credentials refer to the [Azure configuration options](https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#configuration-options).

## Other Configuration

In addition to the configuration options in the official documentation linked above, the following environment variables can be used to tweak lower-level behavior of the provider:

- `PULUMI_FORCE_NEW_FROM_SUBTYPES`: if, after a change in your program, the provider does not replace a resource that should be replaced because it cannot be updated, setting this variable to `true` might allow the provider to infer the correct behavior. For more details please see PR #2970. We're planning to make this behavior the default in the future.

## Building

See [contributing](CONTRIBUTING.md) for details on how to build and contribute to this provider.
Expand Down
11 changes: 10 additions & 1 deletion provider/pkg/provider/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import (
"reflect"
"regexp"
"sort"
"strconv"
"strings"

"github.com/davegardnerisme/deephash"
"github.com/pulumi/pulumi-azure-native/v2/provider/pkg/resources"
"github.com/pulumi/pulumi-azure-native/v2/provider/pkg/version"
"github.com/pulumi/pulumi/pkg/v3/codegen"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/logging"
Expand Down Expand Up @@ -285,7 +287,14 @@ func calculateDetailedDiff(resource *resources.AzureAPIResource, lookupType reso
}

func findForceNew(base string, props map[string]resources.AzureAPIProperty, replaceKeys codegen.StringSet) {
forceNewFromSubtypes := os.Getenv("PULUMI_FORCE_NEW_FROM_SUBTYPES") == "true"
var forceNewFromSubtypes bool
if v, ok := os.LookupEnv("PULUMI_FORCE_NEW_FROM_SUBTYPES"); ok {
forceNewFromSubtypes, _ = strconv.ParseBool(v)
} else {
// https://github.com/pulumi/pulumi-azure-native/issues/3006
forceNewFromSubtypes = version.GetVersion().Major >= 3
}

for propName, prop := range props {
if prop.ForceNew || (prop.ForceNewInferredFromReferencedTypes && forceNewFromSubtypes) {
name := propName
Expand Down
6 changes: 0 additions & 6 deletions sdk/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ quality and higher fidelity with the Azure platform.

To learn how to configure credentials refer to the [Azure configuration options](https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#configuration-options).

## Other Configuration

In addition to the configuration options in the official documentation linked above, the following environment variables can be used to tweak lower-level behavior of the provider:

- `PULUMI_FORCE_NEW_FROM_SUBTYPES`: if, after a change in your program, the provider does not replace a resource that should be replaced because it cannot be updated, setting this variable to `true` might allow the provider to infer the correct behavior. For more details please see PR #2970. We're planning to make this behavior the default in the future.

## Building

See [contributing](CONTRIBUTING.md) for details on how to build and contribute to this provider.
Expand Down
Loading