Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create custom domain for app services via terraform

I am creating azure app services via terraform and following there documentation located at this site : https://www.terraform.io/docs/providers/azurerm/r/app_service.html

Here is the snippet for terraform script:

resource "azurerm_app_service" "app" {
  name                = "app-name"
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  app_service_plan_id = "ommitted"

  site_config {
    java_version           = "1.8"
    java_container         = "TOMCAT"
    java_container_version = "8.5"
  }
  }

I need sub domain as well for my app services for which I am not able to find any help in terraform :

as of now url for app services is: https://abc.azure-custom-domain.cloud

and I want my url to be : https://*.abc.azure-custom-domain.cloud

I know this can be done via portal but is their any way by which we can do it via terraform?

like image 248
focode Avatar asked Mar 07 '23 23:03

focode


1 Answers

This is now possible using app_service_custom_hostname_binding (since PR#1087 on 6th April 2018)

resource "azurerm_app_service_custom_hostname_binding" "test" {
  hostname            = "www.mywebsite.com"
  app_service_name    = "${azurerm_app_service.test.name}"
  resource_group_name = "${azurerm_resource_group.test.name}"
}
like image 188
Pirate Briggs Avatar answered Mar 25 '23 06:03

Pirate Briggs