Skip to content

Commit

Permalink
fix: Add labels and health-check logging (#19)
Browse files Browse the repository at this point in the history
* add labels

* update version

* format

* revert change

* add new lines

* format

* terraform-docs: automated action

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
elainaRenee and github-actions[bot] authored May 11, 2022
1 parent f56cfff commit 40fd527
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ No providers.
| <a name="module_app_gke"></a> [app\_gke](#module\_app\_gke) | ./modules/app_gke | n/a |
| <a name="module_app_lb"></a> [app\_lb](#module\_app\_lb) | ./modules/app_lb | n/a |
| <a name="module_database"></a> [database](#module\_database) | ./modules/database | n/a |
| <a name="module_gke_app"></a> [gke\_app](#module\_gke\_app) | wandb/wandb/kubernetes | 1.1.1 |
| <a name="module_gke_app"></a> [gke\_app](#module\_gke\_app) | wandb/wandb/kubernetes | 1.1.2 |
| <a name="module_kms"></a> [kms](#module\_kms) | ./modules/kms | n/a |
| <a name="module_networking"></a> [networking](#module\_networking) | ./modules/networking | n/a |
| <a name="module_project_factory_project_services"></a> [project\_factory\_project\_services](#module\_project\_factory\_project\_services) | terraform-google-modules/project-factory/google//modules/project_services | ~> 13.0 |
Expand Down
9 changes: 7 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ module "project_factory_project_services" {
"redis.googleapis.com", // Redis
"pubsub.googleapis.com", // File Storage
"storage.googleapis.com", // Cloud Storage
"cloudkms.googleapis.com" // KMS
"cloudkms.googleapis.com", // KMS
"compute.googleapis.com", // required for datadog monitoring
"cloudasset.googleapis.com" // required for datadog monitoring
]
}

Expand Down Expand Up @@ -83,6 +85,7 @@ module "app_lb" {
network = module.networking.network
group = module.app_gke.instance_group_url
service_account = module.service_accounts.service_account
labels = var.labels
depends_on = [module.project_factory_project_services]
}

Expand All @@ -92,6 +95,7 @@ module "database" {
database_version = var.database_version
network_connection = module.networking.connection
deletion_protection = var.deletion_protection
labels = var.labels
depends_on = [module.project_factory_project_services]
}

Expand All @@ -101,6 +105,7 @@ module "redis" {
namespace = var.namespace
memory_size_gb = 4
network = module.networking.network
labels = var.labels
}

locals {
Expand All @@ -112,7 +117,7 @@ locals {

module "gke_app" {
source = "wandb/wandb/kubernetes"
version = "1.1.1"
version = "1.1.2"

license = var.license

Expand Down
4 changes: 3 additions & 1 deletion modules/app_lb/http/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ resource "google_compute_global_forwarding_rule" "default" {
target = google_compute_target_http_proxy.default.id
port_range = "80"
ip_address = var.ip_address
}

labels = var.labels
}
8 changes: 7 additions & 1 deletion modules/app_lb/http/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ variable "url_map" {

variable "ip_address" {
type = string
}
}

variable "labels" {
description = "Labels which will be applied to all applicable resources."
type = map(string)
default = {}
}
4 changes: 3 additions & 1 deletion modules/app_lb/https/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ resource "google_compute_global_forwarding_rule" "default" {
target = google_compute_target_https_proxy.default.id
port_range = "443"
ip_address = var.ip_address
}

labels = var.labels
}
4 changes: 3 additions & 1 deletion modules/app_lb/https/redirect.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ module "http" {
namespace = var.namespace
url_map = google_compute_url_map.redirect_to_https
ip_address = var.ip_address
}

labels = var.labels
}
8 changes: 7 additions & 1 deletion modules/app_lb/https/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ variable "ip_address" {

variable "fqdn" {
type = string
}
}

variable "labels" {
description = "Labels which will be applied to all applicable resources."
type = map(string)
default = {}
}
4 changes: 4 additions & 0 deletions modules/app_lb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module "http" {
namespace = var.namespace
url_map = module.url_map.app
ip_address = google_compute_global_address.default.address

labels = var.labels
}

module "https" {
Expand All @@ -29,4 +31,6 @@ module "https" {
namespace = var.namespace
url_map = module.url_map.app
ip_address = google_compute_global_address.default.address

labels = var.labels
}
4 changes: 4 additions & 0 deletions modules/app_lb/url_map/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ resource "google_compute_health_check" "gke_ingress" {
port = var.target_port
request_path = "/ready"
}

log_config {
enable = true
}
}

# This is an ingress rule that allows traffic from the Google Cloud health
Expand Down
8 changes: 7 additions & 1 deletion modules/app_lb/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ variable "target_port" {
variable "network" {
description = "Google Compute Engine network to which the cluster is connected."
type = object({ self_link = string })
}
}

variable "labels" {
description = "Labels which will be applied to all applicable resources."
type = map(string)
default = {}
}
2 changes: 2 additions & 0 deletions modules/storage/pubsub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ locals {
resource "google_pubsub_topic" "file_storage" {
name = "${var.namespace}-file-storage"
kms_key_name = var.crypto_key.id
labels = var.labels
}

resource "google_pubsub_topic_iam_member" "admin" {
Expand All @@ -16,6 +17,7 @@ resource "google_pubsub_topic_iam_member" "admin" {
resource "google_pubsub_subscription" "file_storage" {
name = "${var.namespace}-file-storage"
topic = google_pubsub_topic.file_storage.name
labels = var.labels
ack_deadline_seconds = 30
}

Expand Down

0 comments on commit 40fd527

Please sign in to comment.