awscc_amplify_domain (Resource)

The AWS::Amplify::Domain resource allows you to connect a custom domain to your app.

Example Usage

Basic Domain and Subdomains

resource "awscc_amplify_app" "example" {
  name = "app"

  # Setup redirect from https://example.com to https://www.example.com
  custom_rules = [
    {
      source = "https://example.com"
      status = "302"
      target = "https://www.example.com"
    },
  ]
}

resource "awscc_amplify_branch" "main" {
  app_id      = awscc_amplify_app.example.app_id
  branch_name = "main"
}

resource "awscc_amplify_domain" "example" {
  app_id      = awscc_amplify_app.example.app_id
  domain_name = "example.com"

  sub_domain_settings = [
    {
      # https://example.com
      branch_name = aws_amplify_branch.main.branch_name
      prefix      = ""
    },
    {
      # https://www.example.com
      branch_name = aws_amplify_branch.main.branch_name
      prefix      = "www"
    },
  ]
}

Schema

Required

Optional

Read-Only

Nested Schema for sub_domain_settings

Required:

Nested Schema for certificate_settings

Optional:

Nested Schema for certificate

Read-Only:

Import

Import is supported using the following syntax:

$ terraform import awscc_amplify_domain.example <resource ID>