Skip to content

Commit 8b5df1f

Browse files
author
Eduardo Lopez
authored
[feature] Optionally disable poweruser role iam actions (#194)
1 parent d411f6f commit 8b5df1f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

aws-iam-role-poweruser/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ No requirements.
3131

3232
| Name | Description | Type | Default | Required |
3333
|------|-------------|------|---------|:--------:|
34+
| authorize\_iam | Indicates if we should augment the PowerUserAccess policy with certain IAM actions. | `bool` | `true` | no |
3435
| iam\_path | n/a | `string` | `"/"` | no |
3536
| oidc | A list of AWS OIDC IDPs to establish a trust relationship for this role. | <pre>list(object(<br> {<br> idp_arn : string, # the AWS IAM IDP arn<br> client_ids : list(string), # a list of oidc client ids<br> provider : string # your provider url, such as foo.okta.com<br> }<br> ))</pre> | `[]` | no |
3637
| role\_name | n/a | `string` | `"poweruser"` | no |

aws-iam-role-poweruser/main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@ data "aws_iam_policy_document" "misc" {
154154
}
155155

156156
resource "aws_iam_policy" "misc" {
157+
count = var.authorize_iam ? 1 : 0
158+
157159
name = "${var.role_name}-misc"
158160
path = var.iam_path
159161
description = "Extra permissions we're granting that PowerUserAccess lacks"
160162
policy = data.aws_iam_policy_document.misc.json
161163
}
162164

163165
resource "aws_iam_role_policy_attachment" "misc" {
166+
count = var.authorize_iam ? 1 : 0
167+
164168
role = aws_iam_role.poweruser.name
165169
policy_arn = aws_iam_policy.misc.arn
166170
}

aws-iam-role-poweruser/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ variable oidc {
3838
default = []
3939
description = "A list of AWS OIDC IDPs to establish a trust relationship for this role."
4040
}
41+
42+
variable authorize_iam {
43+
type = bool
44+
default = true
45+
description = "Indicates if we should augment the PowerUserAccess policy with certain IAM actions."
46+
}

0 commit comments

Comments
 (0)