-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
66 lines (55 loc) · 1.58 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
terraform {
backend "remote" {
organization = "hashicorp-learn"
workspaces {
name = "learn-terraform-pipelines-vault"
}
}
required_providers {
helm = {
source = "hashicorp/helm"
version = "~> 2.0.2"
}
}
required_version = "~> 0.14"
}
data "terraform_remote_state" "cluster" {
backend = "remote"
config = {
organization = var.organization
workspaces = {
name = var.cluster_workspace
}
}
}
data "terraform_remote_state" "consul" {
backend = "remote"
config = {
organization = var.organization
workspaces = {
name = var.consul_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" {}
data "google_container_cluster" "my_cluster" {
name = data.terraform_remote_state.cluster.outputs.cluster
location = data.terraform_remote_state.cluster.outputs.region
}
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
}
}