From 65ba4c1b062b98bf8b692bb60922e3be2abbb6d7 Mon Sep 17 00:00:00 2001 From: Dave Cunningham Date: Thu, 30 Jul 2015 10:46:16 -0400 Subject: [PATCH] Make target_pools optional --- .../resource_compute_instance_group_manager.go | 2 +- ...resource_compute_instance_group_manager_test.go | 14 +++++++++++++- .../r/compute_instance_group_manager.html.markdown | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/builtin/providers/google/resource_compute_instance_group_manager.go b/builtin/providers/google/resource_compute_instance_group_manager.go index ca0967e37..aea911001 100644 --- a/builtin/providers/google/resource_compute_instance_group_manager.go +++ b/builtin/providers/google/resource_compute_instance_group_manager.go @@ -55,7 +55,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource { "target_pools": &schema.Schema{ Type: schema.TypeSet, - Required: true, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: func(v interface{}) int { return hashcode.String(v.(string)) diff --git a/builtin/providers/google/resource_compute_instance_group_manager_test.go b/builtin/providers/google/resource_compute_instance_group_manager_test.go index d1cf89a2d..ffbd89ac4 100644 --- a/builtin/providers/google/resource_compute_instance_group_manager_test.go +++ b/builtin/providers/google/resource_compute_instance_group_manager_test.go @@ -23,6 +23,8 @@ func TestAccInstanceGroupManager_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckInstanceGroupManagerExists( "google_compute_instance_group_manager.igm-basic", &manager), + testAccCheckInstanceGroupManagerExists( + "google_compute_instance_group_manager.igm-no-tp", &manager), ), }, }, @@ -184,7 +186,17 @@ resource "google_compute_instance_group_manager" "igm-basic" { base_instance_name = "igm-basic" zone = "us-central1-c" target_size = 2 -}` +} + +resource "google_compute_instance_group_manager" "igm-no-tp" { + description = "Terraform test instance group manager" + name = "terraform-test-igm-no-tp" + instance_template = "${google_compute_instance_template.igm-basic.self_link}" + base_instance_name = "igm-no-tp" + zone = "us-central1-c" + target_size = 2 +} +` const testAccInstanceGroupManager_update = ` resource "google_compute_instance_template" "igm-update" { diff --git a/website/source/docs/providers/google/r/compute_instance_group_manager.html.markdown b/website/source/docs/providers/google/r/compute_instance_group_manager.html.markdown index abaed7a58..5d4dec916 100644 --- a/website/source/docs/providers/google/r/compute_instance_group_manager.html.markdown +++ b/website/source/docs/providers/google/r/compute_instance_group_manager.html.markdown @@ -50,8 +50,8 @@ Supported characters include lowercase letters, numbers, and hyphens. * `target_size` - (Optional) If not given at creation time, this defaults to 1. Do not specify this if you are managing the group with an autoscaler, as this will cause fighting. -* `target_pools` - (Required) The full URL of all target pools to which new -instances in the group are added. Updating the target pool values does not +* `target_pools` - (Optional) The full URL of all target pools to which new +instances in the group are added. Updating the target pools attribute does not affect existing instances. * `zone` - (Required) The zone that instances in this group should be created in.