-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
89 lines (78 loc) · 1.65 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
provider "helm" {
version = "~> 0.9"
install_tiller = true
}
terraform {
required_version = ">= 0.12"
required_providers {
google = "~> 3.9"
null = "~> 2.1"
}
}
provider "google" {
project = "solstice-api-junkyard"
region = "us-central1"
}
variable "istio_namespace" {
default = "istio-system"
}
variable "istio_version" {
default = "1.4.5"
}
variable "istio_url_version" {
default = "https://storage.googleapis.com/istio-release/releases/1.4.5/charts/"
}
data "helm_repository" "istio" {
name = "istio"
url = var.istio_url_version
}
resource "helm_release" "istio_init" {
name = "istio-init"
repository = data.helm_repository.istio.url
chart = "istio-init"
version = var.istio_version
namespace = var.istio_namespace
}
resource "null_resource" "delay" {
provisioner "local-exec" {
command = "sleep 80"
}
depends_on = [
"helm_release.istio_init"]
}
resource "helm_release" "istio" {
name = "istio"
repository = data.helm_repository.istio.url
chart = "istio"
version = var.istio_version
namespace = var.istio_namespace
depends_on = [
"null_resource.delay"
]
values = [
<<-EOF
ingress:
enable: "true"
service:
type: LoadBalanceryes
externalHttpPort: 80
deployment:
name: ingress
annotations:
sidecar.istio.io/inject: "false"
cloud.google.com/neg: '{"exposed_ports": {"80":{}}}'
EOF
]
set {
name = "global.k8sIngressSelector"
value = "ingressgateway"
}
set {
name = "gateways.enabled"
value = "true"
}
set {
name = "gateways.istio-ingressgateway.type"
value = "NodePort"
}
}