-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
34 lines (30 loc) · 989 Bytes
/
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
terraform {
required_providers {
tfe = {
source = "hashicorp/tfe"
version = "0.58.1"
}
}
backend "azurerm" {
resource_group_name = "rg-starters-tfstate-weu-01"
storage_account_name = "ststarterstfstateweu01"
container_name = "cont-starters-tfstate-weu-01"
key = "terraform.tfstate"
use_azuread_auth = true
}
}
data "tfe_organization" "org" {
name = "AE_nv"
}
resource "tfe_project" "projects" {
for_each = { for project in var.projects : project.name => project }
name = each.value.name
organization = data.tfe_organization.org.name
}
resource "tfe_workspace" "workspaces" {
for_each = { for workspace in local.flattened_workspaces : "${workspace.project_name}.${workspace.name}" => workspace }
name = each.value.name
tag_names = each.value.tag_names
organization = data.tfe_organization.org.name
project_id = tfe_project.projects[each.value.project_name].id
}