"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FrontdoorCustomDomain = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Front Door (standard/premium) Custom Domain.
 *
 * > **Note:** If you are using Terraform to manage your DNS Auth and DNS CNAME records for your Custom Domain you will need to add configuration blocks for both the `azure.dns.TxtRecord` (see the `Example DNS Auth TXT Record Usage` below) and the `azure.dns.CNameRecord` (see the `Example CNAME Record Usage` below) to your configuration file.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resource-group",
 *     location: "West Europe",
 * });
 * const exampleZone = new azure.dns.Zone("example", {
 *     name: "fabrikam.com",
 *     resourceGroupName: example.name,
 * });
 * const exampleFrontdoorProfile = new azure.cdn.FrontdoorProfile("example", {
 *     name: "example-cdn-frontdoor-profile",
 *     resourceGroupName: example.name,
 *     skuName: "Standard_AzureFrontDoor",
 * });
 * const exampleFrontdoorEndpoint = new azure.cdn.FrontdoorEndpoint("example", {
 *     name: "example-cdn-frontdoor-endpoint",
 *     cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
 * });
 * const exampleFrontdoorOriginGroup = new azure.cdn.FrontdoorOriginGroup("example", {
 *     name: "example-cdn-frontdoor-origin-group",
 *     cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
 *     loadBalancing: {},
 * });
 * const exampleFrontdoorOrigin = new azure.cdn.FrontdoorOrigin("example", {
 *     name: "example-cdn-frontdoor-origin",
 *     cdnFrontdoorOriginGroupId: exampleFrontdoorOriginGroup.id,
 *     hostName: "contoso.fabrikam.com",
 *     certificateNameCheckEnabled: false,
 * });
 * const exampleFrontdoorCustomDomain = new azure.cdn.FrontdoorCustomDomain("example", {
 *     name: "example-cdn-frontdoor-custom-domain",
 *     cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
 *     dnsZoneId: exampleZone.id,
 *     hostName: exampleFrontdoorOrigin.hostName,
 *     tls: {
 *         certificateType: "ManagedCertificate",
 *         minimumVersion: "TLS12",
 *     },
 * });
 * const exampleFrontdoorRoute = new azure.cdn.FrontdoorRoute("example", {
 *     name: "example-cdn-frontdoor-route",
 *     cdnFrontdoorEndpointId: exampleFrontdoorEndpoint.id,
 *     cdnFrontdoorOriginGroupId: exampleFrontdoorOriginGroup.id,
 *     cdnFrontdoorOriginIds: [exampleFrontdoorOrigin.id],
 *     cdnFrontdoorCustomDomainIds: [exampleFrontdoorCustomDomain.id],
 *     patternsToMatches: ["/*"],
 *     supportedProtocols: [
 *         "Http",
 *         "Https",
 *     ],
 * });
 * const exampleFrontdoorFirewallPolicy = new azure.cdn.FrontdoorFirewallPolicy("example", {
 *     name: "examplecdnfrontdoorfirewallpolicy",
 *     resourceGroupName: example.name,
 *     skuName: exampleFrontdoorProfile.skuName,
 *     mode: "Prevention",
 * });
 * const exampleFrontdoorSecurityPolicy = new azure.cdn.FrontdoorSecurityPolicy("example", {
 *     name: "example-cdn-frontdoor-security-policy",
 *     cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
 *     securityPolicies: {
 *         firewall: {
 *             cdnFrontdoorFirewallPolicyId: exampleFrontdoorFirewallPolicy.id,
 *             association: {
 *                 domains: [{
 *                     cdnFrontdoorDomainId: exampleFrontdoorCustomDomain.id,
 *                 }],
 *                 patternsToMatch: "/*",
 *             },
 *         },
 *     },
 * });
 * ```
 *
 * ## Example DNS Auth TXT Record Usage
 *
 * The name of your DNS TXT record should be in the format of `_dnsauth.<your_subdomain>`. So, for example, if we use the `hostName` in the example usage above you would create a DNS TXT record with the name of `_dnsauth.contoso` which contains the value of the Front Door Custom Domains `validationToken` field. See the [product documentation](https://learn.microsoft.com/azure/frontdoor/standard-premium/how-to-add-custom-domain) for more information.
 *
 * > **Note:** Domain ownership validation is performed asynchronously by the Azure Front Door service (the domain typically transitions through states like `Submitting` and `Pending` before becoming `Approved`). If validation appears to be taking longer than expected, refer to the Azure Front Door documentation on [domain validation](https://learn.microsoft.com/azure/frontdoor/domain#domain-validation) and [domain validation states](https://learn.microsoft.com/azure/frontdoor/domain#domain-validation).
 *
 * > **Note:** Azure Front Door custom domain operations are currently gated by an internal service-side validation and backend synchronization process. While that process is running, the service can reject otherwise valid follow-up write operations until the custom domain reaches an approved state, which can make create, update, and delete operations take significantly longer than expected.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 *
 * const example = new azure.dns.TxtRecord("example", {
 *     name: std.split({
 *         separator: ".",
 *         text: exampleAzurermCdnFrontdoorCustomDomain.hostName,
 *     }).then(invoke => std.join({
 *         separator: ".",
 *         input: [
 *             "_dnsauth",
 *             invoke.result?.[0],
 *         ],
 *     })).then(invoke => invoke.result),
 *     zoneName: exampleAzurermDnsZone.name,
 *     resourceGroupName: exampleAzurermResourceGroup.name,
 *     ttl: 3600,
 *     records: [{
 *         value: exampleAzurermCdnFrontdoorCustomDomain.validationToken,
 *     }],
 * });
 * ```
 *
 * ## Example CNAME Record Usage
 *
 * > **Note:** When managing the CNAME record using Terraform, you may need to ensure your Custom Domain is associated with a Front Door Route (and any applicable Security Policy) before creating the CNAME record. This example uses `dependsOn` to enforce that ordering.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 *
 * const example = new azure.dns.CNameRecord("example", {
 *     name: std.split({
 *         separator: ".",
 *         text: exampleAzurermCdnFrontdoorCustomDomain.hostName,
 *     }).then(invoke => invoke.result?.[0]),
 *     zoneName: exampleAzurermDnsZone.name,
 *     resourceGroupName: exampleAzurermResourceGroup.name,
 *     ttl: 3600,
 *     record: exampleAzurermCdnFrontdoorEndpoint.hostName,
 * }, {
 *     dependsOn: [
 *         exampleAzurermCdnFrontdoorRoute,
 *         exampleAzurermCdnFrontdoorSecurityPolicy,
 *     ],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Cdn` - 2025-04-15
 *
 * ## Import
 *
 * A Front Door Custom Domain can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:cdn/frontdoorCustomDomain:FrontdoorCustomDomain example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1/customDomains/customDomain1
 * ```
 */
class FrontdoorCustomDomain extends pulumi.CustomResource {
    /**
     * Get an existing FrontdoorCustomDomain resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new FrontdoorCustomDomain(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:cdn/frontdoorCustomDomain:FrontdoorCustomDomain';
    /**
     * Returns true if the given object is an instance of FrontdoorCustomDomain.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === FrontdoorCustomDomain.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["cdnFrontdoorProfileId"] = state?.cdnFrontdoorProfileId;
            resourceInputs["dnsZoneId"] = state?.dnsZoneId;
            resourceInputs["expirationDate"] = state?.expirationDate;
            resourceInputs["hostName"] = state?.hostName;
            resourceInputs["name"] = state?.name;
            resourceInputs["tls"] = state?.tls;
            resourceInputs["validationToken"] = state?.validationToken;
        }
        else {
            const args = argsOrState;
            if (args?.cdnFrontdoorProfileId === undefined && !opts.urn) {
                throw new Error("Missing required property 'cdnFrontdoorProfileId'");
            }
            if (args?.hostName === undefined && !opts.urn) {
                throw new Error("Missing required property 'hostName'");
            }
            if (args?.tls === undefined && !opts.urn) {
                throw new Error("Missing required property 'tls'");
            }
            resourceInputs["cdnFrontdoorProfileId"] = args?.cdnFrontdoorProfileId;
            resourceInputs["dnsZoneId"] = args?.dnsZoneId;
            resourceInputs["hostName"] = args?.hostName;
            resourceInputs["name"] = args?.name;
            resourceInputs["tls"] = args?.tls;
            resourceInputs["expirationDate"] = undefined /*out*/;
            resourceInputs["validationToken"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const aliasOpts = { aliases: [{ type: "azure:cdn/frontdoorCustomEndpoint:FrontdoorCustomEndpoint" }] };
        opts = pulumi.mergeOptions(opts, aliasOpts);
        super(FrontdoorCustomDomain.__pulumiType, name, resourceInputs, opts);
    }
}
exports.FrontdoorCustomDomain = FrontdoorCustomDomain;
//# sourceMappingURL=frontdoorCustomDomain.js.map