Skip to content

Commit

Permalink
fix run bash ./scripts/fun-gradually-deprecated.sh error
Browse files Browse the repository at this point in the history
  • Loading branch information
sinbai committed May 16, 2024
1 parent 83c5939 commit 2f58385
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,6 @@ func (a ContainerAppCustomDomainResource) Delete() sdk.ResourceFunc {
return err
}

// attempt to lock the cert if we have the ID
if certIdRaw := metadata.ResourceData.Get("container_app_environment_certificate_id").(string); certIdRaw != "" {
if certId, err := managedenvironments.ParseCertificateID(certIdRaw); err == nil {
locks.ByID(certId.ID())
defer locks.UnlockByID(certId.ID())
}
}

containerAppId := containerapps.NewContainerAppID(id.SubscriptionId, id.ResourceGroupName, id.ContainerAppName)

containerApp, err := client.Get(ctx, containerAppId)
Expand All @@ -281,6 +273,13 @@ func (a ContainerAppCustomDomainResource) Delete() sdk.ResourceFunc {
for _, v := range *customDomains {
if !strings.EqualFold(v.Name, id.CustomDomainName) {
updatedCustomDomains = append(updatedCustomDomains, v)
} else {
// attempt to lock the cert if we have the ID
certificateId := pointer.From(v.CertificateId)
if certificateId != "" {
locks.ByID(certificateId)
defer locks.UnlockByID(certificateId)
}
}
}
}
Expand Down

0 comments on commit 2f58385

Please sign in to comment.