Merge pull request #2894 from sparkprime/optional_target_pool

Make target_pools optional
This commit is contained in:
Dave Cunningham 2015-07-30 13:52:44 -04:00
commit 6e7c6122e9
3 changed files with 16 additions and 4 deletions

View File

@ -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))

View File

@ -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" {

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
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.