Skip to content

Commit 54cfb5c

Browse files
authored
feat: pass the authentication scopes through unaltered (#45)
1 parent 6c8553d commit 54cfb5c

File tree

6 files changed

+33
-26
lines changed

6 files changed

+33
-26
lines changed

.github/mergify.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,10 @@ pull_request_rules:
5656
changes_requested: true
5757
approved: true
5858
message: "This Pull Request has been updated, so we're dismissing all reviews."
59+
60+
- name: "close Pull Requests without files changed"
61+
conditions:
62+
- "#files=0"
63+
actions:
64+
close:
65+
message: "This pull request has been automatically closed by Mergify because there are no longer any changes."

.github/workflows/auto-format.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
auto-format:
88
runs-on: ubuntu-latest
9-
container: cloudposse/build-harness:slim-latest
9+
container: cloudposse/build-harness:latest
1010
steps:
1111
# Checkout the pull request branch
1212
# "An action in a workflow run can’t trigger a new workflow run. For example, if an action pushes code using
@@ -29,6 +29,8 @@ jobs:
2929
- name: Auto Format
3030
if: github.event.pull_request.state == 'open'
3131
shell: bash
32+
env:
33+
GITHUB_TOKEN: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
3234
run: make BUILD_HARNESS_PATH=/build-harness PACKAGES_PREFER_HOST=true -f /build-harness/templates/Makefile.build-harness pr/auto-format/host
3335

3436
# Commit changes (if any) to the PR branch

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ Available targets:
229229

230230
| Name |
231231
|------|
232-
| [aws_lb_listener_rule](https://registry.terraform.io/providers/hashicorp/aws/2.42/docs/resources/lb_listener_rule) |
233-
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/2.42/docs/data-sources/lb_target_group) |
234-
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/2.42/docs/resources/lb_target_group) |
232+
| [aws_lb_listener_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) |
233+
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/lb_target_group) |
234+
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) |
235235

236236
## Inputs
237237

@@ -243,15 +243,15 @@ Available targets:
243243
| authenticated\_listener\_arns | A list of authenticated ALB listener ARNs to attach ALB listener rules to | `list(string)` | `[]` | no |
244244
| authenticated\_paths | Authenticated path pattern to match (a maximum of 1 can be defined) | `list(string)` | `[]` | no |
245245
| authenticated\_priority | The priority for the rules with authentication, between 1 and 50000 (1 being highest priority). Must be different from `unauthenticated_priority` since a listener can't have multiple rules with the same priority | `number` | `0` | no |
246-
| authentication\_cognito\_scope | Cognito scope | `list(string)` | `[]` | no |
246+
| authentication\_cognito\_scope | Cognito scope, which should be a space separated string of requested scopes (see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims) | `string` | `null` | no |
247247
| authentication\_cognito\_user\_pool\_arn | Cognito User Pool ARN | `string` | `""` | no |
248248
| authentication\_cognito\_user\_pool\_client\_id | Cognito User Pool Client ID | `string` | `""` | no |
249249
| authentication\_cognito\_user\_pool\_domain | Cognito User Pool Domain. The User Pool Domain should be set to the domain prefix (`xxx`) instead of full domain (https://xxx.auth.us-west-2.amazoncognito.com) | `string` | `""` | no |
250250
| authentication\_oidc\_authorization\_endpoint | OIDC Authorization Endpoint | `string` | `""` | no |
251251
| authentication\_oidc\_client\_id | OIDC Client ID | `string` | `""` | no |
252252
| authentication\_oidc\_client\_secret | OIDC Client Secret | `string` | `""` | no |
253253
| authentication\_oidc\_issuer | OIDC Issuer | `string` | `""` | no |
254-
| authentication\_oidc\_scope | OIDC scope | `list(string)` | `[]` | no |
254+
| authentication\_oidc\_scope | OIDC scope, which should be a space separated string of requested scopes (see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims, and https://developers.google.com/identity/protocols/oauth2/openid-connect#scope-param for an example set of scopes when using Google as the IdP) | `string` | `null` | no |
255255
| authentication\_oidc\_token\_endpoint | OIDC Token Endpoint | `string` | `""` | no |
256256
| authentication\_oidc\_user\_info\_endpoint | OIDC User Info Endpoint | `string` | `""` | no |
257257
| authentication\_type | Authentication type. Supported values are `COGNITO` and `OIDC` | `string` | `""` | no |

docs/terraform.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
| Name |
2727
|------|
28-
| [aws_lb_listener_rule](https://registry.terraform.io/providers/hashicorp/aws/2.42/docs/resources/lb_listener_rule) |
29-
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/2.42/docs/data-sources/lb_target_group) |
30-
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/2.42/docs/resources/lb_target_group) |
28+
| [aws_lb_listener_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) |
29+
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/lb_target_group) |
30+
| [aws_lb_target_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) |
3131

