forked from magicaks/magicaks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
70 lines (59 loc) · 1.59 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
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.46.0"
}
}
}
provider "kubernetes" {
config_path = "~/.kube/config"
config_context = "aks-${var.cluster_name}-admin"
}
provider "github" {
token = var.github_pat
organization = var.github_user
}
# Configure the Microsoft Azure Provider
provider "azurerm" {
features {}
}
terraform {
backend "azurerm" {
key = "magicaks-postprovision"
}
}
resource "kubernetes_namespace" "admin" {
metadata {
labels = {created-by = "terraform"}
name = "admin"
}
}
module flux {
source = "./fluxfiles"
github_user = var.github_user
admin_repo = var.k8s_manifest_repo
workload_repo = var.k8s_workload_repo
}
module github {
source = "./github"
admin_repo = var.k8s_manifest_repo
workload_repo = var.k8s_workload_repo
admin_namespace = module.flux.admin_namespace
workload_namespace = module.flux.workload_namespace
depends_on = [ module.flux ]
}
module "servicebus" {
source = "./servicebus"
cluster_name = var.cluster_name
location = var.location
}
resource "azurerm_key_vault_secret" "sbconnectionstring" {
name = "servicebus-connectionstring"
value = module.servicebus.primary_connection_string
key_vault_id = var.key_vault_id
provisioner "local-exec" {
command = "${path.cwd}/../utils/expose-secret.sh ${self.name} ${var.key_vault_id} ${var.app_name}"
}
depends_on = [module.flux]
}