Skip to content

Commit

Permalink
fix: add count for inline policy and mark policies as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamMacP committed Mar 14, 2024
1 parent b393d5f commit 21b96cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/aws/permission_sets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module "permission_sets" {
name = <VALUE>
description = <VALUE>
identity_store_arn = <VALUE>
inline_policies = ARRAY(<INLINE_POLICY>)
managed_policies = ARRAY(<MANAGED_POLICY_NAME>)
inline_policies = OPTIONAL(ARRAY(<INLINE_POLICY>))
managed_policies = OPTIONAL(ARRAY(<MANAGED_POLICY_NAME>))
}
```

Expand Down
2 changes: 2 additions & 0 deletions modules/aws/permission_sets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ data "aws_iam_policy_document" "iam_policy_document" {
}

resource "aws_ssoadmin_permission_set_inline_policy" "permission_set_inline_policy" {
count = length(var.inline_policies)

inline_policy = data.aws_iam_policy_document.iam_policy_document.json
instance_arn = var.identity_store_arn
permission_set_arn = aws_ssoadmin_permission_set.identity_store_permission_set.arn
Expand Down
6 changes: 3 additions & 3 deletions modules/aws/permission_sets/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ variable "identity_store_arn" {

variable "inline_policies" {
description = "The inline policy to attach to the permission set."
type = list(object({
type = optional(list(object({
sid = optional(string)
actions = list(string)
resources = list(string)
}))
})))
default = []
}

variable "managed_policies" {
description = "The inline policy to attach to the permission set."
type = list(string)
type = optional(list(string))
default = []
}

0 comments on commit 21b96cc

Please sign in to comment.