Skip to content

Commit 6a9c971

Browse files
authored
Fix Projects Support (#4)
1 parent 36c64af commit 6a9c971

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ on:
44
push:
55
branches:
66
- main
7+
8+
permissions:
9+
actions: read
10+
checks: read
11+
contents: read
12+
pull-requests: write
13+
security-events: write
14+
715
jobs:
816
ci:
917
uses: SPHTech-Platform/reusable-workflows/.github/workflows/terraform.yaml@main

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
| <a name="input_create_tfc_workload_identity_role"></a> [create\_tfc\_workload\_identity\_role](#input\_create\_tfc\_workload\_identity\_role) | Create IAM Role for TFC Workload Identity | `bool` | `true` | no |
3737
| <a name="input_tags"></a> [tags](#input\_tags) | List of tags for resources | `map(string)` | `{}` | no |
3838
| <a name="input_tfc_oidc_provider_audiences"></a> [tfc\_oidc\_provider\_audiences](#input\_tfc\_oidc\_provider\_audiences) | List of TFC OIDC Provider audiences. This is part of the security configuration between TFC and your AWS account | `list(string)` | `[]` | no |
39+
| <a name="input_tfc_project_support_match"></a> [tfc\_project\_support\_match](#input\_tfc\_project\_support\_match) | The key to use for Terraform Cloud Project matching in the subject key. This is to work around the module not support projects. You should set this to 'Default Project' or '*' | `string` | `"*"` | no |
3940
| <a name="input_tfc_workload_identity_role"></a> [tfc\_workload\_identity\_role](#input\_tfc\_workload\_identity\_role) | Name of the IAM Role for TFC | `string` | `"TfcWorkloadIdentity"` | no |
4041
| <a name="input_tfc_workload_identity_role_audiences"></a> [tfc\_workload\_identity\_role\_audiences](#input\_tfc\_workload\_identity\_role\_audiences) | List of allowed audiences for the IAM Role. Defaults to the one for the OIDC provider if unspecified. | `list(string)` | `[]` | no |
4142
| <a name="input_tfc_workload_identity_role_description"></a> [tfc\_workload\_identity\_role\_description](#input\_tfc\_workload\_identity\_role\_description) | Description of the IAM Role for TFC | `string` | `"Terraform Cloud Workload Identity"` | no |

data.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
locals {
2-
tfc_workload_identity_workspaces = flatten([
2+
tfc_workload_identity_workspaces = distinct(flatten([
33
for org, workspaces in var.tfc_workload_identity_workspaces : [
4-
for workspace in workspaces : "organization:${org}:workspace:${workspace}:run_phase:*"
4+
for workspace in workspaces : [
5+
"organization:${org}:workspace:${workspace}:run_phase:*",
6+
"organization:${org}:project:${var.tfc_project_support_match}:workspace:${workspace}:run_phase:*",
7+
]
58
]
6-
])
9+
]))
710

811
oidc_provider_url = "https://app.terraform.io"
912
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ variable "tfc_workload_identity_role_audiences" {
6363
type = list(string)
6464
default = []
6565
}
66+
67+
variable "tfc_project_support_match" {
68+
description = "The key to use for Terraform Cloud Project matching in the subject key. This is to work around the module not support projects. You should set this to 'Default Project' or '*'"
69+
type = string
70+
default = "*"
71+
}

0 commit comments

Comments
 (0)