Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_app_service_public_certificate - fix cert binding issue #24943

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package web

import (
"encoding/base64"
"fmt"
"log"
"strings"
Expand Down Expand Up @@ -102,11 +101,7 @@ func resourceAppServicePublicCertificateCreate(d *pluginsdk.ResourceData, meta i
}

if blob != "" {
decodedBlob, err := base64.StdEncoding.DecodeString(blob)
if err != nil {
return fmt.Errorf("could not decode blob: %+v", err)
}
certificate.Properties.Blob = pointer.To(string(decodedBlob))
certificate.Properties.Blob = pointer.To(blob)
}

if _, err := client.CreateOrUpdatePublicCertificate(ctx, id, certificate); err != nil {
Expand Down Expand Up @@ -201,11 +196,13 @@ func resourceAppServicePublicCertificateRead(d *pluginsdk.ResourceData, meta int
d.Set("app_service_name", id.SiteName)
d.Set("certificate_name", id.PublicCertificateName)

if model, ok := resp.(webapps.PublicCertificate); ok {
if properties := model.Properties; properties != nil {
d.Set("certificate_location", string(pointer.From(properties.PublicCertificateLocation)))
d.Set("blob", properties.Blob)
d.Set("thumbprint", properties.Thumbprint)
if cert, ok := resp.(webapps.GetPublicCertificateOperationResponse); ok {
if model := cert.Model; model != nil {
if properties := model.Properties; properties != nil {
d.Set("certificate_location", string(pointer.From(properties.PublicCertificateLocation)))
d.Set("blob", pointer.From(properties.Blob))
d.Set("thumbprint", pointer.From(properties.Thumbprint))
}
}
}

Expand Down
Loading