The AWS::Amplify::Domain resource allows you to connect a custom domain to your app.
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"
},
]
}
app_id
(String)domain_name
(String)sub_domain_settings
(Attributes List) (see below for nested schema)auto_sub_domain_creation_patterns
(List of String)auto_sub_domain_iam_role
(String)certificate_settings
(Attributes) (see below for nested schema)enable_auto_sub_domain
(Boolean)arn
(String)certificate
(Attributes) (see below for nested schema)certificate_record
(String)domain_status
(String)id
(String) Uniquely identifies the resource.status_reason
(String)update_status
(String)sub_domain_settings
Required:
branch_name
(String)prefix
(String)certificate_settings
Optional:
certificate_type
(String)custom_certificate_arn
(String)certificate
Read-Only:
certificate_arn
(String)certificate_type
(String)certificate_verification_dns_record
(String)Import is supported using the following syntax:
$ terraform import awscc_amplify_domain.example <resource ID>