-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
60 lines (53 loc) · 1.5 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
## terraform & providers
terraform {
required_version = ">= 1.5.7"
backend "local" {
path = "terraform.tfstate"
}
required_providers {
google = {
source = "hashicorp/google"
version = "~> 6.15"
}
kubectl = {
source = "alekc/kubectl"
version = "2.1.3"
}
helm = {
source = "hashicorp/helm"
version = "~> 2.17"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.35"
}
}
}
## referenciar um recurso já existente!
## ref: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_project
data "google_project" "this" {
project_id = var.project_id
}
## local resources
locals {
prefix = var.user_prefix
}
data "google_client_config" "this" {}
provider "kubectl" {
host = module.gke.gke_default_endpoint
cluster_ca_certificate = base64decode(module.gke.gke_ca_certificate)
token = data.google_client_config.this.access_token
load_config_file = false
}
provider "helm" {
kubernetes {
host = module.gke.gke_default_endpoint
token = data.google_client_config.this.access_token
cluster_ca_certificate = base64decode(module.gke.gke_ca_certificate)
}
}
provider "kubernetes" {
host = "https://${module.gke.gke_default_endpoint}"
token = data.google_client_config.this.access_token
cluster_ca_certificate = base64decode(module.gke.gke_ca_certificate)
}