Incorrect hosts
attribute type for cloudflare_certificate_pack
#3287
Labels
kind/bug
Categorizes issue or PR as related to a bug.
triage/debug-log-attached
Indicates an issue or PR has a complete Terraform debug log.
Confirmation
Terraform and Cloudflare provider version
Terraform v1.8.2
(Although it has nothing to do with the issue)
Affected resource(s)
cloudflare_certificate_pack
Terraform configuration files
Link to debug output
https://gist.github.com/tothdavid/d8e276439e7520f42b2ca41a615b2361
Panic output
No response
Expected output
In the created certificate pack the order of hostnames should be retained. This can be checked on cloudflare' API:
https://api.cloudflare.com/client/v4/zones/{zone_id}/ssl/certificate_packs/{certificate_pack_id} (https://developers.cloudflare.com/api/operations/certificate-packs-get-certificate-pack)
Actual output
The order of hostnames in the created certificate pack is not defined.
Steps to reproduce
See "Additional factoids"
Additional factoids
The type of the
hosts
attribute for thecloudflare_certificate_pack
resource is wrong:On the Cloudflare's API it is defined as an
array[strings]
(see: https://developers.cloudflare.com/api/operations/certificate-packs-order-advanced-certificate-manager-certificate-pack#request-body), on the other hand this resource defines it asset(string)
(see: https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/certificate_pack#hosts )This will make the order of the hostnames passed to the Cloudflare's API undefined, so the user has no control over that. This is however important, because Cloudflare will use the first entry for the CN of the certificate.
Currently the only workaround is to create the Advanced certificate pack manually, although the UI will also sort the hostnames in a certain order after the pack is created, but for creating the certificate the order of the provided hostnames are respected.
References
No response
The text was updated successfully, but these errors were encountered: