Manages a Hostname Binding within an App Service Slot.
resource "azurerm_resource_group" "example" {
name = "some-resource-group"
location = "West Europe"
}
resource "azurerm_app_service_plan" "example" {
name = "some-app-service-plan"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "example" {
name = "some-app-service"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
}
resource "azurerm_app_service_slot" "example" {
name = "staging"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_name = azurerm_app_service.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
}
resource "azurerm_app_service_slot_custom_hostname_binding" "example" {
app_service_slot_id = azurerm_app_service_slot.example.id
hostname = "www.mywebsite.com"
}
The following arguments are supported:
app_service_slot_id
- (Required) The ID of the App Service Slot. Changing this forces a new resource to be created.
hostname
- (Required) Specifies the Custom Hostname to use for the App Service, example www.example.com
. Changing this forces a new resource to be created.
ssl_state
- (Optional) The SSL type. Possible values are IpBasedEnabled
and SniEnabled
. Changing this forces a new resource to be created.
thumbprint
- (Optional) The SSL certificate thumbprint. Changing this forces a new resource to be created.
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the App Service Custom Hostname Binding
virtual_ip
- The virtual IP address assigned to the hostname if IP based SSL is enabled.
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the App Service Custom Hostname Binding.read
- (Defaults to 5 minutes) Used when retrieving the App Service Custom Hostname Binding.delete
- (Defaults to 30 minutes) Used when deleting the App Service Custom Hostname Binding.App Service Custom Hostname Bindings can be imported using the resource id
, e.g.
terraform import azurerm_app_service_slot_custom_hostname_binding.mywebsite /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/instance1/slots/staging/hostNameBindings/mywebsite.com