Skip to content

Commit

Permalink
Creates and output team tokens (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
rorbol authored May 15, 2024
1 parent 2b4f492 commit f95aaa9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
6 changes: 6 additions & 0 deletions access.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ resource "tfe_team_organization_members" "this" {
team_id = tfe_team.this[each.key].id
organization_membership_ids = [for member in each.value.members : tfe_organization_membership.this[member].id]
}

resource "tfe_team_token" "this" {
for_each = var.teams

team_id = tfe_team.this[each.key].id
}
5 changes: 5 additions & 0 deletions output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ output "workspaces" {
}]
description = "A set of workspaces in Terraform Cloud"
}

output "team_token" {
value = { for team in keys(var.teams) : team => tfe_team_token.this[team].token }
sensitive = true
}
4 changes: 2 additions & 2 deletions version.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
terraform {
required_version = "~>1.7"
required_version = "~>1.8"

required_providers {
tfe = {
version = "~>0.52"
version = "~>0.55"
}
}
}
12 changes: 6 additions & 6 deletions workspace.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ resource "tfe_team_access" "this" {
team_id = tfe_team.this[each.value.team].id
workspace_id = tfe_workspace.this[each.value.workspace].id

dynamic "permissions" {
dynamic "permissions" {
for_each = each.value.access == "contributer" ? [1] : []

content {
runs = "apply"
variables = "read"
state_versions = "read"
sentinel_mocks = "none"
runs = "apply"
variables = "read"
state_versions = "read"
sentinel_mocks = "none"
workspace_locking = false
run_tasks = false
run_tasks = false
}
}
}

0 comments on commit f95aaa9

Please sign in to comment.