Sets up a basic AWS Amplify App with a React build specification and custom 404 redirects.

Terraform Template

resource "aws_amplify_app" "example" {
  build_spec = <<-EOF
    version: 0.1
    frontend:
    phases:
    preBuild:
    commands:
    - yarn install
    build:
    commands:
    - yarn run build
    artifacts:
    baseDirectory: build
    files:
    - '**/*'
    cache:
    paths:
    - node_modules/**/*
    
  EOF

  custom_rule {
    source = "/<*>"
    status = "404"
    target = "/index.html"
  }

  environment_variables = {
    ENV = "test"
  }
  name = "example"
  repository = "https://github.com/example/app"
}