Azure Classic

Pulumi Official
Package maintained by Pulumi
v5.11.0 published on Monday, Jun 27, 2022 by Pulumi

StaticSiteCustomDomain

Import

Static Site Custom Domains can be imported using the resource id, e.g.

 $ pulumi import azure:appservice/staticSiteCustomDomain:StaticSiteCustomDomain example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1/customDomains/name.contoso.com

Example Usage

CNAME validation

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var exampleStaticSite = new Azure.AppService.StaticSite("exampleStaticSite", new Azure.AppService.StaticSiteArgs
        {
            ResourceGroupName = exampleResourceGroup.Name,
            Location = exampleResourceGroup.Location,
        });
        var exampleCNameRecord = new Azure.Dns.CNameRecord("exampleCNameRecord", new Azure.Dns.CNameRecordArgs
        {
            ZoneName = "contoso.com",
            ResourceGroupName = exampleResourceGroup.Name,
            Ttl = 300,
            Record = exampleStaticSite.DefaultHostName,
        });
        var exampleStaticSiteCustomDomain = new Azure.AppService.StaticSiteCustomDomain("exampleStaticSiteCustomDomain", new Azure.AppService.StaticSiteCustomDomainArgs
        {
            StaticSiteId = exampleStaticSite.Id,
            DomainName = Output.Tuple(exampleCNameRecord.Name, exampleCNameRecord.ZoneName).Apply(values =>
            {
                var name = values.Item1;
                var zoneName = values.Item2;
                return $"{name}.{zoneName}";
            }),
            ValidationType = "cname-delegation",
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
	"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 {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleStaticSite, err := appservice.NewStaticSite(ctx, "exampleStaticSite", &appservice.StaticSiteArgs{
			ResourceGroupName: exampleResourceGroup.Name,
			Location:          exampleResourceGroup.Location,
		})
		if err != nil {
			return err
		}
		exampleCNameRecord, err := dns.NewCNameRecord(ctx, "exampleCNameRecord", &dns.CNameRecordArgs{
			ZoneName:          pulumi.String("contoso.com"),
			ResourceGroupName: exampleResourceGroup.Name,
			Ttl:               pulumi.Int(300),
			Record:            exampleStaticSite.DefaultHostName,
		})
		if err != nil {
			return err
		}
		_, err = appservice.NewStaticSiteCustomDomain(ctx, "exampleStaticSiteCustomDomain", &appservice.StaticSiteCustomDomainArgs{
			StaticSiteId: exampleStaticSite.ID(),
			DomainName: pulumi.All(exampleCNameRecord.Name, exampleCNameRecord.ZoneName).ApplyT(func(_args []interface{}) (string, error) {
				name := _args[0].(string)
				zoneName := _args[1].(string)
				return fmt.Sprintf("%v%v%v", name, ".", zoneName), nil
			}).(pulumi.StringOutput),
			ValidationType: pulumi.String("cname-delegation"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleStaticSite = new StaticSite("exampleStaticSite", StaticSiteArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .location(exampleResourceGroup.location())
            .build());

        var exampleCNameRecord = new CNameRecord("exampleCNameRecord", CNameRecordArgs.builder()        
            .zoneName("contoso.com")
            .resourceGroupName(exampleResourceGroup.name())
            .ttl(300)
            .record(exampleStaticSite.defaultHostName())
            .build());

        var exampleStaticSiteCustomDomain = new StaticSiteCustomDomain("exampleStaticSiteCustomDomain", StaticSiteCustomDomainArgs.builder()        
            .staticSiteId(exampleStaticSite.id())
            .domainName(Output.tuple(exampleCNameRecord.name(), exampleCNameRecord.zoneName()).apply(values -> {
                var name = values.t1;
                var zoneName = values.t2;
                return String.format("%s.%s", name,zoneName);
            }))
            .validationType("cname-delegation")
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_static_site = azure.appservice.StaticSite("exampleStaticSite",
    resource_group_name=example_resource_group.name,
    location=example_resource_group.location)
example_c_name_record = azure.dns.CNameRecord("exampleCNameRecord",
    zone_name="contoso.com",
    resource_group_name=example_resource_group.name,
    ttl=300,
    record=example_static_site.default_host_name)
example_static_site_custom_domain = azure.appservice.StaticSiteCustomDomain("exampleStaticSiteCustomDomain",
    static_site_id=example_static_site.id,
    domain_name=pulumi.Output.all(example_c_name_record.name, example_c_name_record.zone_name).apply(lambda name, zone_name: f"{name}.{zone_name}"),
    validation_type="cname-delegation")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleStaticSite = new azure.appservice.StaticSite("exampleStaticSite", {
    resourceGroupName: exampleResourceGroup.name,
    location: exampleResourceGroup.location,
});
const exampleCNameRecord = new azure.dns.CNameRecord("exampleCNameRecord", {
    zoneName: "contoso.com",
    resourceGroupName: exampleResourceGroup.name,
    ttl: 300,
    record: exampleStaticSite.defaultHostName,
});
const exampleStaticSiteCustomDomain = new azure.appservice.StaticSiteCustomDomain("exampleStaticSiteCustomDomain", {
    staticSiteId: exampleStaticSite.id,
    domainName: pulumi.interpolate`${exampleCNameRecord.name}.${exampleCNameRecord.zoneName}`,
    validationType: "cname-delegation",
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleStaticSite:
    type: azure:appservice:StaticSite
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      location: ${exampleResourceGroup.location}
  exampleCNameRecord:
    type: azure:dns:CNameRecord
    properties:
      zoneName: contoso.com
      resourceGroupName: ${exampleResourceGroup.name}
      ttl: 300
      record: ${exampleStaticSite.defaultHostName}
  exampleStaticSiteCustomDomain:
    type: azure:appservice:StaticSiteCustomDomain
    properties:
      staticSiteId: ${exampleStaticSite.id}
      domainName: ${exampleCNameRecord.name}.${exampleCNameRecord.zoneName}
      validationType: cname-delegation

Create a StaticSiteCustomDomain Resource

new StaticSiteCustomDomain(name: string, args: StaticSiteCustomDomainArgs, opts?: CustomResourceOptions);
@overload
def StaticSiteCustomDomain(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           domain_name: Optional[str] = None,
                           static_site_id: Optional[str] = None,
                           validation_type: Optional[str] = None)
@overload
def StaticSiteCustomDomain(resource_name: str,
                           args: StaticSiteCustomDomainArgs,
                           opts: Optional[ResourceOptions] = None)
func NewStaticSiteCustomDomain(ctx *Context, name string, args StaticSiteCustomDomainArgs, opts ...ResourceOption) (*StaticSiteCustomDomain, error)
public StaticSiteCustomDomain(string name, StaticSiteCustomDomainArgs args, CustomResourceOptions? opts = null)
public StaticSiteCustomDomain(String name, StaticSiteCustomDomainArgs args)
public StaticSiteCustomDomain(String name, StaticSiteCustomDomainArgs args, CustomResourceOptions options)
type: azure:appservice:StaticSiteCustomDomain
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args StaticSiteCustomDomainArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args StaticSiteCustomDomainArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args StaticSiteCustomDomainArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args StaticSiteCustomDomainArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args StaticSiteCustomDomainArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

StaticSiteCustomDomain Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The StaticSiteCustomDomain resource accepts the following input properties:

DomainName string

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

StaticSiteId string

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

ValidationType string

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

DomainName string

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

StaticSiteId string

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

ValidationType string

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domainName String

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

staticSiteId String

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validationType String

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domainName string

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

staticSiteId string

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validationType string

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domain_name str

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

static_site_id str

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validation_type str

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domainName String

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

staticSiteId String

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validationType String

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the StaticSiteCustomDomain resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

ValidationToken string

Token to be used with dns-txt-token validation.

Id string

The provider-assigned unique ID for this managed resource.

ValidationToken string

Token to be used with dns-txt-token validation.

id String

The provider-assigned unique ID for this managed resource.

validationToken String

Token to be used with dns-txt-token validation.

id string

The provider-assigned unique ID for this managed resource.

validationToken string

Token to be used with dns-txt-token validation.

id str

The provider-assigned unique ID for this managed resource.

validation_token str

Token to be used with dns-txt-token validation.

id String

The provider-assigned unique ID for this managed resource.

validationToken String

Token to be used with dns-txt-token validation.

Look up an Existing StaticSiteCustomDomain Resource

Get an existing StaticSiteCustomDomain resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: StaticSiteCustomDomainState, opts?: CustomResourceOptions): StaticSiteCustomDomain
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        domain_name: Optional[str] = None,
        static_site_id: Optional[str] = None,
        validation_token: Optional[str] = None,
        validation_type: Optional[str] = None) -> StaticSiteCustomDomain
func GetStaticSiteCustomDomain(ctx *Context, name string, id IDInput, state *StaticSiteCustomDomainState, opts ...ResourceOption) (*StaticSiteCustomDomain, error)
public static StaticSiteCustomDomain Get(string name, Input<string> id, StaticSiteCustomDomainState? state, CustomResourceOptions? opts = null)
public static StaticSiteCustomDomain get(String name, Output<String> id, StaticSiteCustomDomainState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DomainName string

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

StaticSiteId string

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

ValidationToken string

Token to be used with dns-txt-token validation.

ValidationType string

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

DomainName string

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

StaticSiteId string

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

ValidationToken string

Token to be used with dns-txt-token validation.

ValidationType string

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domainName String

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

staticSiteId String

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validationToken String

Token to be used with dns-txt-token validation.

validationType String

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domainName string

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

staticSiteId string

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validationToken string

Token to be used with dns-txt-token validation.

validationType string

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domain_name str

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

static_site_id str

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validation_token str

Token to be used with dns-txt-token validation.

validation_type str

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

domainName String

The Domain Name which should be associated with this Static Site. Changing this forces a new Static Site Custom Domain to be created.

staticSiteId String

The ID of the Static Site. Changing this forces a new Static Site Custom Domain to be created.

validationToken String

Token to be used with dns-txt-token validation.

validationType String

One of cname-delegation or dns-txt-token. Changing this forces a new Static Site Custom Domain to be created.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.