aws logo
AWS Classic v5.33.0, Mar 24 23

aws.amplify.DomainAssociation

Provides an Amplify Domain Association resource.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var exampleApp = new Aws.Amplify.App("exampleApp", new()
    {
        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 = exampleApp.Id,
        BranchName = "master",
    });

    var exampleDomainAssociation = new Aws.Amplify.DomainAssociation("exampleDomainAssociation", new()
    {
        AppId = exampleApp.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 main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/amplify"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleApp, err := amplify.NewApp(ctx, "exampleApp", &amplify.AppArgs{
			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:      exampleApp.ID(),
			BranchName: pulumi.String("master"),
		})
		if err != nil {
			return err
		}
		_, err = amplify.NewDomainAssociation(ctx, "exampleDomainAssociation", &amplify.DomainAssociationArgs{
			AppId:      exampleApp.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
	})
}
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 exampleApp = new App("exampleApp", AppArgs.builder()        
            .customRules(AppCustomRuleArgs.builder()
                .source("https://example.com")
                .status("302")
                .target("https://www.example.com")
                .build())
            .build());

        var master = new Branch("master", BranchArgs.builder()        
            .appId(exampleApp.id())
            .branchName("master")
            .build());

        var exampleDomainAssociation = new DomainAssociation("exampleDomainAssociation", DomainAssociationArgs.builder()        
            .appId(exampleApp.id())
            .domainName("example.com")
            .subDomains(            
                DomainAssociationSubDomainArgs.builder()
                    .branchName(master.branchName())
                    .prefix("")
                    .build(),
                DomainAssociationSubDomainArgs.builder()
                    .branchName(master.branchName())
                    .prefix("www")
                    .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example_app = aws.amplify.App("exampleApp", custom_rules=[aws.amplify.AppCustomRuleArgs(
    source="https://example.com",
    status="302",
    target="https://www.example.com",
)])
master = aws.amplify.Branch("master",
    app_id=example_app.id,
    branch_name="master")
example_domain_association = aws.amplify.DomainAssociation("exampleDomainAssociation",
    app_id=example_app.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",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleApp = new aws.amplify.App("exampleApp", {customRules: [{
    source: "https://example.com",
    status: "302",
    target: "https://www.example.com",
}]});
const master = new aws.amplify.Branch("master", {
    appId: exampleApp.id,
    branchName: "master",
});
const exampleDomainAssociation = new aws.amplify.DomainAssociation("exampleDomainAssociation", {
    appId: exampleApp.id,
    domainName: "example.com",
    subDomains: [
        {
            branchName: master.branchName,
            prefix: "",
        },
        {
            branchName: master.branchName,
            prefix: "www",
        },
    ],
});
resources:
  exampleApp:
    type: aws:amplify:App
    properties:
      # Setup redirect from https://example.com to https://www.example.com
      customRules:
        - source: https://example.com
          status: '302'
          target: https://www.example.com
  master:
    type: aws:amplify:Branch
    properties:
      appId: ${exampleApp.id}
      branchName: master
  exampleDomainAssociation:
    type: aws:amplify:DomainAssociation
    properties:
      appId: ${exampleApp.id}
      domainName: example.com
      # https://example.com
      subDomains:
        - branchName: ${master.branchName}
          prefix:
        - branchName: ${master.branchName}
          prefix: www

Create DomainAssociation Resource

new DomainAssociation(name: string, args: DomainAssociationArgs, opts?: CustomResourceOptions);
@overload
def DomainAssociation(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      app_id: 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)
@overload
def DomainAssociation(resource_name: str,
                      args: DomainAssociationArgs,
                      opts: Optional[ResourceOptions] = 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.

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.

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<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 []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<DomainAssociationSubDomainArgs>

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 DomainAssociationSubDomainArgs[]

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<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 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<DomainAssociationSubDomainArgs>

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 DomainAssociationSubDomainArgs[]

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

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

Amplify domain association can be imported using app_id and domain_name, e.g.,

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.