Remove address and create_timeout from instance (#2219)

This commit is contained in:
Chris Stephens 2018-10-10 13:16:12 -07:00 committed by Nathan McKinley
parent eafe197070
commit 50fe1b6c83
4 changed files with 1 additions and 36 deletions

View File

@ -77,7 +77,6 @@ func flattenNetworkInterfaces(d *schema.ResourceData, config *Config, networkInt
region = subnet.Region
flattened[i] = map[string]interface{}{
"address": iface.NetworkIP,
"network_ip": iface.NetworkIP,
"network": ConvertSelfLinkToV1(iface.Network),
"subnetwork": ConvertSelfLinkToV1(iface.Subnetwork),
@ -147,12 +146,6 @@ func expandNetworkInterfaces(d *schema.ResourceData, config *Config) ([]*compute
AliasIpRanges: expandAliasIpRanges(data["alias_ip_range"].([]interface{})),
}
// address is deprecated, but address took priority over networkIP before
// so it should until it's removed.
if data["address"].(string) != "" {
ifaces[i].NetworkIP = data["address"].(string)
}
}
return ifaces, nil
}

View File

@ -167,14 +167,6 @@ func resourceComputeInstance() *schema.Resource {
Computed: true,
},
"address": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Deprecated: "Please use network_ip",
},
"network_ip": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -288,13 +280,6 @@ func resourceComputeInstance() *schema.Resource {
ForceNew: true,
},
"create_timeout": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 4,
Deprecated: "Use timeouts block instead.",
},
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -735,11 +720,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
}
// Read create timeout
// Until "create_timeout" is removed, use that timeout if set.
createTimeout := int(d.Timeout(schema.TimeoutCreate).Minutes())
if v, ok := d.GetOk("create_timeout"); ok && v != 4 {
createTimeout = v.(int)
}
log.Printf("[INFO] Requesting instance creation")
op, err := config.clientComputeBeta.Instances.Insert(project, zone.Name, instance).Do()

View File

@ -14,11 +14,10 @@ import (
)
func computeInstanceImportStep(zone, instanceName string, additionalImportIgnores []string) resource.TestStep {
// create_timeout has a default value, but it's deprecated so don't worry about it
// metadata is only read into state if set in the config
// since importing doesn't know whether metadata.startup_script vs metadata_startup_script is set in the config,
// it guesses metadata_startup_script
ignores := []string{"create_timeout", "metadata.%", "metadata.startup-script", "metadata_startup_script"}
ignores := []string{"metadata.%", "metadata.startup-script", "metadata_startup_script"}
return resource.TestStep{
ResourceName: "google_compute_instance.foobar",
@ -1545,8 +1544,6 @@ resource "google_compute_instance" "foobar" {
baz = "qux"
}
create_timeout = 5
metadata {
startup-script = "echo Hello"
}
@ -1804,8 +1801,6 @@ resource "google_compute_instance" "foobar" {
startup-script = "echo Hello"
}
create_timeout = 5
labels {
only_me = "nothing_else"
}

View File

@ -203,10 +203,6 @@ The `network_interface` block supports:
defined in the subnetwork self_link. If the `subnetwork` is a name and this
field is not provided, the provider project is used.
* `address` - (Optional, Deprecated) The private IP address to assign to the instance. If
empty, the address will be automatically assigned. This attribute has been deprecated.
Use `network_interface.network_ip` instead.
* `network_ip` - (Optional) The private IP address to assign to the instance. If
empty, the address will be automatically assigned.