From 98a8600e3c6e53266544342eb3a3a0c1e33766a8 Mon Sep 17 00:00:00 2001 From: Joe K Date: Wed, 12 Jul 2023 13:43:55 -0400 Subject: [PATCH] feat: remove CustomizeDiff() func This function is no longer needed, the issue it was addressing has been resolved by MS https://github.com/microsoft/azure-container-apps/issues/395 --- .../containerapps/container_app_resource.go | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/internal/services/containerapps/container_app_resource.go b/internal/services/containerapps/container_app_resource.go index 272c8520de26..87b5b8d2b413 100644 --- a/internal/services/containerapps/container_app_resource.go +++ b/internal/services/containerapps/container_app_resource.go @@ -405,35 +405,3 @@ func (r ContainerAppResource) Update() sdk.ResourceFunc { }, } } - -func (r ContainerAppResource) CustomizeDiff() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - if metadata.ResourceDiff != nil && metadata.ResourceDiff.HasChange("secret") { - stateSecretsRaw, configSecretsRaw := metadata.ResourceDiff.GetChange("secret") - stateSecrets := stateSecretsRaw.(*schema.Set).List() - configSecrets := configSecretsRaw.(*schema.Set).List() - // Check there's not less - if len(configSecrets) < len(stateSecrets) { - return fmt.Errorf("cannot remove secrets from Container Apps at this time due to a limitation in the Container Apps Service. Please see `https://github.com/microsoft/azure-container-apps/issues/395` for more details") - } - // Check secrets names in state are all present in config, the values don't matter - if len(stateSecrets) > 0 { - for _, s := range stateSecrets { - found := false - for _, c := range configSecrets { - if s.(map[string]interface{})["name"] == c.(map[string]interface{})["name"] { - found = true - break - } - } - if !found { - return fmt.Errorf("previously configured secret %q was removed. Removing secrets is not supported by the Container Apps Service at this time, see `https://github.com/microsoft/azure-container-apps/issues/395` for more details", s.(map[string]interface{})["name"]) - } - } - } - } - return nil - }, - } -}