Skip to content

Commit fcdfe88

Browse files
authored
[v3] Make PULUMI_FORCE_NEW_FROM_SUBTYPES the default (#3771)
Enables the functionality of `PULUMI_FORCE_NEW_FROM_SUBTYPES` by default in v3. In v2, behavior is unchanged. In any version, setting `PULUMI_FORCE_NEW_FROM_SUBTYPES` overrides the default behavior. Closes #3006
1 parent b2e76de commit fcdfe88

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ quality and higher fidelity with the Azure platform.
6060

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

63-
## Other Configuration
64-
65-
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:
66-
67-
- `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.
68-
6963
## Building
7064

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

provider/pkg/provider/diff.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import (
99
"reflect"
1010
"regexp"
1111
"sort"
12+
"strconv"
1213
"strings"
1314

1415
"github.com/davegardnerisme/deephash"
1516
"github.com/pulumi/pulumi-azure-native/v2/provider/pkg/resources"
17+
"github.com/pulumi/pulumi-azure-native/v2/provider/pkg/version"
1618
"github.com/pulumi/pulumi/pkg/v3/codegen"
1719
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
1820
"github.com/pulumi/pulumi/sdk/v3/go/common/util/logging"
@@ -285,7 +287,14 @@ func calculateDetailedDiff(resource *resources.AzureAPIResource, lookupType reso
285287
}
286288

287289
func findForceNew(base string, props map[string]resources.AzureAPIProperty, replaceKeys codegen.StringSet) {
288-
forceNewFromSubtypes := os.Getenv("PULUMI_FORCE_NEW_FROM_SUBTYPES") == "true"
290+
var forceNewFromSubtypes bool
291+
if v, ok := os.LookupEnv("PULUMI_FORCE_NEW_FROM_SUBTYPES"); ok {
292+
forceNewFromSubtypes, _ = strconv.ParseBool(v)
293+
} else {
294+
// https://github.com/pulumi/pulumi-azure-native/issues/3006
295+
forceNewFromSubtypes = version.GetVersion().Major >= 3
296+
}
297+
289298
for propName, prop := range props {
290299
if prop.ForceNew || (prop.ForceNewInferredFromReferencedTypes && forceNewFromSubtypes) {
291300
name := propName

sdk/python/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ quality and higher fidelity with the Azure platform.
6060

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

63-
## Other Configuration
64-
65-
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:
66-
67-
- `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.
68-
6963
## Building
7064

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

0 commit comments

Comments
 (0)