Skip to content

Latest commit

 

History

History
93 lines (75 loc) · 3.4 KB

.header.md

File metadata and controls

93 lines (75 loc) · 3.4 KB

Features

  • Conditional and Dynamic Resource Creation
  • Automatic and Manual Branch Creation Support
  • Automatic and Manual Branch Deletion Support
  • Automatic Build for Branches Support
  • Customizable Automatic Branch Creation Patterns Support
  • Pull Request Previews Support
  • CodeCommit, GitHub, GitLab support with examples
  • Related workshop for deeper explanation

Basic Usage - CodeCommit Repo with Automatic Branch Creation

// This is a template file for a basic deployment.
// Modify the parameters below with actual values
module "sample-qs" {
  // location of the module - can be local or git repo
  source = "aws-ia/amplify-app/aws"


  app_name = "my-app"
  create_codecommit_repo = true
  lookup_existing_codecommit_repo = false
  // see /examples for sample_build_spec
  path_to_build_spec = "/path/to/your/build/spec/file"



  // Auto Branch Creation
  enable_auto_branch_creation   = true
  enable_auto_branch_deletion   = true
  auto_branch_creation_patterns = ["main"]
  enable_auto_build             = true
  enable_app_pr_preview   = true
  app_framework                     = "Something bloated and hard to maintain"


  // - Custom Domain -
  create_domain_associations = false
  domain_name                = "yourdomain.com"
  domain_associations = {
    core = {
      branch_name = "main"
      prefix      = ""
    },
    www = {
      branch_name = "main"
      prefix      = "www"
    },
  }

  custom_rewrite_and_redirect = {
    // Static website rewrite/redirect
    static_site = {
      source = "/<*>"
      status = "404"
      target = "/index.html"
    },
    // Rewrite/redirect for single page apps - default if you don't specify anything else
    # single_page_app = {
    #   source = "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>"
    #   status = "200"
    #   target = "/index.html"
    # },
    // Rewrite/redirect for `yourdomain.com/app2` to `yourotherdomain.com`
    # app2 = {
    #   source = "/app2"
    #   status = "302"
    #   target = "https://yourotherdomain.com"
    # },
  }
}

Examples

Contributing

See the CONTRIBUTING.md file for information on how to contribute.

Workshop

For more information, check out my workshop Automating Deployment of AWS Amplify Apps with Terraform