Skip to content

Commit 09f40ed

Browse files
committed
feat: reducing the need for data lookup which go insane on changes
1 parent 56f88e4 commit 09f40ed

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

modules/role/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ No modules.
133133
| <a name="input_name"></a> [name](#input\_name) | Name of the role to create | `string` | n/a | yes |
134134
| <a name="input_repository"></a> [repository](#input\_repository) | List of repositories to be allowed in the OIDC federation mapping | `string` | n/a | yes |
135135
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply resoures created by this module | `map(string)` | n/a | yes |
136+
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | The AWS account ID to create the role in | `string` | `null` | no |
136137
| <a name="input_additional_audiences"></a> [additional\_audiences](#input\_additional\_audiences) | Additional audiences to be allowed in the OIDC federation mapping | `list(string)` | `[]` | no |
137138
| <a name="input_common_provider"></a> [common\_provider](#input\_common\_provider) | The name of a common OIDC provider to be used as the trust for the role | `string` | `"github"` | no |
138139
| <a name="input_custom_provider"></a> [custom\_provider](#input\_custom\_provider) | An object representing an `aws_iam_openid_connect_provider` resource | <pre>object({<br/> url = string<br/> audiences = list(string)<br/> subject_reader_mapping = string<br/> subject_branch_mapping = string<br/> subject_env_mapping = string<br/> subject_tag_mapping = string<br/> })</pre> | `null` | no |

modules/role/checks.tf

-14
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,3 @@ check "protected_by_config" {
3131
error_message = "'protected_by.tag' must not be an empty string"
3232
}
3333
}
34-
35-
check "permission_boundary" {
36-
# Either permission_boundary or permission_boundary_arn must be specified
37-
assert {
38-
condition = !(var.permission_boundary == null && var.permission_boundary_arn == null)
39-
error_message = "Either 'permission_boundary' or 'permission_boundary_arn' must be specified"
40-
}
41-
42-
# Both permission_boundary and permission_boundary_arn cannot be specified
43-
assert {
44-
condition = !(var.permission_boundary != null && var.permission_boundary_arn != null)
45-
error_message = "Only one of 'permission_boundary' or 'permission_boundary_arn' may be specified"
46-
}
47-
}

modules/role/locals.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ locals {
66
}
77

88
locals {
9-
# The current account ID
10-
account_id = data.aws_caller_identity.current.account_id
9+
# The current account ID, if not provided
10+
account_id = var.account_id != null ? var.account_id : data.aws_caller_identity.current.account_id
1111
## The common OIDC providers to use
1212
common_providers = {
1313
github = {

modules/role/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ variable "name" {
33
description = "Name of the role to create"
44
}
55

6+
variable "account_id" {
7+
type = string
8+
description = "The AWS account ID to create the role in"
9+
default = null
10+
}
11+
612
variable "workspace_name" {
713
description = "The name of the workspace."
814
type = string

0 commit comments

Comments
 (0)