Open pjeannet-dior opened 4 years ago
Hello, any news regarding this?
Since this issue has been reported a long time ago and relates to the version of provider we no longer support - I'm going to close it. Please open a new updated bug report on current versions of terraform and provider if this is still relevant. Thank you.
@favoretti this is not correct, there is no version of azurerm_cdn_endpoint written in any part of the issue. Could you please reopen the issue and extend the functionalities to allow icp license?
Reopened as requested.
Hey there, maybe it can help (even if it's a bit late :D ), but you "can" deploy a CDN endpoint with ICP like below:
-> _templates/cdn_endpointparameters.json.tftpl
{
"name": {
"value": "${parameters_name_value}"
},
"location": {
"value": "${parameters_location_value}"
},
"properties": {
"value": {
"originHostHeader": "${parameters_properties_value_originHostHeader}",
"optimizationType": "${parameters_properties_value_optimizationType}",
"origins": [
{
"name": "${parameters_properties_value_origins_name}",
"properties": {
"hostName": "${parameters_properties_value_origins_properties}"
}
}
],
"customdomains": [
{
"name": "${parameters_properties_value_customdomains_name}",
"properties": {
"hostName": "${parameters_properties_value_customdomains_properties_hostName}",
"validationData": "${parameters_properties_value_customdomains_properties_validationData}"
}
}
]
}
}
}
-> _files/cdn_endpointtemplate.json
{
"$schema": "http://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string"
},
"location": {
"type": "string"
},
"properties": {
"type": "object"
}
},
"resources": [
{
"apiVersion": "2017-04-02",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"properties": "[parameters('properties')]",
"type": "microsoft.cdn/profiles/endpoints"
}
]
}
-> _cdnendpoint.tf
resource "azurerm_resource_group_template_deployment" "customer-cn-website-cdn-endpoint" {
name = "customer-cn-website-cdn-endpoint"
resource_group_name = azurerm_resource_group.customer-cn-website.name
deployment_mode = "Incremental"
template_content = file("${path.module}/files/cdn_endpoint_template.json")
parameters_content = templatefile("${path.module}/templates/cdn_endpoint_parameters.json.tftpl",
{
parameters_name_value = "customer-cn-website/${replace(var.cdn_customdomains, ".", "-")}",
parameters_location_value = "ChinaNorth",
parameters_properties_value_originHostHeader = azurerm_storage_account.customer-cn-website.primary_blob_host,
parameters_properties_value_optimizationType = var.cdn_type,
parameters_properties_value_origins_name = replace(azurerm_storage_account.customer-cn-website.primary_blob_host, ".", "-"),
parameters_properties_value_origins_properties = azurerm_storage_account.customer-cn-website.primary_blob_host,
parameters_properties_value_customdomains_name = replace(var.cdn_customdomains, ".", "-"),
parameters_properties_value_customdomains_properties_hostName = var.cdn_customdomains,
parameters_properties_value_customdomains_properties_validationData = var.cdn_icp
})
}
-> vars.tf
variable "cloud_environment" {
type = string
default = "china"
}
variable "cdn_customdomains" {
type = string
default = "www.customer.sh.cn"
}
variable "cdn_icp" {
type = string
default = "沪ICP备20002487号-2"
}
variable "cdn_type" {
type = string
default = "Web"
}
It tooks around 6 minutes to validate the endpoint deployment:
But in the end, the endpoint with ICP is properly deployed on Azure console !
Community Note
Description
When deploying CDN in china region, and creating endpoints, we are asked for the ICP number (https://en.wikipedia.org/wiki/ICP_license). I could not find it in the current terraform config.
New or Affected Resource(s)
azurerm_cdn_endpoint
Potential Terraform Configuration
References
0000