Skip to content

pbs/terraform-aws-amplify-module

Repository files navigation

PBS TF Amplify Module

Installation

Using the Repo Source

Use this URL for the source of the module. See the usage examples below for more details.

github.com/pbs/terraform-aws-amplify-module?ref=0.0.18

Alternative Installation Methods

More information can be found on these install methods and more in the documentation here.

Usage

Provisions an Amplify application.

The recommended usage for this module is to avoid populating any token input variables and to import an Amplify application that was created in the AWS console. This will allow you to avoid the need to handle managing the secure usage of a token with Terraform.

Integrate this module like so:

module "amplify" {
  source = "github.com/pbs/terraform-aws-amplify-module?ref=0.0.18"

  # Tagging Parameters
  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo

  # Optional Parameters
}

The easiest way to use this module is to use the AWS console to create an Amplify application and then import it into Terraform using the import utility.

Adding This Version of the Module

If this repo is added as a subtree, then the version of the module should be close to the version shown here:

0.0.18

Note, however that subtrees can be altered as desired within repositories.

Further documentation on usage can be found here.

Below is automatically generated documentation on this Terraform module using terraform-docs


Requirements

Name Version
terraform >= 1.3.2
aws >= 4.5.0

Providers

Name Version
aws 5.24.0

Modules

No modules.

Resources

Name Type
aws_amplify_app.app resource
aws_amplify_backend_environment.environment resource
aws_amplify_branch.branch resource
aws_amplify_domain_association.domain resource
aws_amplify_webhook.hook resource
aws_default_tags.common_tags data source

Inputs

Name Description Type Default Required
environment Environment (sharedtools, dev, staging, qa, prod) string n/a yes
organization Organization using this module. Used to prefix tags so that they are easily identified as being from your organization string n/a yes
product Tag used to group resources according to product string n/a yes
repo Tag used to point to the repo using this module string n/a yes
access_token Personal access token for a third-party source control system for an Amplify app. The personal access token is used to create a webhook and a read-only deploy key. The token is not stored. string null no
auto_branch_creation_configs Automated branch creation configuration for an Amplify app. An auto_branch_creation_config block is documented below.
list(object({
branch_name = optional(string)
build_spec = optional(string)
enable_auto_build = optional(bool)
enable_basic_auth = optional(bool)
enable_performance_mode = optional(bool)
enable_pull_request_preview = optional(bool)
environment_variables = list(object({
name = string
value = string
}))
framework = optional(string)
pull_request_environment_name = optional(string)
stage = optional(string)
}))
[] no
auto_branch_creation_patterns Automated branch creation glob patterns for an Amplify app. list(string) null no
backend_environments Backend environments for an Amplify app.
list(object({
name = string
deployment_artifacts = optional(string)
stack_name = optional(string)
}))
[] no
basic_auth_configs Basic authorization credentials for an Amplify app. A basic_auth_config block is documented below.
object({
enable = optional(bool, true)
password = optional(string)
username = optional(string)
})
null no
branches Branches for an Amplify app.
list(object({
name = string
backend_environment_arn = optional(string)
description = optional(bool)
display_name = optional(bool)
enable_auto_build = optional(bool)
enable_basic_auth = optional(bool)
basic_auth_credentials = optional(bool)
enable_notification = optional(bool)
enable_performance_mode = optional(bool)
enable_pull_request_preview = optional(bool)
environment_variables = optional(map(string))
framework = optional(string)
pull_request_environment_name = optional(string)
stage = optional(string)
tags = optional(map(string))
ttl = optional(number)
}))
[] no
build_spec Build specification (build spec) for an Amplify app. The build spec is used to build and deploy a branch of an Amplify app. If not specified, the default build spec for the branch is used. The build spec must be formatted as a JSON string. For more information, see Build Spec Example. string null no
custom_rules Custom rewrite / redirect rules for an Amplify app.
list(object({
source = string
target = string
status = optional(string)
condition = optional(string)
}))
[] no
description Description of the Amplify app. string null no
domains Domains for an Amplify app.
list(object({
domain_name = string
enable_auto_sub_domain = optional(bool)
wait_for_verification = optional(bool)
sub_domains = list(object({
branch_name = string
prefix = string
}))
}))
[] no
enable_auto_branch_creation Enable automated branch creation for an Amplify app. bool null no
enable_branch_auto_build Enable automated branch builds for an Amplify app. bool null no
enable_branch_auto_deletion Enable automated branch deletion for an Amplify app. bool null no
environment_variables Environment variables map for an Amplify app. map(string) null no
iam_service_role_arn The AWS Identity and Access Management (IAM) service role for an Amplify app. string null no
name Name of the Amplify app. If null, will default to product. string null no
oauth_token OAuth token for 3rd party source control system for an Amplify app, used to create webhook and read-only deploy key. OAuth token is not stored. string null no
platform Platform for an Amplify app. string null no
repository Repository for an Amplify app. string null no
tags Extra tags map(string) {} no
webhooks Webhooks for an Amplify app.
list(object({
branch_name = string
description = optional(string)
}))
[] no

Outputs

Name Description
arn The ARN of the Amplify App
default_domain The default domain of the Amplify App
id The ID of the Amplify App
name The name of the Amplify App
production_branch The production branch of the Amplify App