You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Rewrite/redirect for `yourdomain.com/app2` to `yourotherdomain.com`
67
+
# app2 = {
68
+
# source = "/app2"
69
+
# status = "302"
70
+
# target = "https://yourotherdomain.com"
71
+
# },
72
+
}
73
+
}
74
+
```
75
+
76
+
# Examples
77
+
78
+
-[CodeCommit Repo with Auto Branch Creation](https://github.com/novekm/terraform-aws-amplify-app/examples/codecommit-deployment/auto-branch-creation/main.tf)
79
+
-[CodeCommit Repo with Manual Branch Creation](https://github.com/novekm/terraform-aws-amplify-app/examples/codecommit-deployment/manual-branch-creation/main.tf)
80
+
-[GitHub Repo with Auto Branch Creation](https://github.com/novekm/terraform-aws-amplify-app/examples/github-deployment/auto-branch-creation/main.tf)
81
+
-[GitHub Repo with Manual Branch Creation](https://github.com/novekm/terraform-aws-amplify-app/examples/github-deployment/auto-branch-creation/main.tf)
82
+
-[GitLab Repo with Auto Branch Creation](https://github.com/novekm/terraform-aws-amplify-app/examples/gitlab-deployment/auto-branch-creation/main.tf)
83
+
-[GitLab Repo with Manual Branch Creation](https://github.com/novekm/terraform-aws-amplify-app/examples/gitlab-deployment/auto-branch-creation/main.tf)
84
+
85
+
# Contributing
86
+
87
+
Report issues/questions/feature requests on the [issues] page. Reach out to me if you'd like to be a contributor!
88
+
89
+
90
+
# Workshop
91
+
For more information, check out my workshop [**Automating Deployment of AWS Amplify Apps with Terraform**](https://catalog.workshops.aws/amplify-with-terraform/)
92
+
93
+
1
94
## Requirements
2
95
3
96
| Name | Version |
@@ -46,7 +139,7 @@ No modules.
46
139
| <aname="input_codecommit_repo_name"></a> [codecommit\_repo\_name](#input\_codecommit\_repo\_name)| n/a |`string`|`"codecommit_repo"`| no |
47
140
| <aname="input_create_codecommit_repo"></a> [create\_codecommit\_repo](#input\_create\_codecommit\_repo)| - CodeCommit - |`bool`|`false`| no |
48
141
| <aname="input_create_domain_associations"></a> [create\_domain\_associations](#input\_create\_domain\_associations)| Enables default association of your domain with the 'main' branch of the Amplify App. |`bool`|`false`| no |
49
-
| <aname="input_custom_rewrite_and_redirect"></a> [custom\_rewrite\_and\_redirect](#input\_custom\_rewrite\_and\_redirect)| Custom rewrites and redirects for the domain associations. |`map(any)`|<pre>{<br> "single_page_app": {<br> "source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>",<br> "status": "200",<br> "target": "/index.html"<br> }<br>}</pre>| no |
142
+
| <aname="input_custom_rewrite_and_redirect"></a> [custom\_rewrite\_and\_redirect](#input\_custom\_rewrite\_and\_redirect)| Custom rewrites and redirects for the domain associations. |`map(any)`|`{}`| no |
50
143
| <aname="input_domain_associations"></a> [domain\_associations](#input\_domain\_associations)| The domains/subdomains you wish to associate with the Amplify App. These are mapped to git branches. |`map(any)`|`{}`| no |
51
144
| <aname="input_domain_name"></a> [domain\_name](#input\_domain\_name)| The name of your domain. Ex. naruto.ninja |`string`|`"example.com"`| no |
52
145
| <aname="input_enable_app_pr_preview"></a> [enable\_app\_pr\_preview](#input\_enable\_app\_pr\_preview)| Enables pull request previews for the autocreated branch. |`bool`|`false`| no |
| <aname="output_amplify_app_arn"></a> [amplify\_app\_arn](#output\_amplify\_app\_arn)|The ARN for the Amplify App|
169
+
| <aname="output_amplify_app_default_domain"></a> [amplify\_app\_default\_domain](#output\_amplify\_app\_default\_domain)|The default domain for the Amplify App|
170
+
| <aname="output_amplify_app_id"></a> [amplify\_app\_id](#output\_amplify\_app\_id)|The App ID for the Amplify App|
171
+
| <aname="output_amplify_app_production_branch"></a> [amplify\_app\_production\_branch](#output\_amplify\_app\_production\_branch)|The production branch for the Amplify App|
172
+
| <aname="output_amplify_app_tags_all"></a> [amplify\_app\_tags\_all](#output\_amplify\_app\_tags\_all)|All tags for the Amplify App|
80
173
| <aname="output_aws_current_region"></a> [aws\_current\_region](#output\_aws\_current\_region)| AWS Current Region |
Copy file name to clipboardExpand all lines: examples/codecommit-deployment/auto-branch-creation/main.tf
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -4,31 +4,31 @@ module "sample-qs" {
4
4
// location of the module - can be local or git repo
5
5
source="./modules/novekm-static-website-amplify"
6
6
7
-
app_name="my-app"// Name of the Amplify App - default is 'sample-amplify-app'
8
-
create_codecommit_repo=true// Creates CodeCommit repo and necessary permissions for Amplify App to read from it. Default value is `false`
9
-
lookup_existing_codecommit_repo=false// Default value - set to `true` if you wish to use an existing CodeCommit repo
7
+
app_name="my-app"// Name of the Amplify App - default is 'sample-amplify-app'
8
+
create_codecommit_repo=true// Creates CodeCommit repo and necessary permissions for Amplify App to read from it. Default value is `false`
9
+
lookup_existing_codecommit_repo=false// Default value - set to `true` if you wish to use an existing CodeCommit repo
10
10
# existing_repo_url = "" // If using the module to create a CodeCommit Repo, the repo's url is already referenced. If using your own repo, change this value to that repo url.
11
11
12
12
path_to_build_spec="../amplify.yml"// If you want build_spec to be in a specific file. Only use if you are not using `build_spec
13
13
14
14
# buildspec = "" // If you want to have your build_spec defined in main.tf - Only use if you are not using `path_to_build_spec`
15
15
16
-
// For this to work with domain associations, the branch(es) must already exist in your
17
-
// connected git repo. See the README for more information.
16
+
// For this to work with domain associations, the branch(es) must already exist in your
17
+
// connected git repo. See the README for more information.
18
18
// Auto Branch Creation
19
-
enable_auto_branch_creation=true// Default value is `false` - enables Amplify branches to be automatically created based on the `auto_branch_creation_patterns`. For these to build, `enable_auto_build` must be set to true, and they must exist in your connected git repo.
20
-
enable_auto_branch_deletion=true// Default value is `false` Allows for branches in Amplify to automatically be deleted if you delete a branch with the same name from your connected git repo.
19
+
enable_auto_branch_creation=true// Default value is `false` - enables Amplify branches to be automatically created based on the `auto_branch_creation_patterns`. For these to build, `enable_auto_build` must be set to true, and they must exist in your connected git repo.
20
+
enable_auto_branch_deletion=true// Default value is `false` Allows for branches in Amplify to automatically be deleted if you delete a branch with the same name from your connected git repo.
21
21
auto_branch_creation_patterns=["main"] // Default value - this is the pattern that Amplify will use to decide which branches to auto build. Add additional strings inside the list to add additional branches. Ex. ["main", "dev", "staging"]
22
-
enable_auto_build=true// Default value is `false` - auto builds the connected branch if code already exists in it, or is pushed to it.
23
-
enable_app_pr_preview=true// Default value is false - adds preview to pull request
24
-
enable_performance_mode=false// Default value - caches data longer in CDN
25
-
app_framework="Something bloated and hard to maintain"
22
+
enable_auto_build=true// Default value is `false` - auto builds the connected branch if code already exists in it, or is pushed to it.
23
+
enable_app_pr_preview=true// Default value is false - adds preview to pull request
24
+
enable_performance_mode=false// Default value - caches data longer in CDN
25
+
app_framework="Something bloated and hard to maintain"
26
26
27
27
28
28
29
29
30
30
// - Custom Domain -
31
-
create_domain_associations=false// Default value - set this to `true` after you create branches in your connected git repo and push to them
31
+
create_domain_associations=false// Default value - set this to `true` after you create branches in your connected git repo and push to them
32
32
domain_name="yourdomain.com"// The domain you wish to associate with the Amplify App. Do not include the `www.` This value is unused unless `create_domain_associations` is set to true. If set to true, you must also define the associations in `domain_associations`. It is recommended to use a domain managed by Route53 because if it's in the same account/region as your Amplify App, Amplify will automatically do the domain validation for you
33
33
34
34
// Associates your domain/desired subdomains to git branches. Only takes effect if `create_domain_associations` is set to `true`
@@ -52,25 +52,25 @@ module "sample-qs" {
52
52
# }
53
53
}
54
54
55
-
#custom_rewrite_and_redirect = {
56
-
# // Static website rewrite/redirect
57
-
# # static_site = {
58
-
# # source = "/<*>"
59
-
# # status = "404"
60
-
# # target = "/index.html"
61
-
# # }
62
-
# // Rewrite/redirect for single page apps - default if you don't specify anything else
Copy file name to clipboardExpand all lines: examples/codecommit-deployment/manual-branch-creation/main.tf
+33-33Lines changed: 33 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,25 @@ module "sample-qs" {
4
4
// location of the module - can be local or git repo
5
5
source="./modules/novekm-static-website-amplify"
6
6
7
-
app_name="my-app"// Name of the Amplify App - default is 'sample-amplify-app'
8
-
create_codecommit_repo=true// Creates CodeCommit repo and necessary permissions for Amplify App to read from it. Default value is `false`
9
-
lookup_existing_codecommit_repo=false// Default value - set to `true` if you wish to use an existing CodeCommit repo
7
+
app_name="my-app"// Name of the Amplify App - default is 'sample-amplify-app'
8
+
create_codecommit_repo=true// Creates CodeCommit repo and necessary permissions for Amplify App to read from it. Default value is `false`
9
+
lookup_existing_codecommit_repo=false// Default value - set to `true` if you wish to use an existing CodeCommit repo
10
10
# existing_repo_url = "" // If using the module to create a CodeCommit Repo, the repo's url is already referenced. If using your own repo, change this value to that repo url.
11
11
12
12
path_to_build_spec="../amplify.yml"// If you want build_spec to be in a specific file. Only use if you are not using `build_spec
13
13
14
14
# buildspec = "" // If you want to have your build_spec defined in main.tf - Only use if you are not using `path_to_build_spec`
15
15
16
-
// For this to work with domain associations, the branches must already exist in your
17
-
// connected git repo. See the README for more information.
16
+
// For this to work with domain associations, the branches must already exist in your
17
+
// connected git repo. See the README for more information.
18
18
// Auto Branch Creation
19
-
enable_auto_branch_creation=false// default value is false - enables Amplify branches to be automatically created based on the `auto_branch_creation_patterns`. For these to build, `enable_auto_build` must be set to true, and they must exist in your connected git repo.
20
-
enable_auto_branch_deletion=false// allows for branches in Amplify to automatically be deleted if you delete a branch with the same name from your connected git repo.
19
+
enable_auto_branch_creation=false// default value is false - enables Amplify branches to be automatically created based on the `auto_branch_creation_patterns`. For these to build, `enable_auto_build` must be set to true, and they must exist in your connected git repo.
20
+
enable_auto_branch_deletion=false// allows for branches in Amplify to automatically be deleted if you delete a branch with the same name from your connected git repo.
21
21
auto_branch_creation_patterns=["main", "dev"] // default values - this is the pattern that Amplify will use to decide which branches to auto build. Add additional strings inside the list to add additional branches. Ex. ["main", "dev", "staging"]
22
-
enable_auto_build=false// auto builds the connected branch when code exists in it, or is pushed to it.
23
-
enable_app_pr_preview=false// default value - adds preview to pull request
24
-
enable_performance_mode=false// default value - caches data longer in CDN
25
-
app_framework="Something bloated and hard to maintain"
22
+
enable_auto_build=false// auto builds the connected branch when code exists in it, or is pushed to it.
23
+
enable_app_pr_preview=false// default value - adds preview to pull request
24
+
enable_performance_mode=false// default value - caches data longer in CDN
25
+
app_framework="Something bloated and hard to maintain"
26
26
27
27
28
28
// Use this variable if you wish to create your own branches manually.
@@ -50,7 +50,7 @@ module "sample-qs" {
50
50
}
51
51
52
52
// - Custom Domain -
53
-
create_domain_associations=false// Default value - set this to `true` after you create branches in your connected git repo and push to them
53
+
create_domain_associations=false// Default value - set this to `true` after you create branches in your connected git repo and push to them
54
54
domain_name="yourdomain.com"// The domain you wish to associate with the Amplify App. Do not include the `www.` This value is unused unless `create_domain_associations` is set to true. If set to true, you must also define the associations in `domain_associations`. It is recommended to use a domain managed by Route53 because if it's in the same account/region as your Amplify App, Amplify will automatically do the domain validation for you
55
55
56
56
// Associates your domain/desired subdomains to git branches. Only takes effect if `create_domain_associations` is set to `true`
@@ -70,28 +70,28 @@ module "sample-qs" {
70
70
# },
71
71
dev = {
72
72
branch_name ="dev"
73
-
prefix ="dev"// Adds association for `dev.yourdomain.com`
73
+
prefix ="dev"// Adds association for `dev.yourdomain.com`
74
74
}
75
75
}
76
76
77
-
#custom_rewrite_and_redirect = {
78
-
# // Static website rewrite/redirect
79
-
# # static_site = {
80
-
# # source = "/<*>"
81
-
# # status = "404"
82
-
# # target = "/index.html"
83
-
# # }
84
-
# // Rewrite/redirect for single page apps - default if you don't specify anything else
0 commit comments