examples icon indicating copy to clipboard operation
examples copied to clipboard

azure-ts-dynamicresource example fails to enable https

Open devployment opened this issue 4 years ago • 1 comments

Following the example I get an error if I try to enable https for the custom domain.

error: The resource format is invalid.

Creating the custom domain works, without https enabled. As soon I try to enable it either on create, or as a change I get the resource format error.

If I use az cdn custom-domain enable-https from the Azure CLI directly on an available custom domain it works with the same same parameter given to cdnClient.customDomains.enableCustomHttps

I guess it's related to https://github.com/Azure/azure-sdk-for-js in general and maybe somehow to this from the CLI. But maybe somebody in here has another idea.

devployment avatar Sep 30 '20 11:09 devployment

The reason is that version 5 of @azure/arm-cdn requires an extra parameter to be passed in to enableCustomHttps. A working version looks like this

await cdnClient.customDomains.enableCustomHttps(
    inputs.resourceGroupName,
    inputs.profileName,
    inputs.endpointName,
    this.name,
    {
        customDomainHttpsParameters: {
            certificateSource: "Cdn",
            certificateSourceParameters: {
                certificateType: "Dedicated"
            },
            protocolType: "ServerNameIndication"
        }
    });

I'm not sure how Pulumi handles versions for @azure/XXX dependencies. But I have created a PR that fixes the issue when using version 5. Not sure what happens when using 4.2 though... But until that potentially gets accepted, the above code should fix it!

ChrisKlug avatar Oct 12 '20 10:10 ChrisKlug