Terraform OCI Error in function call the "map" function was deprecated in Terraform?

Solution 1:

The module you are using is not up to date with the latest Terraform version. Moreover, it contains code which is is not forward compatible.

As the error says, the map function in Terraform was deprecated in favor of tomap function. If we take a look at the source code for the module on GitHub, it is using using map function:

locals {
  compartment_ids        = concat(flatten(data.oci_identity_compartments.this.*.compartments), list(map("id", "")))
  parent_compartment_ids = concat(flatten(data.oci_identity_compartments.this.*.compartments), list(map("compartment_id", "")))
}

Also, there is an issue reported for this problem, without any recent activity.

Since, this module is from a third party, what you can do is to fork it on GitHub and fix change map function to tomap. Potentially, you could create pull request with the fix.

Other option would be to get rid of this module, and build the its functionality yourself.