-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
terraform-core-helpers
child module (#50)
- Loading branch information
1 parent
ad350e7
commit 9171be4
Showing
28 changed files
with
185 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Terraform Core Helpers Module (osinfra.io) | ||
# https://github.com/osinfra-io/terraform-core-helpers | ||
|
||
module "helpers" { | ||
source = "github.com/osinfra-io/terraform-core-helpers//root?ref=v0.1.2" | ||
|
||
cost_center = "x001" | ||
data_classification = "public" | ||
repository = "google-cloud-kubernetes" | ||
team = "platform-google-cloud-kubernetes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Required Providers | ||
# https://www.terraform.io/docs/language/providers/requirements.html#requiring-providers | ||
|
||
terraform { | ||
required_providers { | ||
|
||
datadog = { | ||
source = "datadog/datadog" | ||
} | ||
|
||
# Google Cloud Provider | ||
# https://www.terraform.io/docs/providers/google/index.html | ||
|
||
google = { | ||
source = "hashicorp/google" | ||
} | ||
|
||
helm = { | ||
source = "hashicorp/helm" | ||
} | ||
|
||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
} | ||
} | ||
} | ||
|
||
# Datadog Provider | ||
# https://registry.terraform.io/providers/DataDog/datadog/latest/docs | ||
|
||
provider "datadog" { | ||
api_key = var.datadog_api_key | ||
app_key = var.datadog_app_key | ||
} | ||
|
||
# Helm Provider | ||
# https://registry.terraform.io/providers/hashicorp/helm/latest | ||
|
||
provider "helm" { | ||
kubernetes { | ||
|
||
cluster_ca_certificate = base64decode( | ||
data.google_container_cluster.this.master_auth.0.cluster_ca_certificate | ||
) | ||
|
||
host = data.google_container_cluster.this.endpoint | ||
token = data.google_client_config.this.access_token | ||
} | ||
} | ||
|
||
# Kubernetes Provider | ||
# https://registry.terraform.io/providers/hashicorp/kubernetes/latest | ||
|
||
provider "kubernetes" { | ||
cluster_ca_certificate = base64decode( | ||
data.google_container_cluster.this.master_auth.0.cluster_ca_certificate | ||
) | ||
host = "https://${data.google_container_cluster.this.endpoint}" | ||
token = data.google_client_config.this.access_token | ||
} | ||
|
||
# Google Client Config Data Source | ||
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/client_config | ||
|
||
data "google_client_config" "this" { | ||
} | ||
|
||
# Google Container Cluster Data Source | ||
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/container_cluster | ||
|
||
data "google_container_cluster" "this" { | ||
name = "plt-${module.helpers.region}-${module.helpers.zone}" | ||
location = module.helpers.region | ||
project = data.google_project.this.project_id | ||
} | ||
|
||
# Google Projects Data Source | ||
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/projects | ||
|
||
data "google_projects" "this" { | ||
filter = "name:plt-k8s-* labels.env:${module.helpers.environment}" | ||
} | ||
|
||
# Google Project Data Source | ||
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/project | ||
|
||
data "google_project" "this" { | ||
project_id = data.google_projects.this.projects.0.project_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
environment = "non-production" | ||
region = "us-east1" | ||
zone = "b" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
environment = "production" | ||
region = "us-east1" | ||
zone = "b" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
region = "us-east1" | ||
zone = "b" | ||
Oops, something went wrong.