Skip to content

Commit

Permalink
add role name suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
automaticgiant committed Aug 15, 2024
1 parent 6d03dd7 commit 0afc129
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ No modules.
| <a name="input_resolver_caching_ttl"></a> [resolver\_caching\_ttl](#input\_resolver\_caching\_ttl) | Default caching TTL for resolvers when caching is enabled | `number` | `60` | no |
| <a name="input_resolver_count_limit"></a> [resolver\_count\_limit](#input\_resolver\_count\_limit) | The maximum number of resolvers that can be invoked in a single request. | `number` | `null` | no |
| <a name="input_resolvers"></a> [resolvers](#input\_resolvers) | Map of resolvers to create | `any` | `{}` | no |
| <a name="input_role_suffix"></a> [role\_suffix](#input\_role\_suffix) | Suffix to append to generated role names | `string` | `""` | no |
| <a name="input_schema"></a> [schema](#input\_schema) | The schema definition, in GraphQL schema language format. Terraform cannot perform drift detection of this configuration. | `string` | `""` | no |
| <a name="input_secrets_manager_allowed_actions"></a> [secrets\_manager\_allowed\_actions](#input\_secrets\_manager\_allowed\_actions) | List of allowed IAM actions for secrets manager datasources type RELATIONAL\_DATABASE | `list(string)` | <pre>[<br> "secretsmanager:GetSecretValue"<br>]</pre> | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Map of tags to add to all GraphQL resources created by this module | `map(string)` | `{}` | no |
Expand Down
4 changes: 2 additions & 2 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ data "aws_iam_policy_document" "assume_role" {
resource "aws_iam_role" "logs" {
count = var.logging_enabled && var.create_logs_role ? 1 : 0

name = coalesce(var.logs_role_name, "${var.name}-logs")
name = "${coalesce(var.logs_role_name, "${var.name}-logs")}${var.role_suffix}"
assume_role_policy = data.aws_iam_policy_document.assume_role.json
permissions_boundary = var.iam_permissions_boundary

Expand All @@ -126,7 +126,7 @@ resource "aws_iam_role_policy_attachment" "logs" {
resource "aws_iam_role" "service_role" {
for_each = local.service_roles_with_specific_policies

name = lookup(each.value, "service_role_name", "${each.key}-role")
name = "${lookup(each.value, "service_role_name", "${each.key}-role")}${var.role_suffix}"
permissions_boundary = var.iam_permissions_boundary
assume_role_policy = data.aws_iam_policy_document.assume_role.json
}
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,9 @@ variable "resolver_count_limit" {
type = number
default = null
}

variable "role_suffix" {
description = "value to append to the role name"
type = string
default = ""
}

0 comments on commit 0afc129

Please sign in to comment.