From c8ce490ba742b337c440e0e3f2d249b13af24de8 Mon Sep 17 00:00:00 2001 From: Denis Simonovski Date: Thu, 24 Jun 2021 11:50:22 +0200 Subject: [PATCH 1/2] refactor default google_compute_region_backend_service timeout_sec to a variable --- .gitignore | 3 +++ main.tf | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 477cdaf..b59baf4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ \#*\# .\#* +# JetBrains relates files +.idea + # Vim-related files [._]*.s[a-w][a-z] [._]s[a-w][a-z] diff --git a/main.tf b/main.tf index 85dc9fc..49c887a 100644 --- a/main.tf +++ b/main.tf @@ -46,7 +46,7 @@ resource "google_compute_region_backend_service" "default" { name = var.health_check["type"] == "tcp" ? "${var.name}-with-tcp-hc" : "${var.name}-with-http-hc" region = var.region protocol = var.ip_protocol - timeout_sec = 10 + timeout_sec = var.health_check["timeout_sec"] session_affinity = var.session_affinity dynamic "backend" { for_each = var.backends From 0000e0e7bc2356e5dfa6dacfac76de3c722c6b4a Mon Sep 17 00:00:00 2001 From: denissimonovski <37238646+denissimonovski@users.noreply.github.com> Date: Thu, 24 Jun 2021 17:55:42 +0200 Subject: [PATCH 2/2] Update main.tf Co-authored-by: Morgante Pell --- main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 49c887a..8371741 100644 --- a/main.tf +++ b/main.tf @@ -46,7 +46,7 @@ resource "google_compute_region_backend_service" "default" { name = var.health_check["type"] == "tcp" ? "${var.name}-with-tcp-hc" : "${var.name}-with-http-hc" region = var.region protocol = var.ip_protocol - timeout_sec = var.health_check["timeout_sec"] + timeout_sec = var.health_check["timeout_sec"] == null ? 10 : var.health_check["timeout_sec"] session_affinity = var.session_affinity dynamic "backend" { for_each = var.backends @@ -128,4 +128,3 @@ resource "google_compute_firewall" "default-hc" { target_tags = var.target_tags target_service_accounts = var.target_service_accounts } -