3232
## Inputs
3333

@@ -39,15 +39,15 @@
3939
| authenticated\_listener\_arns | A list of authenticated ALB listener ARNs to attach ALB listener rules to | `list(string)` | `[]` | no |
4040
| authenticated\_paths | Authenticated path pattern to match (a maximum of 1 can be defined) | `list(string)` | `[]` | no |
4141
| authenticated\_priority | The priority for the rules with authentication, between 1 and 50000 (1 being highest priority). Must be different from `unauthenticated_priority` since a listener can't have multiple rules with the same priority | `number` | `0` | no |
42-
| authentication\_cognito\_scope | Cognito scope | `list(string)` | `[]` | no |
42+
| authentication\_cognito\_scope | Cognito scope, which should be a space separated string of requested scopes (see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims) | `string` | `null` | no |
4343
| authentication\_cognito\_user\_pool\_arn | Cognito User Pool ARN | `string` | `""` | no |
4444
| authentication\_cognito\_user\_pool\_client\_id | Cognito User Pool Client ID | `string` | `""` | no |
4545
| authentication\_cognito\_user\_pool\_domain | Cognito User Pool Domain. The User Pool Domain should be set to the domain prefix (`xxx`) instead of full domain (https://xxx.auth.us-west-2.amazoncognito.com) | `string` | `""` | no |
4646
| authentication\_oidc\_authorization\_endpoint | OIDC Authorization Endpoint | `string` | `""` | no |
4747
| authentication\_oidc\_client\_id | OIDC Client ID | `string` | `""` | no |
4848
| authentication\_oidc\_client\_secret | OIDC Client Secret | `string` | `""` | no |
4949
| authentication\_oidc\_issuer | OIDC Issuer | `string` | `""` | no |
50-
| authentication\_oidc\_scope | OIDC scope | `list(string)` | `[]` | no |
50+
| authentication\_oidc\_scope | OIDC scope, which should be a space separated string of requested scopes (see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims, and https://developers.google.com/identity/protocols/oauth2/openid-connect#scope-param for an example set of scopes when using Google as the IdP) | `string` | `null` | no |
5151
| authentication\_oidc\_token\_endpoint | OIDC Token Endpoint | `string` | `""` | no |
5252
| authentication\_oidc\_user\_info\_endpoint | OIDC User Info Endpoint | `string` | `""` | no |
5353
| authentication\_type | Authentication type. Supported values are `COGNITO` and `OIDC` | `string` | `""` | no |

main.tf

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
locals {
2-
target_group_arn = var.default_target_group_enabled ? join("", aws_lb_target_group.default.*.arn) : var.target_group_arn
3-
authentication_oidc_scope = length(var.authentication_oidc_scope) > 0 ? join("%20", [for scope in var.authentication_oidc_scope : urlencode(scope)]) : null
4-
authentication_cognito_scope = length(var.authentication_cognito_scope) > 0 ? join("%20", [for scope in var.authentication_cognito_scope : urlencode(scope)]) : null
2+
target_group_arn = var.default_target_group_enabled ? join("", aws_lb_target_group.default.*.arn) : var.target_group_arn
53
}
64

75
data "aws_lb_target_group" "default" {
@@ -92,7 +90,7 @@ resource "aws_lb_listener_rule" "authenticated_paths_oidc" {
9290
authorization_endpoint = var.authentication_oidc_authorization_endpoint
9391
token_endpoint = var.authentication_oidc_token_endpoint
9492
user_info_endpoint = var.authentication_oidc_user_info_endpoint
95-
scope = local.authentication_oidc_scope
93+
scope = var.authentication_oidc_scope
9694
}
9795
}
9896

@@ -135,7 +133,7 @@ resource "aws_lb_listener_rule" "authenticated_paths_cognito" {
135133
user_pool_arn = var.authentication_cognito_user_pool_arn
136134
user_pool_client_id = var.authentication_cognito_user_pool_client_id
137135
user_pool_domain = var.authentication_cognito_user_pool_domain
138-
scope = local.authentication_cognito_scope
136+
scope = var.authentication_cognito_scope
139137
}
140138
}
141139

@@ -199,7 +197,7 @@ resource "aws_lb_listener_rule" "authenticated_hosts_oidc" {
199197
authorization_endpoint = var.authentication_oidc_authorization_endpoint
200198
token_endpoint = var.authentication_oidc_token_endpoint
201199
user_info_endpoint = var.authentication_oidc_user_info_endpoint
202-
scope = local.authentication_oidc_scope
200+
scope = var.authentication_oidc_scope
203201
}
204202
}
205203

