Skip to content

Commit

Permalink
feat: Add path variable to IAM group module (#390)
Browse files Browse the repository at this point in the history
Co-authored-by: Charles Lariviere <charles.lariviere@avidbots.com>
Co-authored-by: Bryant Biggs <bryantbiggs@gmail.com>
  • Loading branch information
3 people authored Jun 29, 2023
1 parent e3d9cc6 commit e5c42c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/iam-group-with-policies/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module "iam_group_with_custom_policies" {
source = "../../modules/iam-group-with-policies"

name = "custom"
path = "/custom/"

group_users = [
module.iam_user1.iam_user_name,
Expand Down
1 change: 1 addition & 0 deletions modules/iam-group-with-policies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ No modules.
| <a name="input_group_users"></a> [group\_users](#input\_group\_users) | List of IAM users to have in an IAM group which can assume the role | `list(string)` | `[]` | no |
| <a name="input_iam_self_management_policy_name_prefix"></a> [iam\_self\_management\_policy\_name\_prefix](#input\_iam\_self\_management\_policy\_name\_prefix) | Name prefix for IAM policy to create with IAM self-management permissions | `string` | `"IAMSelfManagement-"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of IAM group | `string` | `""` | no |
| <a name="input_path"></a> [path](#input\_path) | Desired path for the IAM group | `string` | `"/"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions modules/iam-group-with-policies/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resource "aws_iam_group" "this" {
count = var.create_group ? 1 : 0

name = var.name
path = var.path
}

resource "aws_iam_group_membership" "this" {
Expand Down
6 changes: 6 additions & 0 deletions modules/iam-group-with-policies/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ variable "name" {
default = ""
}

variable "path" {
description = "Desired path for the IAM group"
type = string
default = "/"
}

variable "group_users" {
description = "List of IAM users to have in an IAM group which can assume the role"
type = list(string)
Expand Down
1 change: 1 addition & 0 deletions wrappers/iam-group-with-policies/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module "wrapper" {

create_group = try(each.value.create_group, var.defaults.create_group, true)
name = try(each.value.name, var.defaults.name, "")
path = try(each.value.path, var.defaults.path, "/")
group_users = try(each.value.group_users, var.defaults.group_users, [])
custom_group_policy_arns = try(each.value.custom_group_policy_arns, var.defaults.custom_group_policy_arns, [])
custom_group_policies = try(each.value.custom_group_policies, var.defaults.custom_group_policies, [])
Expand Down

0 comments on commit e5c42c3

Please sign in to comment.