Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/masterpointio/terraform-aws-amplify-app
A Terraform module for building simple Amplify apps.
https://github.com/masterpointio/terraform-aws-amplify-app
amplify aws aws-amplify opentofu opentofu-module terraform terraform-aws terraform-module
Last synced: 3 days ago
JSON representation
A Terraform module for building simple Amplify apps.
- Host: GitHub
- URL: https://github.com/masterpointio/terraform-aws-amplify-app
- Owner: masterpointio
- License: mit
- Created: 2020-05-19T03:19:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T05:26:01.000Z (over 2 years ago)
- Last Synced: 2025-01-11T02:54:34.428Z (12 days ago)
- Topics: amplify, aws, aws-amplify, opentofu, opentofu-module, terraform, terraform-aws, terraform-module
- Language: HCL
- Homepage: https://masterpoint.io
- Size: 36.1 KB
- Stars: 22
- Watchers: 8
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Masterpoint Logo](https://i.imgur.com/RDLnuQO.png)](https://masterpoint.io)
# NOTE! This module is no longer maintained.
This module is old and the good folks at [Cloud Posse](https://cloudposse.com/) have built a better module, so we're sunsetting this module in favor of using that one. Check it out here: https://github.com/cloudposse/terraform-aws-amplify-app
Reach out if you have any issues - Thanks!
# terraform-aws-amplify-app (Archived)
A Terraform module for building simple Amplify apps. This creates the `master` and `develop` branches, sets up the domain association, and creates webhooks for both branches.
## Usage
```hcl
module "amplify" {
source = "git::https://github.com/masterpointio/terraform-aws-amplify-app.git?ref=tags/0.1.0"namespace = var.namespace
stage = var.stage
name = "mattgowie"
organization = "Gowiem"
repo = "mattgowie.com"
gh_access_token = var.gh_access_token
domain_name = "mattgowie.com"
description = "The Personal site of Matt Gowie."
enable_basic_auth_on_master = false
enable_basic_auth_on_develop = true
basic_auth_username = var.basic_auth_username
basic_auth_password = var.basic_auth_password
develop_pull_request_preview = truecustom_rules = [{
source = "https://www.mattgowie.com"
target = "https://mattgowie.com"
status = "301"
condition = null
}, {
source = "/<*>"
target = "/index.html"
status = "404"
condition = null
}]
}
```## Credits
1. [@k24d](https://github.com/k24d)'s creation of the Amplify Resources for the AWS Provider!
1. [cloudposse/terraform-null-label](https://github.com/cloudposse/terraform-null-label)## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.14.0 |
| [aws](#requirement\_aws) | ~> 3.32 |
| [local](#requirement\_local) | ~> 2.1 |## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | ~> 3.32 |## Modules
| Name | Source | Version |
|------|--------|---------|
| [develop\_branch\_label](#module\_develop\_branch\_label) | cloudposse/label/null | 0.24.1 |
| [master\_branch\_label](#module\_master\_branch\_label) | cloudposse/label/null | 0.24.1 |
| [this](#module\_this) | cloudposse/label/null | 0.24.1 |## Resources
| Name | Type |
|------|------|
| [aws_amplify_app.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_app) | resource |
| [aws_amplify_backend_environment.develop](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_backend_environment) | resource |
| [aws_amplify_backend_environment.master](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_backend_environment) | resource |
| [aws_amplify_branch.develop](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_branch) | resource |
| [aws_amplify_branch.master](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_branch) | resource |
| [aws_amplify_domain_association.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_domain_association) | resource |
| [aws_amplify_webhook.develop](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_webhook) | resource |
| [aws_amplify_webhook.master](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_webhook) | resource |
| [aws_iam_role.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [additional\_tag\_map](#input\_additional\_tag\_map) | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
| [amplify\_service\_role\_enabled](#input\_amplify\_service\_role\_enabled) | Whether to enable the IAM Service Role for Amplify or not. See https://docs.aws.amazon.com/amplify/latest/userguide/how-to-service-role-amplify-console.html for full details. | `bool` | `false` | no |
| [attributes](#input\_attributes) | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
| [basic\_auth\_password](#input\_basic\_auth\_password) | The password to use for the basic auth configuration. | `string` | n/a | yes |
| [basic\_auth\_username](#input\_basic\_auth\_username) | The username to use for the basic auth configuration. | `string` | n/a | yes |
| [build\_spec\_content](#input\_build\_spec\_content) | Your build spec file contents. If not provided then it will use the `amplify.yml` at the root of your project / branch. | `string` | `""` | no |
| [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. |object({|
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
}){| no |
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
| [custom\_rules](#input\_custom\_rules) | The custom rules to apply to the Amplify App. |list(object({| `[]` | no |
source = string # Required
target = string # Required
status = any # Use null if not passing
condition = any # Use null if not passing
}))
| [delimiter](#input\_delimiter) | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
| [description](#input\_description) | The description to associate with the Amplify App. | `string` | n/a | yes |
| [develop\_backend\_environment\_enabled](#input\_develop\_backend\_environment\_enabled) | Whether to create the backend environment for develop or not. | `bool` | `false` | no |
| [develop\_branch\_name](#input\_develop\_branch\_name) | The name of the 'develop'-like branch that you'd like to use. | `string` | `"develop"` | no |
| [develop\_environment\_variables](#input\_develop\_environment\_variables) | Environment variables for the develop branch. | `map(string)` | `{}` | no |
| [develop\_pull\_request\_preview](#input\_develop\_pull\_request\_preview) | Whether to enable preview on PR's into develop. | `bool` | `true` | no |
| [domain\_name](#input\_domain\_name) | The Custom Domain Name to associate with this Amplify App. | `string` | `""` | no |
| [enable\_basic\_auth\_globally](#input\_enable\_basic\_auth\_globally) | To enable basic auth for all branches or not. | `bool` | `false` | no |
| [enable\_basic\_auth\_on\_develop](#input\_enable\_basic\_auth\_on\_develop) | To enable basic auth on the develop branch subdomain or not. | `bool` | `true` | no |
| [enable\_basic\_auth\_on\_master](#input\_enable\_basic\_auth\_on\_master) | To enable basic auth the root subdomain or not. | `bool` | `false` | no |
| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| [environment](#input\_environment) | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| [gh\_access\_token](#input\_gh\_access\_token) | Personal Access token for 3rd party source control system for an Amplify App, used to create webhook and read-only deploy key. Token is not stored. | `string` | n/a | yes |
| [global\_environment\_variables](#input\_global\_environment\_variables) | Environment variables that are set across all branches. | `map(string)` | `{}` | no |
| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters.
Set to `0` for unlimited length.
Set to `null` for default, which is `0`.
Does not affect `id_full`. | `number` | `null` | no |
| [label\_order](#input\_label\_order) | The naming order of the id output and Name tag.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
| [master\_backend\_environment\_enabled](#input\_master\_backend\_environment\_enabled) | Whether to create the backend environment for master or not. | `bool` | `false` | no |
| [master\_branch\_name](#input\_master\_branch\_name) | The name of the 'master'-like branch that you'd like to use. | `string` | `"master"` | no |
| [master\_environment\_variables](#input\_master\_environment\_variables) | Environment variables for the master branch. | `map(string)` | `{}` | no |
| [name](#input\_name) | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
| [namespace](#input\_namespace) | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
| [organization](#input\_organization) | The GitHub organization or user where the repo lives. | `string` | n/a | yes |
| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| [repo](#input\_repo) | The name of the repo that the Amplify App will be created around. | `string` | n/a | yes |
| [stage](#input\_stage) | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| [tags](#input\_tags) | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |## Outputs
| Name | Description |
|------|-------------|
| [arn](#output\_arn) | The ARN of the main Amplify resource. |
| [custom\_domains](#output\_custom\_domains) | List of custom domains that are associated with this resource (if any). |
| [default\_domain](#output\_default\_domain) | The amplify domain (non-custom). |
| [develop\_webhook\_arn](#output\_develop\_webhook\_arn) | The ARN of the develop webhook. |
| [develop\_webhook\_url](#output\_develop\_webhook\_url) | The URL of the develop webhook. |
| [domain\_association\_arn](#output\_domain\_association\_arn) | The ARN of the domain association resource. |
| [master\_webhook\_arn](#output\_master\_webhook\_arn) | The ARN of the master webhook. |
| [master\_webhook\_url](#output\_master\_webhook\_url) | The URL of the master webhook. |