How to use the results of the Lambda invocation somewhere else?

I have a lambda which is being invoked quite fine during terraform apply and I get good output from it:

output "out_params_map" {
  description = "something"
  value = module.get_params.result_map

it shows proper result

terraform apply...

out_params_map = [
    "key1" = "val1"
    "key2" = "val2"

When I try to use the output somewhere else like this

resource "aws_security_group_rule" "this" {
  some_param = module.get_params.result_map.key1

both terraform plan and terraform apply fails:

Error: Unsupported attribute

  on line 32, in resource "aws_security_group_rule" "this":
  32:   some_param = module.get_params.result_map.key1
    | module.get_params.result_map is empty tuple

This value does not have any attributes.

I also tried:

... = module.get_params.result_map[0].key1
... = jsondecode(module.get_params.result)["key1"]
... = module.get_params.result_map["key1"]

but it does not work either.

More code can be found here:

What am I doing wrong?