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

Add "console_access" user attribute #52

Merged
merged 1 commit into from
Dec 30, 2024
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ policies to them. We recommend creating your Users account via the

```hcl
users = {
"firstname1.lastname1" = { "require_mfa" = false, "self_managed" = true },
"firstname2.lastname2" = { "require_mfa" = true, "self_managed" = true },
"firstname3.lastname3" = { "require_mfa" = false, "self_managed" = true },
"service-account1" = { "require_mfa" = false, "self_managed" = false },
"firstname1.lastname1" = { "console_access" = true, "require_mfa" = false, "self_managed" = true },
"firstname2.lastname2" = { "console_access" = true, "require_mfa" = true, "self_managed" = true },
"firstname3.lastname3" = { "console_access" = false, "require_mfa" = false, "self_managed" = true },
"service-account1" = { "console_access" = false, "require_mfa" = false, "self_managed" = false },
}
```

Expand Down Expand Up @@ -70,7 +70,7 @@ No modules.
|------|-------------|------|---------|:--------:|
| aws\_region | The AWS region where the non-global resources are to be provisioned (e.g. "us-east-1"). | `string` | `"us-east-1"` | no |
| tags | Tags to apply to all AWS resources created. | `map(string)` | `{}` | no |
| users | A map whose keys are the usernames of each non-admin user and whose values are a map containing supported user attributes. The currently-supported attributes are "require\_mfa" (boolean) and "self\_managed" (boolean). Example: { "firstname1.lastname1" = { "require\_mfa" = false, "self\_managed" = true }, "firstname2.lastname2" = { "require\_mfa" = true, "self\_managed" = true }, "firstname3.lastname3" = { "require\_mfa" = false, "self\_managed" = true }, "service-account1" = { "require\_mfa" = false, "self\_managed" = false } } | `map(object({ require_mfa = bool, self_managed = bool }))` | n/a | yes |
| users | A map whose keys are the usernames of each non-admin user and whose values are a map containing supported user attributes. The currently-supported attributes are "console\_access" (boolean), "require\_mfa" (boolean), and "self\_managed" (boolean). Example: { "firstname1.lastname1" = { "console\_access" = true, "require\_mfa" = false, "self\_managed" = true }, "firstname2.lastname2" = { "console\_access" = true, "require\_mfa" = true, "self\_managed" = true }, "firstname3.lastname3" = { "console\_access" = false, "require\_mfa" = false, "self\_managed" = true }, "service-account1" = { "console\_access" = false, "require\_mfa" = false, "self\_managed" = false } } | `map(object({ console_access = bool, require_mfa = bool, self_managed = bool }))` | n/a | yes |

## Outputs ##

Expand Down
3 changes: 2 additions & 1 deletion users.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ resource "aws_iam_user" "users" {
resource "aws_iam_user_login_profile" "users" {
provider = aws.users

for_each = toset(keys(var.users))
# for_each = toset(keys(var.users))
for_each = { for k, v in var.users : k => v if v["console_access"] }

password_reset_required = true
user = aws_iam_user.users[each.key].name
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# ------------------------------------------------------------------------------

variable "users" {
description = "A map whose keys are the usernames of each non-admin user and whose values are a map containing supported user attributes. The currently-supported attributes are \"require_mfa\" (boolean) and \"self_managed\" (boolean). Example: { \"firstname1.lastname1\" = { \"require_mfa\" = false, \"self_managed\" = true }, \"firstname2.lastname2\" = { \"require_mfa\" = true, \"self_managed\" = true }, \"firstname3.lastname3\" = { \"require_mfa\" = false, \"self_managed\" = true }, \"service-account1\" = { \"require_mfa\" = false, \"self_managed\" = false } }"
description = "A map whose keys are the usernames of each non-admin user and whose values are a map containing supported user attributes. The currently-supported attributes are \"console_access\" (boolean), \"require_mfa\" (boolean), and \"self_managed\" (boolean). Example: { \"firstname1.lastname1\" = { \"console_access\" = true, \"require_mfa\" = false, \"self_managed\" = true }, \"firstname2.lastname2\" = { \"console_access\" = true, \"require_mfa\" = true, \"self_managed\" = true }, \"firstname3.lastname3\" = { \"console_access\" = false, \"require_mfa\" = false, \"self_managed\" = true }, \"service-account1\" = { \"console_access\" = false, \"require_mfa\" = false, \"self_managed\" = false } }"
nullable = false
type = map(object({ require_mfa = bool, self_managed = bool }))
type = map(object({ console_access = bool, require_mfa = bool, self_managed = bool }))
}

# ------------------------------------------------------------------------------
Expand Down
Loading