1. Packages
  2. AWS Classic
  3. API Docs
  4. amplify
  5. DomainAssociation

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.30.0 published on Thursday, Apr 11, 2024 by Pulumi

aws.amplify.DomainAssociation

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.30.0 published on Thursday, Apr 11, 2024 by Pulumi

    Provides an Amplify Domain Association resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.amplify.App("example", {
        name: "app",
        customRules: [{
            source: "https://example.com",
            status: "302",
            target: "https://www.example.com",
        }],
    });
    const master = new aws.amplify.Branch("master", {
        appId: example.id,
        branchName: "master",
    });
    const exampleDomainAssociation = new aws.amplify.DomainAssociation("example", {
        appId: example.id,
        domainName: "example.com",
        subDomains: [
            {
                branchName: master.branchName,
                prefix: "",
            },
            {
                branchName: master.branchName,
                prefix: "www",
            },
        ],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.amplify.App("example",
        name="app",
        custom_rules=[aws.amplify.AppCustomRuleArgs(
            source="https://example.com",
            status="302",
            target="https://www.example.com",
        )])
    master = aws.amplify.Branch("master",
        app_id=example.id,
        branch_name="master")
    example_domain_association = aws.amplify.DomainAssociation("example",
        app_id=example.id,
        domain_name="example.com",
        sub_domains=[
            aws.amplify.DomainAssociationSubDomainArgs(
                branch_name=master.branch_name,
                prefix="",
            ),
            aws.amplify.DomainAssociationSubDomainArgs(
                branch_name=master.branch_name,
                prefix="www",
            ),
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amplify"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := amplify.NewApp(ctx, "example", &amplify.AppArgs{
    			Name: pulumi.String("app"),
    			CustomRules: amplify.AppCustomRuleArray{
    				&amplify.AppCustomRuleArgs{
    					Source: pulumi.String("https://example.com"),
    					Status: pulumi.String("302"),
    					Target: pulumi.String("https://www.example.com"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		master, err := amplify.NewBranch(ctx, "master", &amplify.BranchArgs{
    			AppId:      example.ID(),
    			BranchName: pulumi.String("master"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = amplify.NewDomainAssociation(ctx, "example", &amplify.DomainAssociationArgs{
    			AppId:      example.ID(),
    			DomainName: pulumi.String("example.com"),
    			SubDomains: amplify.DomainAssociationSubDomainArray{
    				&amplify.DomainAssociationSubDomainArgs{
    					BranchName: master.BranchName,
    					Prefix:     pulumi.String(""),
    				},
    				&amplify.DomainAssociationSubDomainArgs{
    					BranchName: master.BranchName,
    					Prefix:     pulumi.String("www"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Amplify.App("example", new()
        {
            Name = "app",
            CustomRules = new[]
            {
                new Aws.Amplify.Inputs.AppCustomRuleArgs
                {
                    Source = "https://example.com",
                    Status = "302",
                    Target = "https://www.example.com",
                },
            },
        });
    
        var master = new Aws.Amplify.Branch("master", new()
        {
            AppId = example.Id,
            BranchName = "master",
        });
    
        var exampleDomainAssociation = new Aws.Amplify.DomainAssociation("example", new()
        {
            AppId = example.Id,
            DomainName = "example.com",
            SubDomains = new[]
            {
                new Aws.Amplify.Inputs.DomainAssociationSubDomainArgs
                {
                    BranchName = master.BranchName,
                    Prefix = "",
                },
                new Aws.Amplify.Inputs.DomainAssociationSubDomainArgs
                {
                    BranchName = master.BranchName,
                    Prefix = "www",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.amplify.App;
    import com.pulumi.aws.amplify.AppArgs;
    import com.pulumi.aws.amplify.inputs.AppCustomRuleArgs;
    import com.pulumi.aws.amplify.Branch;
    import com.pulumi.aws.amplify.BranchArgs;
    import com.pulumi.aws.amplify.DomainAssociation;
    import com.pulumi.aws.amplify.DomainAssociationArgs;
    import com.pulumi.aws.amplify.inputs.DomainAssociationSubDomainArgs;
    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 App("example", AppArgs.builder()        
                .name("app")
                .customRules(AppCustomRuleArgs.builder()
                    .source("https://example.com")
                    .status("302")
                    .target("https://www.example.com")
                    .build())
                .build());
    
            var master = new Branch("master", BranchArgs.builder()        
                .appId(example.id())
                .branchName("master")
                .build());
    
            var exampleDomainAssociation = new DomainAssociation("exampleDomainAssociation", DomainAssociationArgs.builder()        
                .appId(example.id())
                .domainName("example.com")
                .subDomains(            
                    DomainAssociationSubDomainArgs.builder()
                        .branchName(master.branchName())
                        .prefix("")
                        .build(),
                    DomainAssociationSubDomainArgs.builder()
                        .branchName(master.branchName())
                        .prefix("www")
                        .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:amplify:App
        properties:
          name: app
          customRules:
            - source: https://example.com
              status: '302'
              target: https://www.example.com
      master:
        type: aws:amplify:Branch
        properties:
          appId: ${example.id}
          branchName: master
      exampleDomainAssociation:
        type: aws:amplify:DomainAssociation
        name: example
        properties:
          appId: ${example.id}
          domainName: example.com
          subDomains:
            - branchName: ${master.branchName}
              prefix:
            - branchName: ${master.branchName}
              prefix: www
    

    Create DomainAssociation Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new DomainAssociation(name: string, args: DomainAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def DomainAssociation(resource_name: str,
                          args: DomainAssociationArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def DomainAssociation(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          app_id: Optional[str] = None,
                          domain_name: Optional[str] = None,
                          sub_domains: Optional[Sequence[DomainAssociationSubDomainArgs]] = None,
                          enable_auto_sub_domain: Optional[bool] = None,
                          wait_for_verification: Optional[bool] = None)
    func NewDomainAssociation(ctx *Context, name string, args DomainAssociationArgs, opts ...ResourceOption) (*DomainAssociation, error)
    public DomainAssociation(string name, DomainAssociationArgs args, CustomResourceOptions? opts = null)
    public DomainAssociation(String name, DomainAssociationArgs args)
    public DomainAssociation(String name, DomainAssociationArgs args, CustomResourceOptions options)
    
    type: aws:amplify:DomainAssociation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DomainAssociationArgs
    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 DomainAssociationArgs
    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 DomainAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DomainAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DomainAssociationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var domainAssociationResource = new Aws.Amplify.DomainAssociation("domainAssociationResource", new()
    {
        AppId = "string",
        DomainName = "string",
        SubDomains = new[]
        {
            new Aws.Amplify.Inputs.DomainAssociationSubDomainArgs
            {
                BranchName = "string",
                Prefix = "string",
                DnsRecord = "string",
                Verified = false,
            },
        },
        EnableAutoSubDomain = false,
        WaitForVerification = false,
    });
    
    example, err := amplify.NewDomainAssociation(ctx, "domainAssociationResource", &amplify.DomainAssociationArgs{
    	AppId:      pulumi.String("string"),
    	DomainName: pulumi.String("string"),
    	SubDomains: amplify.DomainAssociationSubDomainArray{
    		&amplify.DomainAssociationSubDomainArgs{
    			BranchName: pulumi.String("string"),
    			Prefix:     pulumi.String("string"),
    			DnsRecord:  pulumi.String("string"),
    			Verified:   pulumi.Bool(false),
    		},
    	},
    	EnableAutoSubDomain: pulumi.Bool(false),
    	WaitForVerification: pulumi.Bool(false),
    })
    
    var domainAssociationResource = new DomainAssociation("domainAssociationResource", DomainAssociationArgs.builder()        
        .appId("string")
        .domainName("string")
        .subDomains(DomainAssociationSubDomainArgs.builder()
            .branchName("string")
            .prefix("string")
            .dnsRecord("string")
            .verified(false)
            .build())
        .enableAutoSubDomain(false)
        .waitForVerification(false)
        .build());
    
    domain_association_resource = aws.amplify.DomainAssociation("domainAssociationResource",
        app_id="string",
        domain_name="string",
        sub_domains=[aws.amplify.DomainAssociationSubDomainArgs(
            branch_name="string",
            prefix="string",
            dns_record="string",
            verified=False,
        )],
        enable_auto_sub_domain=False,
        wait_for_verification=False)
    
    const domainAssociationResource = new aws.amplify.DomainAssociation("domainAssociationResource", {
        appId: "string",
        domainName: "string",
        subDomains: [{
            branchName: "string",
            prefix: "string",
            dnsRecord: "string",
            verified: false,
        }],
        enableAutoSubDomain: false,
        waitForVerification: false,
    });
    
    type: aws:amplify:DomainAssociation
    properties:
        appId: string
        domainName: string
        enableAutoSubDomain: false
        subDomains:
            - branchName: string
              dnsRecord: string
              prefix: string
              verified: false
        waitForVerification: false
    

    DomainAssociation 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 DomainAssociation resource accepts the following input properties:

    AppId string
    Unique ID for an Amplify app.
    DomainName string
    Domain name for the domain association.
    SubDomains List<DomainAssociationSubDomain>
    Setting for the subdomain. Documented below.
    EnableAutoSubDomain bool
    Enables the automated creation of subdomains for branches.
    WaitForVerification bool
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    AppId string
    Unique ID for an Amplify app.
    DomainName string
    Domain name for the domain association.
    SubDomains []DomainAssociationSubDomainArgs
    Setting for the subdomain. Documented below.
    EnableAutoSubDomain bool
    Enables the automated creation of subdomains for branches.
    WaitForVerification bool
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    appId String
    Unique ID for an Amplify app.
    domainName String
    Domain name for the domain association.
    subDomains List<DomainAssociationSubDomain>
    Setting for the subdomain. Documented below.
    enableAutoSubDomain Boolean
    Enables the automated creation of subdomains for branches.
    waitForVerification Boolean
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    appId string
    Unique ID for an Amplify app.
    domainName string
    Domain name for the domain association.
    subDomains DomainAssociationSubDomain[]
    Setting for the subdomain. Documented below.
    enableAutoSubDomain boolean
    Enables the automated creation of subdomains for branches.
    waitForVerification boolean
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    app_id str
    Unique ID for an Amplify app.
    domain_name str
    Domain name for the domain association.
    sub_domains Sequence[DomainAssociationSubDomainArgs]
    Setting for the subdomain. Documented below.
    enable_auto_sub_domain bool
    Enables the automated creation of subdomains for branches.
    wait_for_verification bool
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    appId String
    Unique ID for an Amplify app.
    domainName String
    Domain name for the domain association.
    subDomains List<Property Map>
    Setting for the subdomain. Documented below.
    enableAutoSubDomain Boolean
    Enables the automated creation of subdomains for branches.
    waitForVerification Boolean
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.

    Outputs

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

    Arn string
    ARN for the domain association.
    CertificateVerificationDnsRecord string
    The DNS record for certificate verification.
    Id string
    The provider-assigned unique ID for this managed resource.
    Arn string
    ARN for the domain association.
    CertificateVerificationDnsRecord string
    The DNS record for certificate verification.
    Id string
    The provider-assigned unique ID for this managed resource.
    arn String
    ARN for the domain association.
    certificateVerificationDnsRecord String
    The DNS record for certificate verification.
    id String
    The provider-assigned unique ID for this managed resource.
    arn string
    ARN for the domain association.
    certificateVerificationDnsRecord string
    The DNS record for certificate verification.
    id string
    The provider-assigned unique ID for this managed resource.
    arn str
    ARN for the domain association.
    certificate_verification_dns_record str
    The DNS record for certificate verification.
    id str
    The provider-assigned unique ID for this managed resource.
    arn String
    ARN for the domain association.
    certificateVerificationDnsRecord String
    The DNS record for certificate verification.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DomainAssociation Resource

    Get an existing DomainAssociation 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?: DomainAssociationState, opts?: CustomResourceOptions): DomainAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_id: Optional[str] = None,
            arn: Optional[str] = None,
            certificate_verification_dns_record: Optional[str] = None,
            domain_name: Optional[str] = None,
            enable_auto_sub_domain: Optional[bool] = None,
            sub_domains: Optional[Sequence[DomainAssociationSubDomainArgs]] = None,
            wait_for_verification: Optional[bool] = None) -> DomainAssociation
    func GetDomainAssociation(ctx *Context, name string, id IDInput, state *DomainAssociationState, opts ...ResourceOption) (*DomainAssociation, error)
    public static DomainAssociation Get(string name, Input<string> id, DomainAssociationState? state, CustomResourceOptions? opts = null)
    public static DomainAssociation get(String name, Output<String> id, DomainAssociationState 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:
    AppId string
    Unique ID for an Amplify app.
    Arn string
    ARN for the domain association.
    CertificateVerificationDnsRecord string
    The DNS record for certificate verification.
    DomainName string
    Domain name for the domain association.
    EnableAutoSubDomain bool
    Enables the automated creation of subdomains for branches.
    SubDomains List<DomainAssociationSubDomain>
    Setting for the subdomain. Documented below.
    WaitForVerification bool
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    AppId string
    Unique ID for an Amplify app.
    Arn string
    ARN for the domain association.
    CertificateVerificationDnsRecord string
    The DNS record for certificate verification.
    DomainName string
    Domain name for the domain association.
    EnableAutoSubDomain bool
    Enables the automated creation of subdomains for branches.
    SubDomains []DomainAssociationSubDomainArgs
    Setting for the subdomain. Documented below.
    WaitForVerification bool
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    appId String
    Unique ID for an Amplify app.
    arn String
    ARN for the domain association.
    certificateVerificationDnsRecord String
    The DNS record for certificate verification.
    domainName String
    Domain name for the domain association.
    enableAutoSubDomain Boolean
    Enables the automated creation of subdomains for branches.
    subDomains List<DomainAssociationSubDomain>
    Setting for the subdomain. Documented below.
    waitForVerification Boolean
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    appId string
    Unique ID for an Amplify app.
    arn string
    ARN for the domain association.
    certificateVerificationDnsRecord string
    The DNS record for certificate verification.
    domainName string
    Domain name for the domain association.
    enableAutoSubDomain boolean
    Enables the automated creation of subdomains for branches.
    subDomains DomainAssociationSubDomain[]
    Setting for the subdomain. Documented below.
    waitForVerification boolean
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    app_id str
    Unique ID for an Amplify app.
    arn str
    ARN for the domain association.
    certificate_verification_dns_record str
    The DNS record for certificate verification.
    domain_name str
    Domain name for the domain association.
    enable_auto_sub_domain bool
    Enables the automated creation of subdomains for branches.
    sub_domains Sequence[DomainAssociationSubDomainArgs]
    Setting for the subdomain. Documented below.
    wait_for_verification bool
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.
    appId String
    Unique ID for an Amplify app.
    arn String
    ARN for the domain association.
    certificateVerificationDnsRecord String
    The DNS record for certificate verification.
    domainName String
    Domain name for the domain association.
    enableAutoSubDomain Boolean
    Enables the automated creation of subdomains for branches.
    subDomains List<Property Map>
    Setting for the subdomain. Documented below.
    waitForVerification Boolean
    If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.

    Supporting Types

    DomainAssociationSubDomain, DomainAssociationSubDomainArgs

    BranchName string
    Branch name setting for the subdomain.
    Prefix string
    Prefix setting for the subdomain.
    DnsRecord string
    DNS record for the subdomain.
    Verified bool
    Verified status of the subdomain.
    BranchName string
    Branch name setting for the subdomain.
    Prefix string
    Prefix setting for the subdomain.
    DnsRecord string
    DNS record for the subdomain.
    Verified bool
    Verified status of the subdomain.
    branchName String
    Branch name setting for the subdomain.
    prefix String
    Prefix setting for the subdomain.
    dnsRecord String
    DNS record for the subdomain.
    verified Boolean
    Verified status of the subdomain.
    branchName string
    Branch name setting for the subdomain.
    prefix string
    Prefix setting for the subdomain.
    dnsRecord string
    DNS record for the subdomain.
    verified boolean
    Verified status of the subdomain.
    branch_name str
    Branch name setting for the subdomain.
    prefix str
    Prefix setting for the subdomain.
    dns_record str
    DNS record for the subdomain.
    verified bool
    Verified status of the subdomain.
    branchName String
    Branch name setting for the subdomain.
    prefix String
    Prefix setting for the subdomain.
    dnsRecord String
    DNS record for the subdomain.
    verified Boolean
    Verified status of the subdomain.

    Import

    Using pulumi import, import Amplify domain association using app_id and domain_name. For example:

    $ pulumi import aws:amplify/domainAssociation:DomainAssociation app d2ypk4k47z8u6/example.com
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.30.0 published on Thursday, Apr 11, 2024 by Pulumi