Skip to content

Commit 429e0a4

Browse files
authored
fix: remove usage of list and map functions (#32)
1 parent 3fa6ff8 commit 429e0a4

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

modules/iam-compartment/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ data "oci_identity_compartments" "this" {
3232
}
3333

3434
locals {
35-
compartment_ids = concat(flatten(data.oci_identity_compartments.this.*.compartments), list(map("id", "")))
36-
parent_compartment_ids = concat(flatten(data.oci_identity_compartments.this.*.compartments), list(map("compartment_id", "")))
35+
compartment_ids = concat(flatten(data.oci_identity_compartments.this.*.compartments), [{ id = "" }])
36+
parent_compartment_ids = concat(flatten(data.oci_identity_compartments.this.*.compartments), [{ compartment_id = "" }])
3737
}

modules/iam-compartment/outputs.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
output "compartment_id" {
44
description = "Compartment ocid"
55
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
6-
value = var.compartment_create ? element(concat(oci_identity_compartment.this.*.id, list("")), 0) : lookup(local.compartment_ids[0], "id")
6+
value = var.compartment_create ? element(concat(oci_identity_compartment.this.*.id, [""]), 0) : lookup(local.compartment_ids[0], "id")
77
}
88

99
output "parent_compartment_id" {
1010
description = "Parent Compartment ocid"
1111
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
12-
value = var.compartment_create ? element(concat(oci_identity_compartment.this.*.compartment_id, list("")), 0) : lookup(local.parent_compartment_ids[0], "compartment_id")
12+
value = var.compartment_create ? element(concat(oci_identity_compartment.this.*.compartment_id, [""]), 0) : lookup(local.parent_compartment_ids[0], "compartment_id")
1313
}
1414

1515
output "compartment_name" {
1616
description = "Compartment name"
17-
value = var.compartment_name
17+
value = var.compartment_name
1818
}
1919

2020
output "compartment_description" {
2121
description = "Compartment description"
22-
value = var.compartment_description
22+
value = var.compartment_description
2323
}

modules/iam-dynamic-group/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ data "oci_identity_dynamic_groups" "this" {
2222
}
2323

2424
locals {
25-
dynamic_group_ids = concat(flatten(data.oci_identity_dynamic_groups.this.*.dynamic_groups), list(map("id", "")))
25+
dynamic_group_ids = concat(flatten(data.oci_identity_dynamic_groups.this.*.dynamic_groups), [{ id = "" }])
2626
}
2727

2828
########################

modules/iam-dynamic-group/outputs.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
output "dynamic_group_id" {
44
description = "Dynamic Group ocid"
5-
value = var.dynamic_group_create ? element(concat(oci_identity_dynamic_group.this.*.id, list("")), 0) : lookup(local.dynamic_group_ids[0], "id")
5+
value = var.dynamic_group_create ? element(concat(oci_identity_dynamic_group.this.*.id, [""]), 0) : lookup(local.dynamic_group_ids[0], "id")
66
}
77

88
output "dynamic_group_name" {
99
description = "Dynamic Group name"
10-
value = var.dynamic_group_name
10+
value = var.dynamic_group_name
1111
}
1212

1313
output "name_ocid" {
@@ -16,5 +16,5 @@ output "name_ocid" {
1616
}
1717
output "dynamic_group_policy_name" {
1818
description = "Dynamic Group policy name"
19-
value = var.policy_name
19+
value = var.policy_name
2020
}

modules/iam-group/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ data "oci_identity_groups" "this" {
2121
}
2222

2323
locals {
24-
group_ids = concat(flatten(data.oci_identity_groups.this.*.groups), list(map("id", "")))
24+
group_ids = concat(flatten(data.oci_identity_groups.this.*.groups), [{ "id" = "" }])
2525
}
2626

2727
########################
@@ -30,7 +30,7 @@ locals {
3030
resource "oci_identity_user_group_membership" "this" {
3131
count = var.user_ids == null ? 0 : length(var.user_ids)
3232
user_id = var.user_ids[count.index]
33-
group_id = var.group_create ? element(concat(oci_identity_group.this.*.id, list("")), 0) : lookup(local.group_ids[0], "id")
33+
group_id = var.group_create ? element(concat(oci_identity_group.this.*.id, [""]), 0) : lookup(local.group_ids[0], "id")
3434
}
3535

3636
########################

modules/iam-group/outputs.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
output "group_id" {
44
description = "Group ocid"
5-
value = var.group_create ? element(concat(oci_identity_group.this.*.id, list("")), 0) : lookup(local.group_ids[0], "id")
5+
value = var.group_create ? element(concat(oci_identity_group.this.*.id, [""]), 0) : lookup(local.group_ids[0], "id")
66
}
77

88
output "group_name" {
99
description = "Group name"
10-
value = var.group_name
10+
value = var.group_name
1111
}
1212

1313
output "name_ocid" {
@@ -17,10 +17,10 @@ output "name_ocid" {
1717

1818
output "group_description" {
1919
description = "Group description"
20-
value = var.group_description
20+
value = var.group_description
2121
}
2222

2323
output "group_policy_name" {
2424
description = "Group policy name"
25-
value = var.policy_name
25+
value = var.policy_name
2626
}

0 commit comments

Comments
 (0)