-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
58 lines (46 loc) · 1.32 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
terraform {
backend "remote" {
organization = "hashicorp-learn"
workspaces {
name = "learn-terraform-pipelines-consul"
}
}
required_providers {
helm = {
source = "hashicorp/helm"
version = "~> 2.0.2"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.0.2"
}
}
#required_version = "~> 0.14"
}
data "terraform_remote_state" "cluster" {
backend = "remote"
config = {
organization = var.organization
workspaces = {
name = var.cluster_workspace
}
}
}
# Retrieve GKE cluster information
provider "google" {
project = data.terraform_remote_state.cluster.outputs.project_id
region = data.terraform_remote_state.cluster.outputs.region
}
data "google_client_config" "default" {}
provider "kubernetes" {
host = data.terraform_remote_state.cluster.outputs.host
token = data.google_client_config.default.access_token
cluster_ca_certificate = data.terraform_remote_state.cluster.outputs.cluster_ca_certificate
}
provider "helm" {
kubernetes {
host = data.terraform_remote_state.cluster.outputs.host
token = data.google_client_config.default.access_token
cluster_ca_certificate = data.terraform_remote_state.cluster.outputs.cluster_ca_certificate
}
}