Using Azure native to setup a custom domain for CD...
# azure
f
Using Azure native to setup a custom domain for CDN/FrontDoor, specifically `v20220501preview`: https://github.com/pulumi/pulumi-azure-native/blob/master/sdk/dotnet/Cdn/V20220501Preview/AFDCustomDomain.cs , I can't seem find a way to specify that the domain is an APEX domain.
In the UI we have this:
When I do this manually via UI and choose APEX, the result here for
<http://elaway.fr|elaway.fr>
is an option to
Create an alias
record. However
<http://elaway.de|elaway.de>
, provisioned through pulumi using the aforementioned
AFDCustomDomain
results in option
Create CNAME record
which is not a thing for apex(/root) domains.
Is this an API issue in pulumi?
I don't think this is going to be possible.
i
I've found some situations where you cannot do everything via ARM templates or Pulumi but only via CLI. Then I invoke the script using a pulumi command. https://www.pulumi.com/registry/packages/command/
m
Some code for SWA Apex Domain. Not sure if it will translate for CDN/FrontDoor.
Copy code
if (apexDomain)
		{
			var apexAlias = new RecordSet($"{name}-apex-dns", new RecordSetArgs
			{
				RecordType = "A",
				RelativeRecordSetName = "@",
				ResourceGroupName = dnsZoneResourceGroupName,
				TargetResource = new SubResourceArgs {
					Id = swa.Id
				},
				Ttl = 60,
				ZoneName = dnsZoneName
			});

			var apexPulumiName = $"{name}-apex-domain";
			var apexDomainItem = new StaticSiteCustomDomain(
				apexPulumiName,
				new StaticSiteCustomDomainArgs
				{
					DomainName = dnsZoneName,
					ResourceGroupName = resourceGroupName,
					Name = swa.Name,
					ValidationMethod = "dns-txt-token"
				},
				new CustomResourceOptions
				{
					DependsOn = { apexAlias },
					IgnoreChanges = { "hostNameType", "validationMethod" },
				});
		}