This repository was archived by the owner on Aug 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
78 lines (68 loc) · 2.18 KB
/
Copy pathmain.tf
File metadata and controls
78 lines (68 loc) · 2.18 KB
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
terraform {
required_version = "~> 0.14.11"
required_providers {
tfe = {
source = "hashicorp/tfe"
version = "0.25.0"
}
}
experiments = [module_variable_optional_attrs]
}
# don't set this, for using for_each with module
# provider "tfe" {
# # Configuration options
# }
resource "tfe_workspace" "workspace" {
name = var.workspace_name
organization = var.workspace_org
auto_apply = var.workspace_auto_apply
file_triggers_enabled = var.workspace_file_triggers_enabled
queue_all_runs = var.workspace_queue_all_runs
terraform_version = var.workspace_terraform_version
working_directory = var.workspace_working_directory
trigger_prefixes = var.workspace_trigger_prefixes
allow_destroy_plan = var.workspace_allow_destroy_plan
vcs_repo {
branch = var.workspace_vcs_branch
identifier = var.workspace_vcs_identifier
ingress_submodules = var.workspace_vcs_ingress_submodules
oauth_token_id = var.workspace_vcs_oauth_token_id
}
}
resource "tfe_team_access" "acces" {
for_each = {
for team in var.team_access : team.name => {
id = team.id
access = team.access
}
}
access = each.value.access
team_id = each.value.id
workspace_id = tfe_workspace.workspace.id
}
resource "tfe_notification_configuration" "slack" {
destination_type = "slack"
name = "tfe workspace notification: ${var.workspace_name}"
enabled = var.slack_enabled
url = var.slack_url
triggers = var.slack_triggers
workspace_id = tfe_workspace.workspace.id
}
resource "tfe_variable" "variable" {
for_each = {
for variable in var.tf_variables : variable.name => {
category = variable.category
value = variable.value
hcl = variable.hcl
sensitive = variable.sensitive
description = variable.description
}
}
category = each.value.category
key = each.key
value = each.value.value
hcl = each.value.hcl
sensitive = each.value.sensitive
description = each.value.description
workspace_id = tfe_workspace.workspace.id
}