Typescript Last Character Javascript Array Foreach Function In Terraform