Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain the production GKE cluster using Terraform #2615

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/terraform/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
This folder contains the Terraform for some of the infrastructure used by the CICD (continuous integration and continuous delivery/continuous deployment) of this repository.
This folder contains the Terraform for some of the Google Cloud resources used by:
* the CICD (continuous integration and continuous delivery/deployment) of this repository and
* the production deployment.

## Update this Terraform

Expand Down
32 changes: 32 additions & 0 deletions .github/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,35 @@ resource "google_container_cluster" "prs_gke_cluster" {
ip_allocation_policy {
}
}

# The GKE cluster used for the production deployment.
resource "google_container_cluster" "production_gke_cluster" {
name = "production-gke-cluster"
location = "us-central1"
enable_autopilot = true
project = var.project_id
deletion_protection = true
depends_on = [
module.enable_google_apis
]
cluster_autoscaling {
auto_provisioning_defaults {
service_account = google_service_account.gke_clusters_service_account.email
}
}
# Need an empty ip_allocation_policy to overcome an error related to autopilot node pool constraints.
# Workaround from https://github.com/hashicorp/terraform-provider-google/issues/10782#issuecomment-1024488630
ip_allocation_policy {
}
}

# The external, static IP address for the production frontend.
resource "google_compute_global_address" "production_frontend_ip_address" {
provider = google-beta
name = "production-frontend-ip-address"
address_type = "EXTERNAL"
project = var.project_id
depends_on = [
module.enable_google_apis
]
}
16 changes: 15 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

.DS_Store
.eclipse.buildship.core.prefs
.gradle/
Expand All @@ -6,7 +20,7 @@
.project
.skaffold-*.yaml
.terraform.lock.hcl
.terraform/*
**/.terraform/*
.venv/
.vs/
.vscode/
Expand Down
Loading