Skip to content

Commit

Permalink
Fix linting & formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberdvs committed Jun 14, 2024
1 parent 0996e44 commit 545ffe4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
52 changes: 26 additions & 26 deletions sso.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ resource "aws_ssoadmin_permission_set" "permission_set" {

resource "aws_ssoadmin_managed_policy_attachment" "attachment" {
for_each = local.enable_sso ? merge([
for permission_set_name, permission_set in local.sso_permission_sets : {
for managed_policy_name in permission_set["managed_policies"] : "${permission_set_name}_${managed_policy_name}" => {
permission_set_name = permission_set_name
managed_policy_name = managed_policy_name
}
for permission_set_name, permission_set in local.sso_permission_sets : {
for managed_policy_name in permission_set["managed_policies"] : "${permission_set_name}_${managed_policy_name}" => {
permission_set_name = permission_set_name
managed_policy_name = managed_policy_name
}
]...) : {}
}
]...) : {}

instance_arn = tolist(data.aws_ssoadmin_instances.ssoadmin_instances.arns)[0]
managed_policy_arn = "arn:aws:iam::aws:policy/${each.value["managed_policy_name"]}"
Expand All @@ -73,18 +73,18 @@ resource "aws_ssoadmin_permission_set_inline_policy" "policy" {

resource "aws_ssoadmin_account_assignment" "group_assignment" {
for_each = local.enable_sso ? merge(flatten([
for unit_name, unit in local.organization_config["units"] : [
for account_name in keys(local.organization_config["units"][unit_name]["accounts"]) : [
for group_name, group_assignments in lookup(local.organization_config["units"][unit_name]["accounts"][account_name], "group_assignments", {}) : {
for permission_set in group_assignments["permission_sets"] : "${account_name}_${group_name}_${permission_set}" => {
account_name = account_name
group_name = group_name
permission_set = permission_set
}
for unit_name, unit in local.organization_config["units"] : [
for account_name in keys(local.organization_config["units"][unit_name]["accounts"]) : [
for group_name, group_assignments in lookup(local.organization_config["units"][unit_name]["accounts"][account_name], "group_assignments", {}) : {
for permission_set in group_assignments["permission_sets"] : "${account_name}_${group_name}_${permission_set}" => {
account_name = account_name
group_name = group_name
permission_set = permission_set
}
]
}
]
])...) : {}
]
])...) : {}

instance_arn = aws_ssoadmin_permission_set.permission_set[each.value["permission_set"]].instance_arn
permission_set_arn = aws_ssoadmin_permission_set.permission_set[each.value["permission_set"]].arn
Expand All @@ -98,18 +98,18 @@ resource "aws_ssoadmin_account_assignment" "group_assignment" {

resource "aws_ssoadmin_account_assignment" "user_assignment" {
for_each = local.enable_sso ? merge(flatten([
for unit_name, unit in local.organization_config["units"] : [
for account_name in keys(local.organization_config["units"][unit_name]["accounts"]) : [
for user_name, user_assignments in lookup(local.organization_config["units"][unit_name]["accounts"][account_name], "user_assignments", {}) : {
for permission_set in user_assignments["permission_sets"] : "${account_name}_${user_name}_${permission_set}" => {
account_name = account_name
user_name = user_name
permission_set = permission_set
}
for unit_name, unit in local.organization_config["units"] : [
for account_name in keys(local.organization_config["units"][unit_name]["accounts"]) : [
for user_name, user_assignments in lookup(local.organization_config["units"][unit_name]["accounts"][account_name], "user_assignments", {}) : {
for permission_set in user_assignments["permission_sets"] : "${account_name}_${user_name}_${permission_set}" => {
account_name = account_name
user_name = user_name
permission_set = permission_set
}
]
}
]
])...) : {}
]
])...) : {}

instance_arn = aws_ssoadmin_permission_set.permission_set[each.value["permission_set"]].instance_arn
permission_set_arn = aws_ssoadmin_permission_set.permission_set[each.value["permission_set"]].arn
Expand Down
5 changes: 4 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
terraform {
required_version = ">= 1.1.5"
required_providers {
aws = ">= 5.0"
aws = {
source = "hashicorp/aws"
version = ">= 5.0"
}
}
}

0 comments on commit 545ffe4

Please sign in to comment.