-
-
Save Laxman-SM/950ed3991f964044f90547b00a2d0f7a to your computer and use it in GitHub Desktop.
An example of how you could map teams to many workspaces using the Terraform Enterprise provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start w/ a data source to get a list of all the workspaces | |
# See: https://www.terraform.io/docs/providers/tfe/d/workspace_ids.html | |
data "tfe_workspace_ids" "all-workspaces" { | |
names = ["*"] | |
organization = "my-org-name" | |
} | |
# Look up the ID of the teamn you're looking to map | |
# See: https://www.terraform.io/docs/providers/tfe/d/team.html | |
data "tfe_team" "architects" { | |
name = "my-architects-team" | |
organization = "my-org-name" | |
} | |
# Use the new resource for_each support to map out the team permissions | |
# See: https://www.terraform.io/docs/providers/tfe/r/team_access.html | |
# And: https://www.terraform.io/docs/configuration/resources.html#for_each-multiple-resource-instances-defined-by-a-map-or-set-of-strings | |
resource "tfe_team_access" "architects-team-gets-read-permission-on-all-workspaces" { | |
for_each = data.tfe_workspace_ids.all-workspaces.ids | |
access = "read" | |
team_id = data.tfe_team.architects.id | |
workspace_id = each.value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment