Hi,
I’m trying to find out how to add a ‘azurerm_app_service_custom_hostname_binding’ for an app service slot. I’ve done one for the main app service (default production slot).
Do I just specify the name of the slot in the ‘app_service_name’ of the hostname binding? I can’t work it out from the docs, doesn’t seem to mention slots.
Thanks
Joss
Hello @joss.ingram ,
FWIW, I just ran into this as well and found the following issue:
opened 12:28PM - 04 Sep 19 UTC
new-resource
service/app-service
<!---
Please note the following potential times when an issue might be in Terra… form core:
* [Configuration Language](https://www.terraform.io/docs/configuration/index.html) or resource ordering issues
* [State](https://www.terraform.io/docs/state/index.html) and [State Backend](https://www.terraform.io/docs/backends/index.html) issues
* [Provisioner](https://www.terraform.io/docs/provisioners/index.html) issues
* [Registry](https://registry.terraform.io/) issues
* Spans resources across multiple providers
If you are running into one of these scenarios, we recommend opening an issue in the [Terraform core repository](https://github.com/hashicorp/terraform/) instead.
--->
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
### Terraform (and AzureRM Provider) Version 1.33.1
### Affected Resource(s)
* `azurerm_app_service_custom_hostname_binding`
### Terraform Configuration Files
```
resource "azurerm_app_service_custom_hostname_binding" "api_xxx_slot_binding" {
count = "${length(var.locations)}"
hostname = "${lower(format("api-xxx-xxx-%s.xxx.com", element(keys(var.locations), count.index)))}"
app_service_name = "${element(azurerm_app_service.api-xxx.*.name, count.index)}/slots/test"
resource_group_name = "${element(azurerm_resource_group.rg-xxx.*.name, count.index)}"
}
```
```hcl
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
```
### Debug Output
<!---
Please provide a link to a GitHub Gist containing the complete debug output. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
To obtain the debug output, see the [Terraform documentation on debugging](https://www.terraform.io/docs/internals/debugging.html).
--->
### Panic Output
### Expected Behavior
The hostname should be added successfully to the slot, and tfstate file should have it taken into account, but after the hostname binding (running terraform apply), the message saying new hostname binding to be added shows up every time when you run `terraform plan`
### Steps to Reproduce
1. `terraform apply`
2. `terraform plan`
### Important Factoids
### References
<!---
Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests
Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Such as vendor documentation?
--->
* #0000
If you follow the comments, you see a workaround using ARM template deployment. I am going to end up using that in my implementation. I know this is a couple months old, but figured I should share what I found…
Hope this helps!
Thanks. I can’t believe there is still no way to do this in TF though directly?