-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
50 lines (44 loc) · 1.25 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
# basic terraform setup (required)
terraform {
backend "remote" {}
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.3.2"
}
}
}
##########################
# Provider Configuration
##########################
provider "kubernetes" {
# configure kubernetes provider with local kube-config
config_path = "~/.kube/config"
}
provider "helm" {
# configure helm provider with local kube-config
kubernetes {
config_path = "~/.kube/config"
}
}
##########################
# Desired Resources
##########################
# let there be a namespace named `my-playground`
resource "kubernetes_namespace" "playground_namespace" {
metadata {
name = "my-playground"
}
}
# create a helm-release from the official argo-cd helm chart repository
resource "helm_release" "argo_cd_release" {
name = "argo-cd"
namespace = kubernetes_namespace.playground_namespace.metadata.0.name # <--reference to the created namespace above
repository = "https://argoproj.github.io/argo-helm"
chart = "argo-cd"
values = [
templatefile("resources/argocd.values.yaml.tftpl", {
namespace = kubernetes_namespace.playground_namespace.metadata.0.name
})
]
}