Make target_pools optional

This commit is contained in:
Dave Cunningham 2015-07-30 10:46:16 -04:00
parent 8031d60ced
commit 65ba4c1b06
3 changed files with 16 additions and 4 deletions

View File

@ -55,7 +55,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
"target_pools": &schema.Schema{ "target_pools": &schema.Schema{
Type: schema.TypeSet, Type: schema.TypeSet,
Required: true, Optional: true,
Elem: &schema.Schema{Type: schema.TypeString}, Elem: &schema.Schema{Type: schema.TypeString},
Set: func(v interface{}) int { Set: func(v interface{}) int {
return hashcode.String(v.(string)) return hashcode.String(v.(string))

View File

@ -23,6 +23,8 @@ func TestAccInstanceGroupManager_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckInstanceGroupManagerExists( testAccCheckInstanceGroupManagerExists(
"google_compute_instance_group_manager.igm-basic", &manager), "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" base_instance_name = "igm-basic"
zone = "us-central1-c" zone = "us-central1-c"
target_size = 2 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 = ` const testAccInstanceGroupManager_update = `
resource "google_compute_instance_template" "igm-update" { resource "google_compute_instance_template" "igm-update" {

View File

@ -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 * `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. 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 * `target_pools` - (Optional) The full URL of all target pools to which new
instances in the group are added. Updating the target pool values does not instances in the group are added. Updating the target pools attribute does not
affect existing instances. affect existing instances.
* `zone` - (Required) The zone that instances in this group should be created in. * `zone` - (Required) The zone that instances in this group should be created in.