Skip to content

Commit

Permalink
Migrate manual provisioned Amplify to be managed by terraform (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianmtech authored Jul 17, 2024
1 parent dbcf942 commit 9d09918
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ dist/
# misc
*.DS_Store

# Terraform files
*.tfstate
*.tfstate.backup
*.tfplan
.terraform/
24 changes: 24 additions & 0 deletions terraform/Amplify/.terraform.lock.hcl

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

48 changes: 48 additions & 0 deletions terraform/Amplify/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
resource "aws_amplify_app" "main" {
name = "restaking-dashboard"
repository = "https://github.com/NethermindEth/restaking-dashboard"

environment_variables = {
"ENV" = "prod"
}

custom_rule {
source = "/<*>"
status = "404-200"
target = "/index.html"
}
custom_rule {
source = "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json|webp)$)([^.]+$)/>"
status = "200"
target = "/index.html"
}
}

resource "aws_amplify_branch" "main" {
app_id = aws_amplify_app.main.id
branch_name = "main"
stage = "PRODUCTION"

enable_auto_build = false
}

resource "aws_amplify_domain_association" "main" {
app_id = aws_amplify_app.main.id
domain_name = "restaking.info"

wait_for_verification = false

# https://stage.restaking.info
sub_domain {
branch_name = aws_amplify_branch.main.branch_name
prefix = "stage"
}
}


resource "aws_amplify_webhook" "stage" {
app_id = aws_amplify_app.main.id
branch_name = aws_amplify_branch.main.branch_name
description = "stage"
}

18 changes: 18 additions & 0 deletions terraform/Amplify/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
terraform {
backend "s3" {
bucket = "restaking-dashboard-terraform-state"
key = "frontend.tfstate"
region = "us-east-2"
}

}

provider "aws" {
region = "us-east-1"

default_tags {
tags = {
Project = "Restaking Dashboard"
}
}
}

0 comments on commit 9d09918

Please sign in to comment.