From 4ee69b4c1c1fa620a2f5acf9963b70d575b4dde8 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 19 Dec 2019 13:38:58 +1100 Subject: [PATCH 1/3] Add Terraform Cloud Run example for multiple environment variables `env` has to be declared multiple times in this format to declare multiple variables. --- products/cloudrun/terraform.yaml | 8 ++++++ ...vice_multiple_environment_variables.tf.erb | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb diff --git a/products/cloudrun/terraform.yaml b/products/cloudrun/terraform.yaml index 91762ab78d3..2a9842322fc 100644 --- a/products/cloudrun/terraform.yaml +++ b/products/cloudrun/terraform.yaml @@ -75,6 +75,14 @@ overrides: !ruby/object:Overrides::ResourceOverrides cloud_run_service_name: "tftest-cloudrun" test_env_vars: project: :PROJECT_NAME + - !ruby/object:Provider::Terraform::Examples + name: "cloud_run_service_multiple_environment_variables" + primary_resource_id: "default" + primary_resource_name: "fmt.Sprintf(\"tftest-cloudrun%s\", context[\"random_suffix\"])" + vars: + cloud_run_service_name: "tftest-cloudrun" + test_env_vars: + project: :PROJECT_NAME custom_code: !ruby/object:Provider::Terraform::CustomCode encoder: 'templates/terraform/encoders/cloud_run_service.go.erb' decoder: 'templates/terraform/decoders/cloud_run.go.erb' diff --git a/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb b/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb new file mode 100644 index 00000000000..cd510fd7a20 --- /dev/null +++ b/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb @@ -0,0 +1,25 @@ +resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]['cloud_run_service_name'] %>" + location = "us-central1" + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + } + env { + name = "SOURCE" + value = "remote" + } + env { + name = "TARGET" + value = "home" + } + } + } + + traffic { + percent = 100 + latest_revision = true + } +} From 9eaa1b2b024bace54f95706c391d48265c309537 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Fri, 20 Dec 2019 08:55:48 +1100 Subject: [PATCH 2/3] Correct example indentation --- ...service_multiple_environment_variables.tf.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb b/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb index cd510fd7a20..567da4bbaa3 100644 --- a/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb +++ b/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.erb @@ -6,14 +6,14 @@ resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { spec { containers { image = "gcr.io/cloudrun/hello" - } - env { - name = "SOURCE" - value = "remote" - } - env { - name = "TARGET" - value = "home" + env { + name = "SOURCE" + value = "remote" + } + env { + name = "TARGET" + value = "home" + } } } } From 66d5f54ca71f2259800ab961ef5f444274d33851 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 20 Dec 2019 00:01:17 +0000 Subject: [PATCH 3/3] Update tracked submodules -> HEAD on Fri Dec 20 00:01:17 UTC 2019 Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec. --- build/terraform | 2 +- build/terraform-beta | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/terraform b/build/terraform index 9a3c31a09d2..0184287e542 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit 9a3c31a09d23265204ef53adf943e63a824602f6 +Subproject commit 0184287e542ff967355e1e1195a7b3b546a30df0 diff --git a/build/terraform-beta b/build/terraform-beta index 8f1fab55fc1..707e781635d 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit 8f1fab55fc1bcf277c56a100b2b637ea5103fee9 +Subproject commit 707e781635d16cf6e0d02de3fb33f137876c46bd