Function strings.strip_index not working


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
will result in
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:

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.