How to use count with data resources in Terraform
tl;dr version: "${element(data.github_team.pull.*.id, count.index)}" While writing a little terraform module to manage github repositories, team permissions and branch protection rules, I ran into an issue where github_team_repository resources need the team ID, but github_branch_protection resources need the team slug. This was annoying as I wanted the module to have a single variable which served both purposes. I ended up having a variable var.teams_pull which accepted a list of team slugs....