Merge pull request #142 from selmanj/update_go_vendor_dependency

Update compute api client and AutomaticRestart usage
This commit is contained in:
Joe Selman 2017-06-20 10:27:00 -07:00 committed by GitHub
commit ccfe6d4c25
5 changed files with 5445 additions and 557 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/compute/v1"
"google.golang.org/api/googleapi"
)
func stringScopeHashcode(v interface{}) int {
@ -643,7 +644,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
scheduling := &compute.Scheduling{}
if val, ok := d.GetOk(prefix + ".automatic_restart"); ok {
scheduling.AutomaticRestart = val.(bool)
scheduling.AutomaticRestart = googleapi.Bool(val.(bool))
}
if val, ok := d.GetOk(prefix + ".preemptible"); ok {
@ -981,7 +982,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
scheduling := &compute.Scheduling{}
if val, ok := d.GetOk(prefix + ".automatic_restart"); ok {
scheduling.AutomaticRestart = val.(bool)
scheduling.AutomaticRestart = googleapi.Bool(val.(bool))
}
if val, ok := d.GetOk(prefix + ".preemptible"); ok {

View File

@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/compute/v1"
"google.golang.org/api/googleapi"
)
func resourceComputeInstanceTemplate() *schema.Resource {
@ -519,7 +520,7 @@ func resourceComputeInstanceTemplateCreate(d *schema.ResourceData, meta interfac
// Depreciated fields
if v, ok := d.GetOk("automatic_restart"); ok {
instanceProperties.Scheduling.AutomaticRestart = v.(bool)
instanceProperties.Scheduling.AutomaticRestart = googleapi.Bool(v.(bool))
}
if v, ok := d.GetOk("on_host_maintenance"); ok {
@ -537,7 +538,7 @@ func resourceComputeInstanceTemplateCreate(d *schema.ResourceData, meta interfac
_scheduling := _schedulings[0].(map[string]interface{})
if vp, okp := _scheduling["automatic_restart"]; okp {
instanceProperties.Scheduling.AutomaticRestart = vp.(bool)
instanceProperties.Scheduling.AutomaticRestart = googleapi.Bool(vp.(bool))
forceSendFieldsScheduling = append(forceSendFieldsScheduling, "AutomaticRestart")
}
@ -679,13 +680,16 @@ func flattenNetworkInterfaces(networkInterfaces []*compute.NetworkInterface) ([]
return result, region
}
func flattenScheduling(scheduling *compute.Scheduling) ([]map[string]interface{}, bool) {
func flattenScheduling(scheduling *compute.Scheduling) ([]map[string]interface{}, *bool) {
result := make([]map[string]interface{}, 0, 1)
schedulingMap := make(map[string]interface{})
schedulingMap["automatic_restart"] = scheduling.AutomaticRestart
if scheduling.AutomaticRestart != nil {
schedulingMap["automatic_restart"] = *scheduling.AutomaticRestart
}
schedulingMap["on_host_maintenance"] = scheduling.OnHostMaintenance
schedulingMap["preemptible"] = scheduling.Preemptible
result = append(result, schedulingMap)
// TODO(selmanj) No need to return two values as automatic restart is captured in map
return result, scheduling.AutomaticRestart
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

6
vendor/vendor.json vendored
View File

@ -815,10 +815,10 @@
"revisionTime": "2017-06-08T21:27:40Z"
},
{
"checksumSHA1": "tD5kobeqw1b4V20UQsM2zTTDRHY=",
"checksumSHA1": "OL1a45TdWBqDK1BO167p5Tlkgkc=",
"path": "google.golang.org/api/compute/v1",
"revision": "fbbaff1827317122a8a0e1b24de25df8417ce87b",
"revisionTime": "2017-04-21T05:17:54Z"
"revision": "324744a33f1f37e63dd1695cfb3ec9a3e4a1cb05",
"revisionTime": "2017-06-08T21:27:40Z"
},
{
"checksumSHA1": "lAMqZyc46cU5WaRuw4mVHFXpvps=",