Hi! I am trying to add a custom domain with a certificate to a WebApp. I have a `WebAppHostnameBindi...
c
Hi! I am trying to add a custom domain with a certificate to a WebApp. I have a
WebAppHostnameBinding
and a
Certificate
and it works, but I have to go into the portal to assign the certificate to the binding. How can I do this with pulumi?
l
That sounds like the issue addressed here: https://github.com/pulumi/pulumi-azure-native/issues/578 As far as I know there's still no good answer because the Azure native API doesn't expose a mechanism to avoid the circular dependency.
c
Funny how the issues discussing this has a circular link
l
🤷‍♂️
a
For assigning a free managed certificate to an app service hostname binding you'll have to do two consecutive pulumi updates. First update: • Creates the required required TXT and Cname DNS records • Creates WebAppHostnameBinding with SSL disabled • Creates Certificate Second pass: • Now the
cert.thumbprint
output should be available so now you can pass in the required parameters for enabling the SSL binding on the
WebAppHostnameBinding
resource
Copy code
ssl_state=web.SslState.SNI_ENABLED if cert.thumbprint else web.SslState.DISABLED

ssl_thumbprint=cert.thumbprint