-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
134 lines (113 loc) · 3.27 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
resource "tfe_team_access" "main-dev" {
access = "admin"
team_id = var.tfe_team_developers_id
workspace_id = tfe_workspace.main.id
}
resource "tfe_team_access" "main-ops" {
access = "admin"
team_id = var.tfe_team_ops_id
workspace_id = tfe_workspace.main.id
}
resource "tfe_workspace" "main" {
name = "${var.use_case_name}-${var.environment}"
organization = var.org
auto_apply = true
queue_all_runs = false
terraform_version = "1.0.8"
vcs_repo {
branch = "main"
identifier = "milesjh/${github_repository.main.name}"
oauth_token_id = var.oauth_token
}
}
resource "github_repository" "main" {
name = "${var.use_case_name}-${var.environment}"
description = "Terraform Consumer Repo for ${var.use_case_name}-${var.environment}"
visibility = "public"
template {
owner = "miles-test-repo-tf-builds"
repository = "repo-template-terraform-azure"
}
}
# resource "github_branch" "main" {
# repository = github_repository.main.name
# branch = "main"
# }
# resource "github_branch_default" "default" {
# repository = github_repository.main.name
# branch = github_branch.main.branch
# }
resource "tfe_variable" "aws_access_key" {
key = "AWS_ACCESS_KEY_ID"
value = var.aws_access_key
category = "env"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "aws_secret_key" {
key = "AWS_SECRET_ACCESS_KEY"
value = var.aws_secret_key
category = "env"
sensitive = "true"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "arm_tenant_id" {
key = "ARM_TENANT_ID"
value = var.arm_tenant_id
category = "env"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "arm_subscription_id" {
key = "ARM_SUBSCRIPTION_ID"
value = var.arm_subscription_id
category = "env"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "arm_client_id" {
key = "ARM_CLIENT_ID"
value = var.arm_client_id
category = "env"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "arm_client_secret" {
key = "ARM_CLIENT_SECRET"
value = var.arm_client_secret
category = "env"
sensitive = "true"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "workspace" {
key = "workspace_name"
value = var.creator_workspace
category = "terraform"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "confirm_destroy" {
key = "CONFIRM_DESTROY"
value = "1"
category = "env"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "set_ttl" {
key = "WORKSPACE_TTL"
value = "30"
category = "env"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "org" {
key = "org"
value = var.org
category = "terraform"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "environment_name" {
key = "environment"
value = var.environment
category = "terraform"
workspace_id = tfe_workspace.main.id
}
resource "tfe_variable" "name" {
key = "name"
value = var.use_case_name
category = "terraform"
workspace_id = tfe_workspace.main.id
}