I have a bicep template that creates several container apps. They shall have a custom sub domain in my private DNS zone. However, I have the problem that this leads to a circular dependency: To add the CName and verification TXT record to the DNS zone, I need the FQDN and verification from the container app. On the other hand, the deployment of the container app validates the existance of these records and fails if they are not there.
A workaround I currently use involves a boolean template parameter that must be false on the first run:
param register_custom_domains bool = false
resource container_app 'Microsoft.App/containerapps@2022-03-01' = {
// ...
properties: {
configuration: {
ingress: {
customDomains: register_custom_domains ? [
{
name: 'name'
certificateId: certifcate.id
bindingType: 'SniEnabled'
}
] : null
}
}
}
}
But this naturally requires to deploy twice. Is there a better way?