Reputation: 453
I am planning to use azurerm_api_management with the help of terraform. https://www.terraform.io/docs/providers/azurerm/r/api_management.html
Upvotes: 0
Views: 1066
Reputation: 380
To have your own domain name (custom domain) for Api Management by using Terraform, I'm using the following script to have custom domain name for the Developer Portal and Proxy (the api). You can also have your own name for Management and SCM.
This scipt require that you have a pfx (certificate), named letsencrypt.pfx
in same directory as you Terraform script.
resource "azurerm_api_management" "mngmnt" {
name = "ApiManagementTest"
location = "northeurope"
resource_group_name = "ApiManagement--rg"
publisher_name = "Api pubisher"
publisher_email = "[email protected]"
hostname_configuration {
portal = [{
host_name = "api-portal.customdomain.com"
certificate = "${base64encode(file("letsencrypt.pfx"))}"
certificate_password = "topSecretPwd123"
}]
proxy = [{
host_name = "api.customdomain.com"
certificate = "${base64encode(file("letsencrypt.pfx"))}"
certificate_password = "topSecretPwd123"
}]
}
sku {
name = "Developer"
capacity = "1"
}
}
To have custom domain work you must also remember to add a CNAME record in your public DNS to the following:
api-portal.customdomain.com -> [your name of the Api Management].portal.azure-api.net api.customdomain.com -> [your name of the Api Management].azure-api.net
Example by using name from our script, it would be:
api-portal.customdomain.com -> ApiManagementTest.portal.azure-api.net
api.customdomain.com -> ApiManagementTest.azure-api.net
Upvotes: 2
Reputation: 7825
For custom hostnames support should be there, see here https://www.terraform.io/docs/providers/azurerm/d/api_management.html argument hostname_configuration defines how you can specify custom hostnames for different APIM endpoints.
As for VNET integration, seems they're working on it: https://github.com/terraform-providers/terraform-provider-azurerm/pull/2582
Upvotes: 1