Skip to content

Commit

Permalink
Use awscc Terraform provider for the Amplify domain
Browse files Browse the repository at this point in the history
  • Loading branch information
kdid committed Dec 3, 2024
1 parent 59350a9 commit 5dee5b7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
22 changes: 22 additions & 0 deletions terraform/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 20 additions & 13 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ provider "aws" {
}
}

provider "awscc" {
region = var.aws_region
}

data "aws_iam_policy_document" "assume_role" {
statement {
effect = "Allow"
Expand Down Expand Up @@ -119,17 +123,20 @@ resource "aws_amplify_branch" "production" {

}

resource "aws_amplify_domain_association" "dc_next_domain" {
app_id = aws_amplify_app.dc-next.id
domain_name = "${var.project}.${var.dns_zone}"

sub_domain {
branch_name = aws_amplify_branch.production.branch_name
prefix = ""
}

sub_domain {
branch_name = aws_amplify_branch.production.branch_name
prefix = "www"
}
resource "awscc_amplify_domain" "dc_next_domain" {
app_id = aws_amplify_app.dc-next.id
domain_name = "${var.project}.${var.dns_zone}"
enable_auto_sub_domain = var.auto_branch_creation
auto_sub_domain_creation_patterns = ["preview/*"]

sub_domain_settings = [
{
branch_name = aws_amplify_branch.production.branch_name
prefix = ""
},
{
branch_name = aws_amplify_branch.production.branch_name
prefix = "www"
}
]
}

0 comments on commit 5dee5b7

Please sign in to comment.