Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
danaelhe committed Dec 4, 2023
1 parent c85ccf0 commit ce8e759
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions digitalocean/cdn/resource_cdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,16 @@ func resourceDigitalOceanCDNUpdate(ctx context.Context, d *schema.ResourceData,

certName := d.Get("certificate_name").(string)
if certName != "" {
cert, err := certificate.FindCertificateByName(client, certName)
if err != nil {
return diag.FromErr(err)
}
if certName == needsCloudflareCert {
cdnUpdateRequest.CertificateID = needsCloudflareCert
} else {
cert, err := certificate.FindCertificateByName(client, certName)
if err != nil {
return diag.FromErr(err)
}

cdnUpdateRequest.CertificateID = cert.ID
cdnUpdateRequest.CertificateID = cert.ID
}
}

_, _, err := client.CDNs.UpdateCustomDomain(context.Background(), d.Id(), cdnUpdateRequest)
Expand Down

0 comments on commit ce8e759

Please sign in to comment.