Function strings.strip_index not working

Hi,

When using modules that also use each loop to create multiple resources, the Strings function strip_index is not working. It leaves fragments.
Example the address below
"module.gh_runner_service_account.google_project_iam_member.project-roles[\"gh-runner-db-dev-mbzf-psd2=>roles/container.clusterAdmin\"]"
will result in
module.gh_runner_service_account.google_project_iam_member.project-roles.clusterAdmin"]
Any ideas to work around this as I need to cross-reference tfplan and tfconfig.

@valencetech how have you defined your for_each expression in the module? I would like to understand where the roles/container.clusterAdmin value is coming from because it is the . that’s causing your issue. If you could somehow change this, you should be able to work around it.

I changed the address by removing the . and the split_index function worked as expected:
https://play.sentinelproject.io/p/rMukYdMMVKV

Thanks @hcrhall ,
My workaround for now is strings.split(resource_changes.address, "[")[0] which discards everything after the open square bracket.
Another team is responsible for the Terraform scripts so I haven’t seen them, the output also looked strange to me but it seems to be a common pattern with Terraform modules-based mocks.