Terraform module to provision AWS Amplify apps, backend environments, branches, domain associations, and webhooks.
We eat, drink, sleep and most importantly love DevOps. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy Bigger problems are always solved by breaking them into smaller manageable problems. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller connected yet manageable pieces within the infrastructure.
This module is basically combination of Terraform open source and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.
We have fifty plus terraform modules. A few of them are comepleted and are available for open source usage while a few others are in progress.
This module has a few dependencies:
- Terraform 1.x.x
- Go
- github.com/stretchr/testify/assert
- github.com/gruntwork-io/terratest/modules/terraform
IMPORTANT: Since the master
branch used in source
varies based on new modifications, we suggest that you use the release versions here.
Here is an example of how you can use this module in your inventory structure:
module "amplify" {
source = "../"
name = "amplify"
environment = "test"
label_order = ["name", "environment"]
amplify_enabled = true
environment_name = "prod"
domain_name = ["newloop.eu", "newloop.dk"]
amplify_repository = "https://github.com/clouddrove-sandbox/terraform-aws-amplify"
access_token = "ghxxxxxm06Sd3KqkafBVu0xzcxcxcv0EA8AK"
amplify_branch_name = "main"
sub_domain_prefix_name = "scan"
deployment_artifacts = "app-example-deployment"
stack_name = "amplify-app-example"
branch_framework = "React"
branch_stage = "PRODUCTION"
branch_environment_variables = {
ENV = "test"
}
amplify_app_environment_variables = {
REACT_APP_API_SERVER = ""
}
custom_rules = [
{
source = "/01/<p01>/21/<p21>"
status = "302"
target = "/?p01=<p01>&p21=<p21> "
}
]
}
Name | Description | Type | Default | Required |
---|---|---|---|---|
access_token | Personal access token for a third-party source | string |
"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" |
no |
amplify_app_environment_variables | The environment variables for the Amplify app | map(string) |
{} |
no |
amplify_enabled | Flag to control the amplify creation. | bool |
true |
no |
amplify_repository | The repository for the Amplify app | string |
"https://github.com/clouddrove-sandbox/terraform-aws-amplify-app" |
no |
auto_branch_creation_config | The automated branch creation configuration for the Amplify app | object({ |
null |
no |
auto_branch_creation_patterns | The automated branch creation glob patterns for the Amplify app | list(string) |
[] |
no |
backend_enable | Enables backend environment creation for the Amplify app | bool |
false |
no |
branches | n/a | object({ |
n/a | yes |
build_spec | The build specification (build spec) for the Amplify app. If not provided then it will use the amplify.yml at the root of your project / branch. |
string |
null |
no |
custom_rules | The custom rules to apply to the Amplify App | list(object({ |
[] |
no |
deployment_artifacts | Name of deployment artifacts. | string |
"app-example-deployment" |
no |
description | The description for the Amplify app | string |
null |
no |
domain_name | Domain name for the domain association. | list(any) |
[] |
no |
enable_auto_branch_creation | Enables automated branch creation for the Amplify app | bool |
false |
no |
enable_basic_auth | Enables basic authorization for the Amplify app. This will apply to all branches that are part of this app. |
bool |
false |
no |
enable_branch_auto_build | Enables auto-building of branches for the Amplify App | bool |
true |
no |
enable_branch_auto_deletion | Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository | bool |
false |
no |
environment | Environment (e.g. prod , dev , staging ). |
string |
"" |
no |
environment_name | Amplify environment name for the pull request. | string |
"prod" |
no |
label_order | Label order, e.g. name ,application . |
list(any) |
[] |
no |
managedby | ManagedBy, eg 'CloudDrove' | string |
"hello@clouddrove.com" |
no |
name | Name (e.g. app or cluster ). |
string |
"" |
no |
oauth_token | The OAuth token for a third-party source control system for the Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored. |
string |
null |
no |
platform | The platform or framework for the Amplify app | string |
"WEB" |
no |
stack_name | AWS CloudFormation stack name of a backend environment. | string |
"amplify-app-example" |
no |
sub_domain_prefix_name | Prefix setting for the subdomain. | string |
"scam" |
no |
ttl | Content Time To Live (TTL) for the website in seconds. | number |
null |
no |
Name | Description |
---|---|
arn | Amplify App ARN |
default_domain | Amplify App domain (non-custom) |
name | Amplify App name |
In this module testing is performed with terratest and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a GO environment in your system.
You need to run the following command in the testing folder:
go test -run Test
If you come accross a bug or have any feedback, please log it in our issue tracker, or feel free to drop us an email at hello@clouddrove.com.
If you have found it worth your time, go ahead and give us a ★ on our GitHub!
At CloudDrove, we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.
We are The Cloud Experts!
We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.