https://pulumi.com logo
Title
r

ripe-russia-4239

07/22/2020, 2:41 PM
Hi there, I'm trying to provision a custom hostname for an Azure Function. When I work through this in the portal, I have to complete a domain verification step to prove ownership of the host name I'm trying to provision: adding a
TXT
record to my DNS with a specific GUID. If this step is not completed, the Pulumi
CustomHostnameBinding
fails to create, and the Pulumi update as a whole fails:
Error creating/updating Custom Hostname Binding "<http://www.mywebsite.com|www.mywebsite.com>" (App Service "exampleappservice7422ec00" / Resource Group "exampleresourcegroupa1b4af45"): web.AppsClient#CreateOrUpdateHostNameBinding: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="A TXT record pointing from <http://asuid.www.mywebsite.com|asuid.www.mywebsite.com> to 2f77eba357071f06b1ae4cb900105eeb8236f2697466a15641af4fdd75f2fb49 was not found." Details=[{"Message":"A TXT record pointing from <http://asuid.www.mywebsite.com|asuid.www.mywebsite.com> to 2f77eba357071f06b1ae4cb900105eeb8236f2697466a15641af4fdd75f2fb49 was not found."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"04006","Message":"A TXT record pointing from <http://asuid.www.mywebsite.com|asuid.www.mywebsite.com> to 2f77eba357071f06b1ae4cb900105eeb8236f2697466a15641af4fdd75f2fb49 was not found.","MessageTemplate":"A TXT record pointing from asuid.{0} to {1} was not found.","Parameters":["<http://www.mywebsite.com|www.mywebsite.com>","2f77eba357071f06b1ae4cb900105eeb8236f2697466a15641af4fdd75f2fb49"]}}]
I haven't been able to catch this error, nor identify a way (from the docs, poking around the Pulumi libraries with code completion, etc. etc.) to capture the resource(s) in error and inspect the returned error. What I'd like to be able to do is intercept this error, provision the
TXT
record in CloudFlare DNS, retry the operation, then delete the
TXT
record again. I'm using the #typescript SDK.
t

tall-librarian-49374

07/22/2020, 2:59 PM
Do you want to do all this in an automated fashion?
r

ripe-russia-4239

07/22/2020, 3:03 PM
Ideally, yes
It would be amazing if the
CustomHostnameBinding
had an argument/option/whatever that accepted a DNS provider resource, so we could do something like:
new CustomHostnameBinding("example-binding", {
  hostname: "<http://www.mywebsite.com|www.mywebsite.com>",
  appServiceName: exampleAppService.name,
  resourceGroupName: exampleResourceGroup.name
}, {
  dnsVerificationRecord: new cloudflare.Record("azure-appservice-domain-verification", {
    name: "azure-appservice-domain-verification",
    zoneId: "whatever",
    type: "TXT",
    value: "value-from-the-error-message"
    ttl: 3600
  })
})
👍 1
@tall-librarian-49374 Is what I’m asking currently possible, or do we need to complete the DNS verification step by hand somehow? I’m struggling to understand how a
CustomHostnameBinding
can ever succeed at first…