-
Notifications
You must be signed in to change notification settings - Fork 1
/
simplepodwithAGIC.tf.test
107 lines (102 loc) · 2.78 KB
/
simplepodwithAGIC.tf.test
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# /!\ kubernetes_manifest is a new (and interesting) type of resource provided by Kubernetes terraform provider
# https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/guides/alpha-manifest-migration-guide
# https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest
# this file is renamed to .test because it generate a error message " cannot create REST client: no client config"
# during the first terraform plan. The reason is that in our case the kubernetes cluster is not yet available
# So there is no way to contact the api server and check kubernetes resource defined in manifest.
# If the cluster is already available, this kind of resource works well
# the yaml manifest is also provided in this repo
resource "kubernetes_manifest" "pod_test_agic_app_pod" {
depends_on = [
azurerm_kubernetes_cluster.Terra_aks
]
manifest = {
"apiVersion" = "v1"
"kind" = "Pod"
"metadata" = {
"labels" = {
"app" = "test-agic-app"
}
"name" = "test-agic-app-pod"
"namespace" = "default"
}
"spec" = {
"containers" = [
{
"image" = "mcr.microsoft.com/dotnet/core/samples:aspnetapp"
"name" = "aspnetapp-image"
"ports" = [
{
"containerPort" = 80
"protocol" = "TCP"
},
]
},
]
}
}
}
resource "kubernetes_manifest" "service_test_agic_app_service" {
depends_on = [
azurerm_kubernetes_cluster.Terra_aks
]
manifest = {
"apiVersion" = "v1"
"kind" = "Service"
"metadata" = {
"name" = "test-agic-app-service"
"namespace" = "default"
}
"spec" = {
"ports" = [
{
"port" = 80
"protocol" = "TCP"
"targetPort" = 80
},
]
"selector" = {
"app" = "test-agic-app"
}
}
}
}
resource "kubernetes_manifest" "ingress_test_agic_app_ingress" {
depends_on = [
azurerm_kubernetes_cluster.Terra_aks
]
manifest = {
"apiVersion" = "networking.k8s.io/v1"
"kind" = "Ingress"
"metadata" = {
"annotations" = {
"kubernetes.io/ingress.class" = "azure/application-gateway"
}
"name" = "test-agic-app-ingress"
"namespace" = "default"
}
"spec" = {
"rules" = [
{
"host" = "demoingress2.demostan.com"
"http" = {
"paths" = [
{
"backend" = {
"service" = {
"name" = "test-agic-app-service"
"port" = {
"number" = 80
}
}
}
"path" = "/"
"pathType" = "Prefix"
},
]
}
},
]
}
}
}