Skip to content

Commit 8b983e8

Browse files
committed
Expose the wildcard validation variable
The underlying module allows wildcard patters to match for validations and this simple patch allows this to be passed on. Updated documentation. Minor formatting adjustments from `terraform fmt`.
1 parent ee0bf67 commit 8b983e8

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ override.tf.json
2727

2828
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
2929
# example: *tfplan*
30+
/.terraform.lock.hcl

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Doc: https://docs.github.com/en/actions/deployment/security-hardening-your-deplo
1313
This controls can help you do things like:
1414
* Only allow a certain branch
1515
* Only allow a certain repo/org
16+
* Allow certain branch patterns (*note*: the default values may clash)
1617

1718
## ARN to use in the Github Actions
1819
This module outputs an `arn` value. This is the `arn` you should use in the Github Actions.
@@ -53,6 +54,7 @@ No requirements.
5354
| <a name="input_thumbprint_list"></a> [thumbprint\_list](#input\_thumbprint\_list) | This is the thumbprint returned if you were to create an "identity provider" in AWS and gave it this url: https://token.actions.githubusercontent.com | `list` | <pre>[<br> "a031c46782e6e6c662c2c87c76da9aa62ccabd8e"<br>]</pre> | no |
5455
| <a name="input_url"></a> [url](#input\_url) | n/a | `string` | `"https://token.actions.githubusercontent.com"` | no |
5556
| <a name="input_validate_conditions"></a> [validate\_conditions](#input\_validate\_conditions) | Conditions to validate | `set(string)` | <pre>[<br> "repo:octo-org/octo-repo:ref:refs/heads/octo-branch"<br>]</pre> | no |
57+
| <a name="input_validate_wildcard_conditions"></a> [validate\_wildcard\_conditions](#input\_validate\_wildcard\_conditions) | Conditions to validate that include wildcards | `set(string)` | <pre>[<br> "repo:octo-org/octo-repo:ref:refs/heads/feature/*"<br>]</pre> | no |
5658

5759
## Outputs
5860

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module "iam_assumable_role_admin" {
1818
provider_url = var.url
1919
role_policy_arns = [aws_iam_policy.iam_policy.arn]
2020
oidc_fully_qualified_subjects = var.validate_conditions
21+
oidc_subjects_with_wildcards = var.validate_wildcard_conditions
2122
tags = var.tags
2223
}
2324

variables.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ variable "url" {
88
}
99

1010
variable "client_id_list" {
11-
type = list(string)
11+
type = list(string)
1212
default = [
1313
"sts.amazonaws.com"
1414
]
@@ -17,7 +17,7 @@ variable "client_id_list" {
1717
# This is the thumbprint returned if you were to create an "identity provider" in AWS and gave
1818
# it this url: https://token.actions.githubusercontent.com
1919
variable "thumbprint_list" {
20-
type = list(string)
20+
type = list(string)
2121
default = [
2222
"6938fd4d98bab03faadb97b34396831e3780aea1"
2323
]
@@ -45,6 +45,12 @@ variable "validate_conditions" {
4545
default = ["repo:octo-org/octo-repo:ref:refs/heads/octo-branch"]
4646
}
4747

48+
variable "validate_wildcard_conditions" {
49+
description = "Conditions to validate, that include wildcards"
50+
type = set(string)
51+
default = ["repo:octo-org/octo-repo:ref:refs/heads/feature/*"]
52+
}
53+
4854
variable "tags" {
4955
type = map(any)
5056
default = {}

0 commit comments

Comments
 (0)