Skip to content

Commit

Permalink
Merge branch 'master' into gke_nodepool_nodeconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
drebes committed Aug 11, 2017
2 parents 77265f4 + e0e9b3a commit 2aaf64c
Showing 28 changed files with 752 additions and 366 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ BACKWARDS INCOMPATIBILITIES / NOTES:
* compute: `automatic_restart` and `on_host_maintenance` have been removed from `google_compute_instance_template`. Use `scheduling.automatic_restart` or `scheduling.on_host_maintenance` instead. [GH-224]

FEATURES:
* **New Data Source:** `google_compute_instance_group` [GH-267]
* **New Data Source:** `google_dns_managed_zone` [GH-268]
* **New Resource:** `google_compute_project_metadata_item` - allows management of single key/value pairs within the project metadata map [GH-176]
* **New Resource:** `google_project_iam_binding` - allows fine-grained control of a project's IAM policy, controlling only a single binding. [GH-171]
@@ -19,6 +20,7 @@ IMPROVEMENTS:
* compute: Add support for `ip_version` to `google_compute_global_forwarding_rule` [GH-265]
* compute: Add support for `ip_version` to `google_compute_global_address` [GH-250]
* compute: Add support for `subnetwork` as a self_link to `google_compute_instance`. [GH-290]
* compute: Add support for `secondary_ip_range` to `google_compute_subnetwork`. [GH-310]
* compute: Add support for multiple `network_interface`'s to `google_compute_instance`. [GH-289]
* compute: Add support for `denied` to `google_compute_firewall` [GH-282]
* compute: Add support for egress traffic using `direction` to `google_compute_firewall` [GH-306]
167 changes: 0 additions & 167 deletions google/compute_beta_operation.go

This file was deleted.

11 changes: 11 additions & 0 deletions google/compute_operation.go
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import (

"github.com/hashicorp/terraform/helper/resource"

computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/compute/v1"
)

@@ -91,3 +92,13 @@ func computeOperationWaitTime(config *Config, op *compute.Operation, project, ac

return nil
}

func computeBetaOperationWaitTime(config *Config, op *computeBeta.Operation, project, activity string, timeoutMin int) error {
opV1 := &compute.Operation{}
err := Convert(op, opV1)
if err != nil {
return err
}

return computeOperationWaitTime(config, opV1, project, activity, 4)
}
19 changes: 1 addition & 18 deletions google/compute_shared_operation.go
Original file line number Diff line number Diff line change
@@ -18,24 +18,7 @@ func computeSharedOperationWaitTime(config *Config, op interface{}, project stri
case *compute.Operation:
return computeOperationWaitTime(config, op.(*compute.Operation), project, activity, minutes)
case *computeBeta.Operation:
return computeBetaOperationWaitGlobalTime(config, op.(*computeBeta.Operation), project, activity, minutes)
default:
panic("Attempted to wait on an Operation of unknown type.")
}
}

func computeSharedOperationWaitZone(config *Config, op interface{}, project string, zone, activity string) error {
return computeSharedOperationWaitZoneTime(config, op, project, zone, 4, activity)
}

func computeSharedOperationWaitZoneTime(config *Config, op interface{}, project string, zone string, minutes int, activity string) error {
switch op.(type) {
case *compute.Operation:
return computeOperationWaitTime(config, op.(*compute.Operation), project, activity, minutes)
case *computeBeta.Operation:
return computeBetaOperationWaitZoneTime(config, op.(*computeBeta.Operation), project, zone, minutes, activity)
case nil:
panic("Attempted to wait on an Operation that was nil.")
return computeBetaOperationWaitTime(config, op.(*computeBeta.Operation), project, activity, minutes)
default:
panic("Attempted to wait on an Operation of unknown type.")
}
83 changes: 83 additions & 0 deletions google/data_source_google_compute_instance_group.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package google

import (
"fmt"

"github.com/hashicorp/terraform/helper/schema"
)

func dataSourceGoogleComputeInstanceGroup() *schema.Resource {
return &schema.Resource{
Read: dataSourceComputeInstanceGroupRead,
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},

"zone": {
Type: schema.TypeString,
Required: true,
},

"project": {
Type: schema.TypeString,
Optional: true,
},

"description": {
Type: schema.TypeString,
Computed: true,
},

"instances": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},

"named_port": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},

"port": {
Type: schema.TypeInt,
Required: true,
},
},
},
},

"network": {
Type: schema.TypeString,
Computed: true,
},

"self_link": {
Type: schema.TypeString,
Computed: true,
},

"size": {
Type: schema.TypeInt,
Computed: true,
},
},
}
}

func dataSourceComputeInstanceGroupRead(d *schema.ResourceData, meta interface{}) error {
zone := d.Get("zone").(string)
name := d.Get("name").(string)

d.SetId(fmt.Sprintf("%s/%s", zone, name))

return resourceComputeInstanceGroupRead(d, meta)
}
Loading

0 comments on commit 2aaf64c

Please sign in to comment.