Skip to content

Commit 6a840e9

Browse files
authored
[Breaking] Add support for TFC Projects (#5)
1 parent 315ddca commit 6a840e9

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@
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 |
4039
| <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 |
4140
| <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 |
4241
| <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 |
4342
| <a name="input_tfc_workload_identity_role_max_session_duration"></a> [tfc\_workload\_identity\_role\_max\_session\_duration](#input\_tfc\_workload\_identity\_role\_max\_session\_duration) | Maximum CLI/API session duration in seconds between 3600 and 43200 | `number` | `3600` | no |
4443
| <a name="input_tfc_workload_identity_role_permissions_boundary_arn"></a> [tfc\_workload\_identity\_role\_permissions\_boundary\_arn](#input\_tfc\_workload\_identity\_role\_permissions\_boundary\_arn) | Permissions boundary ARN to use for IAM role for TFC | `string` | `""` | no |
4544
| <a name="input_tfc_workload_identity_role_policy_arns"></a> [tfc\_workload\_identity\_role\_policy\_arns](#input\_tfc\_workload\_identity\_role\_policy\_arns) | List of ARN to attach the IAM Role for TFC | `list(string)` | `[]` | no |
46-
| <a name="input_tfc_workload_identity_workspaces"></a> [tfc\_workload\_identity\_workspaces](#input\_tfc\_workload\_identity\_workspaces) | Workspaces to allow access to the workload identity for this account | `map(list(string))` | `{}` | no |
45+
| <a name="input_tfc_workload_identity_workspaces"></a> [tfc\_workload\_identity\_workspaces](#input\_tfc\_workload\_identity\_workspaces) | Workspaces to allow access to the workload identity for this account | <pre>map( # Key is Organization<br> map( # Key is Project<br> list(string) # List of workspaces<br> )<br> )</pre> | `{}` | no |
4746

4847
## Outputs
4948

data.tf

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

docs/.gitkeep

Whitespace-only changes.

modules/.gitkeep

Whitespace-only changes.

variables.tf

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,16 @@ variable "tfc_workload_identity_role_permissions_boundary_arn" {
5454

5555
variable "tfc_workload_identity_workspaces" {
5656
description = "Workspaces to allow access to the workload identity for this account"
57-
type = map(list(string)) # Key is the organization, values are the list of workspaces
58-
default = {}
57+
type = map( # Key is Organization
58+
map( # Key is Project
59+
list(string) # List of workspaces
60+
)
61+
)
62+
default = {}
5963
}
6064

6165
variable "tfc_workload_identity_role_audiences" {
6266
description = "List of allowed audiences for the IAM Role. Defaults to the one for the OIDC provider if unspecified."
6367
type = list(string)
6468
default = []
6569
}
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)