-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
92 lines (77 loc) · 2.11 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
variable "github_oauth_token_id" {
type = string
}
variable "tfe_token" {
type = string
}
variable "team_email_addresses" {
type = list(string)
}
# 'owners' is a special team that can't be altered.
# It will always exist.
data "tfe_team" "voxpupuli-owners" {
name = "owners"
organization = "VoxPupuli"
}
terraform {
required_version = "~> 0.13.0"
backend "remote" {
organization = "VoxPupuli"
workspaces {
name = "terraform_cloud"
}
}
}
provider "tfe" {
version = "~> 0.21.0"
hostname = "app.terraform.io"
token = var.tfe_token
}
resource "tfe_organization" "voxpupuli" {
name = "VoxPupuli"
email = "pmc@voxpupuli.org"
collaborator_auth_policy = "two_factor_mandatory"
}
resource "tfe_organization_membership" "voxpupuli_members" {
for_each = toset(var.team_email_addresses)
organization = "VoxPupuli"
email = each.key
}
resource "tfe_team_organization_member" "voxpupuli_owner_member" {
for_each = toset(var.team_email_addresses)
team_id = data.tfe_team.voxpupuli-owners.id
organization_membership_id = tfe_organization_membership.voxpupuli_members[each.key].id
}
resource "tfe_workspace" "voxpupuli" {
name = "github-voxpupuli"
organization = "VoxPupuli"
operations = true
terraform_version = "0.13.0"
vcs_repo {
identifier = "secpupuli/tf-voxpupuli"
branch = "main"
oauth_token_id = var.github_oauth_token_id
}
}
resource "tfe_workspace" "secpupuli" {
name = "github-secpupuli"
organization = "VoxPupuli"
operations = true
terraform_version = "0.13.0"
vcs_repo {
identifier = "secpupuli/tf-secpupuli"
branch = "main"
oauth_token_id = var.github_oauth_token_id
}
}
resource "tfe_workspace" "terraform_cloud" {
name = "terraform_cloud"
organization = "VoxPupuli"
operations = true
terraform_version = "0.13.0"
vcs_repo {
identifier = "secpupuli/tf-terraform-cloud"
branch = "main"
oauth_token_id = var.github_oauth_token_id
}
}