Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add path variable to IAM group module #390

Merged
merged 4 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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