Skip to content

Commit

Permalink
feat: remove CustomizeDiff() func
Browse files Browse the repository at this point in the history
This function is no longer needed, the issue it was addressing has been resolved by MS

microsoft/azure-container-apps#395
  • Loading branch information
jkrilov authored Jul 12, 2023
1 parent 444773d commit 98a8600
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions internal/services/containerapps/container_app_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
}

0 comments on commit 98a8600

Please sign in to comment.