Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.cdn.kotlin.FrontdoorCustomDomain.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.cdn.kotlin
import com.pulumi.azure.cdn.kotlin.outputs.FrontdoorCustomDomainTls
import com.pulumi.azure.cdn.kotlin.outputs.FrontdoorCustomDomainTls.Companion.toKotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [FrontdoorCustomDomain].
*/
@PulumiTagMarker
public class FrontdoorCustomDomainResourceBuilder internal constructor() {
public var name: String? = null
public var args: FrontdoorCustomDomainArgs = FrontdoorCustomDomainArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend FrontdoorCustomDomainArgsBuilder.() -> Unit) {
val builder = FrontdoorCustomDomainArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): FrontdoorCustomDomain {
val builtJavaResource = com.pulumi.azure.cdn.FrontdoorCustomDomain(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return FrontdoorCustomDomain(builtJavaResource)
}
}
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-cdn-frontdoor",
* location: "West Europe",
* });
* const exampleZone = new azure.dns.Zone("example", {
* name: "sub-domain.domain.com",
* resourceGroupName: example.name,
* });
* const exampleFrontdoorProfile = new azure.cdn.FrontdoorProfile("example", {
* name: "example-profile",
* resourceGroupName: example.name,
* skuName: "Standard_AzureFrontDoor",
* });
* const exampleFrontdoorCustomDomain = new azure.cdn.FrontdoorCustomDomain("example", {
* name: "example-customDomain",
* cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
* dnsZoneId: exampleZone.id,
* hostName: "contoso.fabrikam.com",
* tls: {
* certificateType: "ManagedCertificate",
* minimumTlsVersion: "TLS12",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-cdn-frontdoor",
* location="West Europe")
* example_zone = azure.dns.Zone("example",
* name="sub-domain.domain.com",
* resource_group_name=example.name)
* example_frontdoor_profile = azure.cdn.FrontdoorProfile("example",
* name="example-profile",
* resource_group_name=example.name,
* sku_name="Standard_AzureFrontDoor")
* example_frontdoor_custom_domain = azure.cdn.FrontdoorCustomDomain("example",
* name="example-customDomain",
* cdn_frontdoor_profile_id=example_frontdoor_profile.id,
* dns_zone_id=example_zone.id,
* host_name="contoso.fabrikam.com",
* tls={
* "certificate_type": "ManagedCertificate",
* "minimum_tls_version": "TLS12",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-cdn-frontdoor",
* Location = "West Europe",
* });
* var exampleZone = new Azure.Dns.Zone("example", new()
* {
* Name = "sub-domain.domain.com",
* ResourceGroupName = example.Name,
* });
* var exampleFrontdoorProfile = new Azure.Cdn.FrontdoorProfile("example", new()
* {
* Name = "example-profile",
* ResourceGroupName = example.Name,
* SkuName = "Standard_AzureFrontDoor",
* });
* var exampleFrontdoorCustomDomain = new Azure.Cdn.FrontdoorCustomDomain("example", new()
* {
* Name = "example-customDomain",
* CdnFrontdoorProfileId = exampleFrontdoorProfile.Id,
* DnsZoneId = exampleZone.Id,
* HostName = "contoso.fabrikam.com",
* Tls = new Azure.Cdn.Inputs.FrontdoorCustomDomainTlsArgs
* {
* CertificateType = "ManagedCertificate",
* MinimumTlsVersion = "TLS12",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/cdn"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/dns"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-cdn-frontdoor"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleZone, err := dns.NewZone(ctx, "example", &dns.ZoneArgs{
* Name: pulumi.String("sub-domain.domain.com"),
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* exampleFrontdoorProfile, err := cdn.NewFrontdoorProfile(ctx, "example", &cdn.FrontdoorProfileArgs{
* Name: pulumi.String("example-profile"),
* ResourceGroupName: example.Name,
* SkuName: pulumi.String("Standard_AzureFrontDoor"),
* })
* if err != nil {
* return err
* }
* _, err = cdn.NewFrontdoorCustomDomain(ctx, "example", &cdn.FrontdoorCustomDomainArgs{
* Name: pulumi.String("example-customDomain"),
* CdnFrontdoorProfileId: exampleFrontdoorProfile.ID(),
* DnsZoneId: exampleZone.ID(),
* HostName: pulumi.String("contoso.fabrikam.com"),
* Tls: &cdn.FrontdoorCustomDomainTlsArgs{
* CertificateType: pulumi.String("ManagedCertificate"),
* MinimumTlsVersion: pulumi.String("TLS12"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.dns.Zone;
* import com.pulumi.azure.dns.ZoneArgs;
* import com.pulumi.azure.cdn.FrontdoorProfile;
* import com.pulumi.azure.cdn.FrontdoorProfileArgs;
* import com.pulumi.azure.cdn.FrontdoorCustomDomain;
* import com.pulumi.azure.cdn.FrontdoorCustomDomainArgs;
* import com.pulumi.azure.cdn.inputs.FrontdoorCustomDomainTlsArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-cdn-frontdoor")
* .location("West Europe")
* .build());
* var exampleZone = new Zone("exampleZone", ZoneArgs.builder()
* .name("sub-domain.domain.com")
* .resourceGroupName(example.name())
* .build());
* var exampleFrontdoorProfile = new FrontdoorProfile("exampleFrontdoorProfile", FrontdoorProfileArgs.builder()
* .name("example-profile")
* .resourceGroupName(example.name())
* .skuName("Standard_AzureFrontDoor")
* .build());
* var exampleFrontdoorCustomDomain = new FrontdoorCustomDomain("exampleFrontdoorCustomDomain", FrontdoorCustomDomainArgs.builder()
* .name("example-customDomain")
* .cdnFrontdoorProfileId(exampleFrontdoorProfile.id())
* .dnsZoneId(exampleZone.id())
* .hostName("contoso.fabrikam.com")
* .tls(FrontdoorCustomDomainTlsArgs.builder()
* .certificateType("ManagedCertificate")
* .minimumTlsVersion("TLS12")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-cdn-frontdoor
* location: West Europe
* exampleZone:
* type: azure:dns:Zone
* name: example
* properties:
* name: sub-domain.domain.com
* resourceGroupName: ${example.name}
* exampleFrontdoorProfile:
* type: azure:cdn:FrontdoorProfile
* name: example
* properties:
* name: example-profile
* resourceGroupName: ${example.name}
* skuName: Standard_AzureFrontDoor
* exampleFrontdoorCustomDomain:
* type: azure:cdn:FrontdoorCustomDomain
* name: example
* properties:
* name: example-customDomain
* cdnFrontdoorProfileId: ${exampleFrontdoorProfile.id}
* dnsZoneId: ${exampleZone.id}
* hostName: contoso.fabrikam.com
* tls:
* certificateType: ManagedCertificate
* minimumTlsVersion: TLS12
* ```
*
* ## Example DNS Auth TXT Record Usage
* The name of your DNS TXT record should be in the format of `_dnsauth.`. So, for example, if we use the `host_name` 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 `validation_token` field. See the [product documentation](https://learn.microsoft.com/azure/frontdoor/standard-premium/how-to-add-custom-domain) for more information.
*
* ```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.join({
* separator: ".",
* input: [
* "_dnsauth",
* "contoso",
* ],
* }).then(invoke => invoke.result),
* zoneName: exampleAzurermDnsZone.name,
* resourceGroupName: exampleAzurermResourceGroup.name,
* ttl: 3600,
* records: [{
* value: exampleAzurermCdnFrontdoorCustomDomain.validationToken,
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* import pulumi_std as std
* example = azure.dns.TxtRecord("example",
* name=std.join(separator=".",
* input=[
* "_dnsauth",
* "contoso",
* ]).result,
* zone_name=example_azurerm_dns_zone["name"],
* resource_group_name=example_azurerm_resource_group["name"],
* ttl=3600,
* records=[{
* "value": example_azurerm_cdn_frontdoor_custom_domain["validationToken"],
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* using Std = Pulumi.Std;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Dns.TxtRecord("example", new()
* {
* Name = Std.Join.Invoke(new()
* {
* Separator = ".",
* Input = new[]
* {
* "_dnsauth",
* "contoso",
* },
* }).Apply(invoke => invoke.Result),
* ZoneName = exampleAzurermDnsZone.Name,
* ResourceGroupName = exampleAzurermResourceGroup.Name,
* Ttl = 3600,
* Records = new[]
* {
* new Azure.Dns.Inputs.TxtRecordRecordArgs
* {
* Value = exampleAzurermCdnFrontdoorCustomDomain.ValidationToken,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/dns"
* "github.com/pulumi/pulumi-std/sdk/go/std"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* invokeJoin, err := std.Join(ctx, &std.JoinArgs{
* Separator: ".",
* Input: []string{
* "_dnsauth",
* "contoso",
* },
* }, nil)
* if err != nil {
* return err
* }
* _, err = dns.NewTxtRecord(ctx, "example", &dns.TxtRecordArgs{
* Name: pulumi.String(invokeJoin.Result),
* ZoneName: pulumi.Any(exampleAzurermDnsZone.Name),
* ResourceGroupName: pulumi.Any(exampleAzurermResourceGroup.Name),
* Ttl: pulumi.Int(3600),
* Records: dns.TxtRecordRecordArray{
* &dns.TxtRecordRecordArgs{
* Value: pulumi.Any(exampleAzurermCdnFrontdoorCustomDomain.ValidationToken),
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.dns.TxtRecord;
* import com.pulumi.azure.dns.TxtRecordArgs;
* import com.pulumi.azure.dns.inputs.TxtRecordRecordArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new TxtRecord("example", TxtRecordArgs.builder()
* .name(StdFunctions.join(JoinArgs.builder()
* .separator(".")
* .input(
* "_dnsauth",
* "contoso")
* .build()).result())
* .zoneName(exampleAzurermDnsZone.name())
* .resourceGroupName(exampleAzurermResourceGroup.name())
* .ttl(3600)
* .records(TxtRecordRecordArgs.builder()
* .value(exampleAzurermCdnFrontdoorCustomDomain.validationToken())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:dns:TxtRecord
* properties:
* name:
* fn::invoke:
* Function: std:join
* Arguments:
* separator: .
* input:
* - _dnsauth
* - contoso
* Return: result
* zoneName: ${exampleAzurermDnsZone.name}
* resourceGroupName: ${exampleAzurermResourceGroup.name}
* ttl: 3600
* records:
* - value: ${exampleAzurermCdnFrontdoorCustomDomain.validationToken}
* ```
*
* ## Example CNAME Record Usage
* !>**IMPORTANT:** You **must** include the `depends_on` meta-argument which references both the `azure.cdn.FrontdoorRoute` and the `azure.cdn.FrontdoorSecurityPolicy` that are associated with your Custom Domain. The reason for these `depends_on` meta-arguments is because all of the resources for the Custom Domain need to be associated within Front Door before the CNAME record can be written to the domains DNS, else the CNAME validation will fail and Front Door will not enable traffic to the Domain.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.dns.CNameRecord("example", {
* name: "contoso",
* zoneName: exampleAzurermDnsZone.name,
* resourceGroupName: exampleAzurermResourceGroup.name,
* ttl: 3600,
* record: exampleAzurermCdnFrontdoorEndpoint.hostName,
* }, {
* dependsOn: [
* exampleAzurermCdnFrontdoorRoute,
* exampleAzurermCdnFrontdoorSecurityPolicy,
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.dns.CNameRecord("example",
* name="contoso",
* zone_name=example_azurerm_dns_zone["name"],
* resource_group_name=example_azurerm_resource_group["name"],
* ttl=3600,
* record=example_azurerm_cdn_frontdoor_endpoint["hostName"],
* opts = pulumi.ResourceOptions(depends_on=[
* example_azurerm_cdn_frontdoor_route,
* example_azurerm_cdn_frontdoor_security_policy,
* ]))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Dns.CNameRecord("example", new()
* {
* Name = "contoso",
* ZoneName = exampleAzurermDnsZone.Name,
* ResourceGroupName = exampleAzurermResourceGroup.Name,
* Ttl = 3600,
* Record = exampleAzurermCdnFrontdoorEndpoint.HostName,
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* exampleAzurermCdnFrontdoorRoute,
* exampleAzurermCdnFrontdoorSecurityPolicy,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/dns"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := dns.NewCNameRecord(ctx, "example", &dns.CNameRecordArgs{
* Name: pulumi.String("contoso"),
* ZoneName: pulumi.Any(exampleAzurermDnsZone.Name),
* ResourceGroupName: pulumi.Any(exampleAzurermResourceGroup.Name),
* Ttl: pulumi.Int(3600),
* Record: pulumi.Any(exampleAzurermCdnFrontdoorEndpoint.HostName),
* }, pulumi.DependsOn([]pulumi.Resource{
* exampleAzurermCdnFrontdoorRoute,
* exampleAzurermCdnFrontdoorSecurityPolicy,
* }))
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.dns.CNameRecord;
* import com.pulumi.azure.dns.CNameRecordArgs;
* import com.pulumi.resources.CustomResourceOptions;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new CNameRecord("example", CNameRecordArgs.builder()
* .name("contoso")
* .zoneName(exampleAzurermDnsZone.name())
* .resourceGroupName(exampleAzurermResourceGroup.name())
* .ttl(3600)
* .record(exampleAzurermCdnFrontdoorEndpoint.hostName())
* .build(), CustomResourceOptions.builder()
* .dependsOn(
* exampleAzurermCdnFrontdoorRoute,
* exampleAzurermCdnFrontdoorSecurityPolicy)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:dns:CNameRecord
* properties:
* name: contoso
* zoneName: ${exampleAzurermDnsZone.name}
* resourceGroupName: ${exampleAzurermResourceGroup.name}
* ttl: 3600
* record: ${exampleAzurermCdnFrontdoorEndpoint.hostName}
* options:
* dependson:
* - ${exampleAzurermCdnFrontdoorRoute}
* - ${exampleAzurermCdnFrontdoorSecurityPolicy}
* ```
*
* ## Import
* Front Door Custom Domains 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
* ```
*/
public class FrontdoorCustomDomain internal constructor(
override val javaResource: com.pulumi.azure.cdn.FrontdoorCustomDomain,
) : KotlinCustomResource(javaResource, FrontdoorCustomDomainMapper) {
/**
* The ID of the Front Door Profile. Changing this forces a new Front Door Custom Domain to be created.
*/
public val cdnFrontdoorProfileId: Output
get() = javaResource.cdnFrontdoorProfileId().applyValue({ args0 -> args0 })
/**
* The ID of the Azure DNS Zone which should be used for this Front Door Custom Domain. If you are using Azure to host your [DNS domains](https://learn.microsoft.com/azure/dns/dns-overview), you must delegate the domain provider's domain name system (DNS) to an Azure DNS Zone. For more information, see [Delegate a domain to Azure DNS](https://learn.microsoft.com/azure/dns/dns-delegate-domain-azure-dns). Otherwise, if you're using your own domain provider to handle your DNS, you must validate the Front Door Custom Domain by creating the DNS TXT records manually.
*
*/
public val dnsZoneId: Output?
get() = javaResource.dnsZoneId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The date time that the token expires.
*/
public val expirationDate: Output
get() = javaResource.expirationDate().applyValue({ args0 -> args0 })
/**
* The host name of the domain. The `host_name` field must be the FQDN of your domain(e.g. `contoso.fabrikam.com`). Changing this forces a new Front Door Custom Domain to be created.
*/
public val hostName: Output
get() = javaResource.hostName().applyValue({ args0 -> args0 })
/**
* The name which should be used for this Front Door Custom Domain. Possible values must be between 2 and 260 characters in length, must begin with a letter or number, end with a letter or number and contain only letters, numbers and hyphens. Changing this forces a new Front Door Custom Domain to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A `tls` block as defined below.
*/
public val tls: Output
get() = javaResource.tls().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
/**
* Challenge used for DNS TXT record or file based validation.
*/
public val validationToken: Output
get() = javaResource.validationToken().applyValue({ args0 -> args0 })
}
public object FrontdoorCustomDomainMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.cdn.FrontdoorCustomDomain::class == javaResource::class
override fun map(javaResource: Resource): FrontdoorCustomDomain =
FrontdoorCustomDomain(javaResource as com.pulumi.azure.cdn.FrontdoorCustomDomain)
}
/**
* @see [FrontdoorCustomDomain].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [FrontdoorCustomDomain].
*/
public suspend fun frontdoorCustomDomain(
name: String,
block: suspend FrontdoorCustomDomainResourceBuilder.() -> Unit,
): FrontdoorCustomDomain {
val builder = FrontdoorCustomDomainResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [FrontdoorCustomDomain].
* @param name The _unique_ name of the resulting resource.
*/
public fun frontdoorCustomDomain(name: String): FrontdoorCustomDomain {
val builder = FrontdoorCustomDomainResourceBuilder()
builder.name(name)
return builder.build()
}