@@ -228,7 +226,7 @@ resource "aws_lb_listener_rule" "authenticated_hosts_cognito" {
228226
user_pool_arn = var.authentication_cognito_user_pool_arn
229227
user_pool_client_id = var.authentication_cognito_user_pool_client_id
230228
user_pool_domain = var.authentication_cognito_user_pool_domain
231-
scope = local.authentication_cognito_scope
229+
scope = var.authentication_cognito_scope
232230
}
233231
}
234232

@@ -298,7 +296,7 @@ resource "aws_lb_listener_rule" "authenticated_hosts_paths_oidc" {
298296
authorization_endpoint = var.authentication_oidc_authorization_endpoint
299297
token_endpoint = var.authentication_oidc_token_endpoint
300298
user_info_endpoint = var.authentication_oidc_user_info_endpoint
301-
scope = local.authentication_oidc_scope
299+
scope = var.authentication_oidc_scope
302300
}
303301
}
304302

@@ -333,7 +331,7 @@ resource "aws_lb_listener_rule" "authenticated_hosts_paths_cognito" {
333331
user_pool_arn = var.authentication_cognito_user_pool_arn
334332
user_pool_client_id = var.authentication_cognito_user_pool_client_id
335333
user_pool_domain = var.authentication_cognito_user_pool_domain
336-
scope = local.authentication_cognito_scope
334+
scope = var.authentication_cognito_scope
337335
}
338336
}
339337

variables.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ variable "authentication_cognito_user_pool_domain" {
181181
}
182182

183183
variable "authentication_cognito_scope" {
184-
type = list(string)
185-
description = "Cognito scope"
186-
default = []
184+
type = string
185+
description = "Cognito scope, which should be a space separated string of requested scopes (see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims)"
186+
default = null
187187
}
188188

189189
variable "authentication_oidc_client_id" {
@@ -223,9 +223,9 @@ variable "authentication_oidc_user_info_endpoint" {
223223
}
224224

225225
variable "authentication_oidc_scope" {
226-
type = list(string)
227-
description = "OIDC scope"
228-
default = []
226+
type = string
227+
description = "OIDC scope, which should be a space separated string of requested scopes (see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims, and https://developers.google.com/identity/protocols/oauth2/openid-connect#scope-param for an example set of scopes when using Google as the IdP)"
228+
default = null
229229
}
230230

231231
variable "slow_start" {

0 commit comments

Comments
 (0)