Skip to content

Commit

Permalink
Enable PRC by default in pulumi-azure (#2306)
Browse files Browse the repository at this point in the history
Enables PlanResourceChange by default in pulumi-azure.

Part of pulumi/pulumi-terraform-bridge#1785

Also contains #2325
Also contains #2331

fixes #2322
fixes #2323
fixes #2330
  • Loading branch information
VenelinMartinov authored Aug 19, 2024
1 parent 7a2d991 commit 044395a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 3 additions & 1 deletion examples/examples_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ func TestAccAciVolumeMount(t *testing.T) {
test := getJSBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "aci-volume-mount"),
RunUpdateTest: true,
RunUpdateTest: false,
SkipEmptyPreviewUpdate: true,
ExpectRefreshChanges: true,
})

integration.ProgramTest(t, &test)
Expand Down
22 changes: 19 additions & 3 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ var metadata []byte
//
// nolint: lll
func Provider() tfbridge.ProviderInfo {
p := shimv2.NewProvider(shim.NewProvider(), shimv2.WithPlanResourceChange(func(tfResourceType string) bool {
return tfResourceType == "azurerm_storage_account"
}))
p := shimv2.NewProvider(shim.NewProvider(),
shimv2.WithPlanResourceChange(func(string) bool { return true }),
)

// Adjust the defaults if running in Azure Cloud Shell.
// Environment variables still take preference, e.g. USE_MSI=false disables the MSI endpoint.
Expand Down Expand Up @@ -1891,6 +1891,14 @@ func Provider() tfbridge.ProviderInfo {
Transform: strings.ToLower,
}),
},
TransformFromState: func(_ context.Context, pm resource.PropertyMap) (resource.PropertyMap, error) {
// if the defaultOutboundAccessEnabled property is not set, set it to the default value of true
// this prevents an unnecessary replacement when upgrading the provider
if _, ok := pm["defaultOutboundAccessEnabled"]; !ok {
pm["defaultOutboundAccessEnabled"] = resource.NewBoolProperty(true)
}
return pm, nil
},
},
"azurerm_subnet_network_security_group_association": {Tok: azureResource(azureNetwork, "SubnetNetworkSecurityGroupAssociation")},
"azurerm_subnet_route_table_association": {Tok: azureResource(azureNetwork, "SubnetRouteTableAssociation")},
Expand Down Expand Up @@ -2053,6 +2061,14 @@ func Provider() tfbridge.ProviderInfo {
Transform: strings.ToLower,
}),
},
TransformFromState: func(_ context.Context, pm resource.PropertyMap) (resource.PropertyMap, error) {
// This prevents unnecessary replacement when upgrading from a version of the Azure provider
// prior to this parameter being added.
if _, ok := pm["encryptionScopeOverrideEnabled"]; !ok {
pm["encryptionScopeOverrideEnabled"] = resource.NewBoolProperty(true)
}
return pm, nil
},
},
"azurerm_storage_share": {Tok: azureResource(azureStorage, "Share")},
"azurerm_storage_share_directory": {Tok: azureResource(azureStorage, "ShareDirectory")},
Expand Down

0 comments on commit 044395a

Please sign in to comment.