Skip to content

Commit

Permalink
added null check
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideNale committed Feb 26, 2025
1 parent 02ce205 commit 8d49b67
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions modules/sso/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ variable "managed_permission_sets" {
condition = alltrue([
for ps in var.managed_permission_sets :
ps.permissions_boundary == null ||
(ps.permissions_boundary.managed_policy_arn != null) !=
(ps.permissions_boundary.customer_managed_policy_reference != null)
(
(try(ps.permissions_boundary.managed_policy_arn, null) != null) !=
(try(ps.permissions_boundary.customer_managed_policy_reference, null) != null)
)
])
error_message = "When permissions_boundary is set, exactly one of managed_policy_arn or customer_managed_policy_reference must be provided."
}
Expand All @@ -40,13 +42,14 @@ variable "inline_permission_sets" {
}))
}))
description = "List of the required Permission Sets that are comprised of inline IAM Policies"

validation {
condition = alltrue([
for ps in var.inline_permission_sets :
ps.permissions_boundary == null ||
(ps.permissions_boundary.managed_policy_arn != null) !=
(ps.permissions_boundary.customer_managed_policy_reference != null)
(
(try(ps.permissions_boundary.managed_policy_arn, null) != null) !=
(try(ps.permissions_boundary.customer_managed_policy_reference, null) != null)
)
])
error_message = "When permissions_boundary is set, exactly one of managed_policy_arn or customer_managed_policy_reference must be provided."
}
Expand Down

0 comments on commit 8d49b67

Please sign in to comment.