This topic describes how to resolve an HTTPS configuration error that occurs when you use Terraform to add a domain name to Alibaba Cloud CDN.
Issue
Terraform provides the following error log:
│ Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_cdn_domain_new.go:576: Resource public1.sige-test3.com SetCdnDomainSSLCertificate Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
│ SDKError:
│ StatusCode: 400
│ Code: SSLPri.MissingParameter
│ Message: code: 400, The SSLPri parameter is required. request id: F5512B73-4FCE-56DD-8F05-19BA81C701F1
│ Data: {"Code":"SSLPri.MissingParameter","HostId":"cdn.aliyuncs.com","Message":"The SSLPri parameter is required.","Recommend":"https://api.alibabacloud.com/troubleshoot?intl_lang=EN_US&q=SSLPri.MissingParameter&product=Cdn&requestId=F5512B73-4FCE-56DD-8F05-19BA81C701F1","RequestId":"F5512B73-4FCE-56DD-8F05-19BA81C701F1"}
│
│ with alicloud_cdn_domain_new.default,
│ on main.tf line 1, in resource "alicloud_cdn_domain_new" "default":
│ 1: resource "alicloud_cdn_domain_new" "default" Cause
When you use alicloud_cdn_domain_new to create a CDN-accelerated domain name and add an HTTPS certificate, you set the cert_type parameter to cas, indicating the use of a certificate from Alibaba Cloud Certificate Center.
If you set the cert_type parameter to cas and your account is created on the Alibaba Cloud international site, you must set the cert_region parameter to ap-southeast-1. If your account is created on the Alibaba Cloud China site, this setting is not required as the cert_region parameter defaults to cn-hangzhou, which is the region of Alibaba Cloud Certificate Center for the China site.
For more information about the parameters of alicloud_cdn_domain_new, see alicloud_cdn_domain_new.

Solution
When you use alicloud_cdn_domain_new to create a CDN-accelerated domain name and add an HTTPS certificate, set the cert_type parameter to cas:
If your account is created on the international site, set the
cert_regionparameter toap-southeast-1.If your account is created on the China site, the
cert_regionparameter defaults tocn-hangzhou.
Sample code:
# Add an accelerated domain name.
resource "alicloud_cdn_domain_new" "domain" {
domain_name = "mycdndomain.alicloud-provider.cn"
cdn_type = "download"
scope = "overseas"
sources {
content = "myoss.oss-rg-china-mainland.aliyuncs.com"
type = "oss"
priority = "20"
port = 80
weight = "15"
}
# Configure a certificate.
# cert_id: To obtain a certificate ID, you must first purchase or upload a certificate in Alibaba Cloud Certificate Center.
# cert_type="cas" indicates that a certificate from Alibaba Cloud Certificate Center is used.
# cert_region = "ap-southeast-1" indicates that Alibaba Cloud Certificate Center for the international site is used.
certificate_config {
cert_id = "1111111"
cert_name = "cert-2987438279834"
cert_type = "cas"
cert_region = "ap-southeast-1"
}
}