From 83f536e38601083643f7bfe30c1c1067fc02b854 Mon Sep 17 00:00:00 2001 From: Venelin Date: Mon, 19 Aug 2024 13:46:02 +0100 Subject: [PATCH 1/2] Fix storage container replacement --- provider/resources.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/provider/resources.go b/provider/resources.go index 2d506cd39d..e7ba28914f 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -2061,6 +2061,12 @@ func Provider() tfbridge.ProviderInfo { Transform: strings.ToLower, }), }, + TransformFromState: func(_ context.Context, pm resource.PropertyMap) (resource.PropertyMap, error) { + 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")}, From 18f37bfcdb4b97af7d70b9ea04977bfaf9d495b2 Mon Sep 17 00:00:00 2001 From: Venelin Date: Mon, 19 Aug 2024 15:14:02 +0100 Subject: [PATCH 2/2] add commen --- provider/resources.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/provider/resources.go b/provider/resources.go index e7ba28914f..ebbb008835 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -2062,6 +2062,8 @@ func Provider() tfbridge.ProviderInfo { }), }, 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) }