-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
52 lines (45 loc) · 1.36 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
terraform {
# backend "s3" {
# bucket = "kestra-product-de"
# key = "terraform.tfstate"
# region = "eu-central-1"
# }
required_providers {
kestra = {
source = "kestra-io/kestra"
version = "~>0.17"
}
}
}
provider "kestra" {
url = var.hostname # "http://localhost:8080"
username = var.username
api_token = var.api_token
tenant_id = var.tenant_id
}
resource "kestra_flow" "flows" {
for_each = fileset(path.module, "flows/*/*.yml")
flow_id = yamldecode(templatefile(each.value, {}))["id"]
namespace = yamldecode(templatefile(each.value, {}))["namespace"]
content = templatefile(each.value, {})
}
resource "kestra_namespace" "kestra" {
namespace_id = "myrootnamespace"
description = "Friendly description"
}
resource "kestra_namespace" "kestra_analytics" {
namespace_id = "myrootnamespace.analytics"
description = "Friendly description"
}
resource "kestra_namespace_file" "prod_scripts" {
for_each = fileset(path.module, "scripts/**")
namespace = kestra_namespace.kestra.namespace_id
filename = "/${each.value}"
content = file(each.value)
}
resource "kestra_namespace_file" "dbt" {
for_each = fileset(path.module, "dbt/**")
namespace = kestra_namespace.kestra_analytics.namespace_id
filename = "/${each.value}"
content = file(each.value)
}