oracle-terraform-modules/terraform-oci-iam

Error in modules/iam_group9/modules/iam-group/main.tf line 33

Sangwan70 opened this issue · 6 comments

all to function "map" failed: the "map" function was deprecated in Terraform v0.12 and is no longer available; use tomap({ ... })
No more working in Terraform V1.1.9

kral2 commented

Big maintenance needed for this suit of modules, agree. We need to build a remediation plan.

suyah commented

Is there any plan to fix this module?

I have fixed the issue. Its working on Terraform V1.5. I have been using it every week for my client. But yes, My Fix need to be merged with master.

hyder commented

Please send a PR

The actual change (i.e for iam-compartment)

map to tomap

main.tf line 27-28

locals {
  compartment_ids        = concat(flatten(data.oci_identity_compartments.this.*.compartments), tolist( [tomap({"id" = ""})]))
  parent_compartment_ids = concat(flatten(data.oci_identity_compartments.this.*.compartments), tolist([tomap({"compartment_id" = ""})]))
}

list to tolist

outputs.tf line 12

output "compartment_id" {
  description = "Compartment ocid"
  // This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source.
  value = var.compartment_create ? element(concat(oci_identity_compartment.this.*.id, tolist([""])), 0) : lookup(local.compartment_ids[0], "id")
}

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