From 109ee4f48c408022ba6f57fe85140abeda302bc3 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Fri, 25 Oct 2019 16:24:32 -0700 Subject: [PATCH] Make it clear that we don't need to ForceSend nested fields in ComputeInstanceFromTemplate (#2543) Merged PR #2543. --- build/terraform | 2 +- build/terraform-beta | 2 +- .../resources/resource_compute_instance_from_template.go | 1 - .../tests/resource_compute_instance_from_template_test.go | 8 ++++++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build/terraform b/build/terraform index bfb298f1062d..7f460c8ccbce 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit bfb298f1062d0717c256cf7426fab7c13a0dcc96 +Subproject commit 7f460c8ccbce8b203e0aa848858a1b6ac3957760 diff --git a/build/terraform-beta b/build/terraform-beta index a3f44b501946..04e6447c28a6 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit a3f44b501946af06d17ff5b0d47f6ab65809d298 +Subproject commit 04e6447c28a646cf93a24f3a256965a8ce79101b diff --git a/third_party/terraform/resources/resource_compute_instance_from_template.go b/third_party/terraform/resources/resource_compute_instance_from_template.go index b7a4019ec589..4150af0a69de 100644 --- a/third_party/terraform/resources/resource_compute_instance_from_template.go +++ b/third_party/terraform/resources/resource_compute_instance_from_template.go @@ -127,7 +127,6 @@ func resourceComputeInstanceFromTemplateCreate(d *schema.ResourceData, meta inte } // Force send all top-level fields that have been set in case they're overridden to zero values. - // TODO: consider doing so for nested fields as well. // Initialize ForceSendFields to empty so we don't get things that the instance resource // always force-sends. instance.ForceSendFields = []string{} diff --git a/third_party/terraform/tests/resource_compute_instance_from_template_test.go b/third_party/terraform/tests/resource_compute_instance_from_template_test.go index 166d0619842b..84d5d77d064b 100644 --- a/third_party/terraform/tests/resource_compute_instance_from_template_test.go +++ b/third_party/terraform/tests/resource_compute_instance_from_template_test.go @@ -32,6 +32,7 @@ func TestAccComputeInstanceFromTemplate_basic(t *testing.T) { // Check that fields were set based on the template resource.TestCheckResourceAttr(resourceName, "machine_type", "n1-standard-1"), resource.TestCheckResourceAttr(resourceName, "attached_disk.#", "1"), + resource.TestCheckResourceAttr(resourceName, "scheduling.0.automatic_restart", "false"), ), }, }, @@ -255,6 +256,10 @@ resource "google_compute_instance_template" "foobar" { foo = "bar" } + scheduling { + automatic_restart = true + } + can_ip_forward = true } @@ -269,6 +274,9 @@ resource "google_compute_instance_from_template" "foobar" { labels = { my_key = "my_value" } + scheduling { + automatic_restart = false + } } `, template, template, instance) }