Skip to content

Commit

Permalink
fix: Basic authentication configuration at the branch level (#15)
Browse files Browse the repository at this point in the history
* Pass basic_auth_credentials to environments

* Fix default value

* Remove extra space from `enable_basic_auth`

* Update docs/terraform.md

* Update README file

Co-authored-by: Fabricio Mera <[email protected]>

---------

Co-authored-by: Fabricio Mera <[email protected]>
  • Loading branch information
sestrella and fm7-1 authored Jul 15, 2024
1 parent eb8c094 commit 6277327
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Available targets:
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| <a name="input_environment_variables"></a> [environment\_variables](#input\_environment\_variables) | The environment variables for the Amplify app | `map(string)` | `{}` | no |
| <a name="input_environments"></a> [environments](#input\_environments) | The configuration of the environments for the Amplify App | <pre>map(object({<br> branch_name = optional(string)<br> backend_enabled = optional(bool, false)<br> environment_name = optional(string)<br> deployment_artifacts = optional(string)<br> stack_name = optional(string)<br> display_name = optional(string)<br> description = optional(string)<br> enable_auto_build = optional(bool)<br> enable_basic_auth = optional(bool)<br> enable_notification = optional(bool)<br> enable_performance_mode = optional(bool)<br> enable_pull_request_preview = optional(bool)<br> environment_variables = optional(map(string))<br> framework = optional(string)<br> pull_request_environment_name = optional(string)<br> stage = optional(string)<br> ttl = optional(number)<br> webhook_enabled = optional(bool, false)<br> }))</pre> | `{}` | no |
| <a name="input_environments"></a> [environments](#input\_environments) | The configuration of the environments for the Amplify App | <pre>map(object({<br> branch_name = optional(string)<br> basic_auth_credentials = optional(string)<br> backend_enabled = optional(bool, false)<br> environment_name = optional(string)<br> deployment_artifacts = optional(string)<br> stack_name = optional(string)<br> display_name = optional(string)<br> description = optional(string)<br> enable_auto_build = optional(bool)<br> enable_basic_auth = optional(bool)<br> enable_notification = optional(bool)<br> enable_performance_mode = optional(bool)<br> enable_pull_request_preview = optional(bool)<br> environment_variables = optional(map(string))<br> framework = optional(string)<br> pull_request_environment_name = optional(string)<br> stage = optional(string)<br> ttl = optional(number)<br> webhook_enabled = optional(bool, false)<br> }))</pre> | `{}` | no |
| <a name="input_iam_service_role_actions"></a> [iam\_service\_role\_actions](#input\_iam\_service\_role\_actions) | List of IAM policy actions for the AWS Identity and Access Management (IAM) service role for the Amplify app.<br>If not provided, the default set of actions will be used for the role if the variable `iam_service_role_enabled` is set to `true`. | `list(string)` | `[]` | no |
| <a name="input_iam_service_role_arn"></a> [iam\_service\_role\_arn](#input\_iam\_service\_role\_arn) | The AWS Identity and Access Management (IAM) service role for the Amplify app.<br>If not provided, a new role will be created if the variable `iam_service_role_enabled` is set to `true`. | `list(string)` | `[]` | no |
| <a name="input_iam_service_role_enabled"></a> [iam\_service\_role\_enabled](#input\_iam\_service\_role\_enabled) | Flag to create the IAM service role for the Amplify app | `bool` | `false` | no |
Expand Down
2 changes: 1 addition & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| <a name="input_environment_variables"></a> [environment\_variables](#input\_environment\_variables) | The environment variables for the Amplify app | `map(string)` | `{}` | no |
| <a name="input_environments"></a> [environments](#input\_environments) | The configuration of the environments for the Amplify App | <pre>map(object({<br> branch_name = optional(string)<br> backend_enabled = optional(bool, false)<br> environment_name = optional(string)<br> deployment_artifacts = optional(string)<br> stack_name = optional(string)<br> display_name = optional(string)<br> description = optional(string)<br> enable_auto_build = optional(bool)<br> enable_basic_auth = optional(bool)<br> enable_notification = optional(bool)<br> enable_performance_mode = optional(bool)<br> enable_pull_request_preview = optional(bool)<br> environment_variables = optional(map(string))<br> framework = optional(string)<br> pull_request_environment_name = optional(string)<br> stage = optional(string)<br> ttl = optional(number)<br> webhook_enabled = optional(bool, false)<br> }))</pre> | `{}` | no |
| <a name="input_environments"></a> [environments](#input\_environments) | The configuration of the environments for the Amplify App | <pre>map(object({<br> branch_name = optional(string)<br> basic_auth_credentials = optional(string)<br> backend_enabled = optional(bool, false)<br> environment_name = optional(string)<br> deployment_artifacts = optional(string)<br> stack_name = optional(string)<br> display_name = optional(string)<br> description = optional(string)<br> enable_auto_build = optional(bool)<br> enable_basic_auth = optional(bool)<br> enable_notification = optional(bool)<br> enable_performance_mode = optional(bool)<br> enable_pull_request_preview = optional(bool)<br> environment_variables = optional(map(string))<br> framework = optional(string)<br> pull_request_environment_name = optional(string)<br> stage = optional(string)<br> ttl = optional(number)<br> webhook_enabled = optional(bool, false)<br> }))</pre> | `{}` | no |
| <a name="input_iam_service_role_actions"></a> [iam\_service\_role\_actions](#input\_iam\_service\_role\_actions) | List of IAM policy actions for the AWS Identity and Access Management (IAM) service role for the Amplify app.<br>If not provided, the default set of actions will be used for the role if the variable `iam_service_role_enabled` is set to `true`. | `list(string)` | `[]` | no |
| <a name="input_iam_service_role_arn"></a> [iam\_service\_role\_arn](#input\_iam\_service\_role\_arn) | The AWS Identity and Access Management (IAM) service role for the Amplify app.<br>If not provided, a new role will be created if the variable `iam_service_role_enabled` is set to `true`. | `list(string)` | `[]` | no |
| <a name="input_iam_service_role_enabled"></a> [iam\_service\_role\_enabled](#input\_iam\_service\_role\_enabled) | Flag to create the IAM service role for the Amplify app | `bool` | `false` | no |
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ resource "aws_amplify_branch" "default" {

backend_environment_arn = lookup(each.value, "backend_enabled", false) ? aws_amplify_backend_environment.default[each.key].arn : null

basic_auth_credentials = lookup(each.value, "basic_auth_credentials", null)
branch_name = lookup(each.value, "branch_name", each.key)
display_name = lookup(each.value, "display_name", each.key)
description = lookup(each.value, "description", null)
enable_auto_build = lookup(each.value, "enable_auto_build", null)
enable_basic_auth = lookup(each.value, "enable_basic_auth ", null)
enable_basic_auth = lookup(each.value, "enable_basic_auth", null)
enable_notification = lookup(each.value, "enable_notification ", null)
enable_performance_mode = lookup(each.value, "enable_performance_mode", null)
enable_pull_request_preview = lookup(each.value, "enable_pull_request_preview", null)
Expand Down
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ variable "custom_rules" {
variable "environments" {
type = map(object({
branch_name = optional(string)
basic_auth_credentials = optional(string)
backend_enabled = optional(bool, false)
environment_name = optional(string)
deployment_artifacts = optional(string)
Expand Down

0 comments on commit 6277327

Please sign in to comment.