diff --git a/google-beta/resource_compute_global_address.go b/google-beta/resource_compute_global_address.go index ecaa7be96d..c904d271a3 100644 --- a/google-beta/resource_compute_global_address.go +++ b/google-beta/resource_compute_global_address.go @@ -49,6 +49,12 @@ func resourceComputeGlobalAddress() *schema.Resource { Required: true, ForceNew: true, }, + "address": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + }, "address_type": { Type: schema.TypeString, Optional: true, @@ -91,10 +97,6 @@ func resourceComputeGlobalAddress() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"VPC_PEERING", ""}, false), }, - "address": { - Type: schema.TypeString, - Computed: true, - }, "creation_timestamp": { Type: schema.TypeString, Computed: true, @@ -121,6 +123,12 @@ func resourceComputeGlobalAddressCreate(d *schema.ResourceData, meta interface{} config := meta.(*Config) obj := make(map[string]interface{}) + addressProp, err := expandComputeGlobalAddressAddress(d.Get("address"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("address"); !isEmptyValue(reflect.ValueOf(addressProp)) && (ok || !reflect.DeepEqual(v, addressProp)) { + obj["address"] = addressProp + } descriptionProp, err := expandComputeGlobalAddressDescription(d.Get("description"), d, config) if err != nil { return err @@ -478,6 +486,10 @@ func flattenComputeGlobalAddressNetwork(v interface{}, d *schema.ResourceData) i return ConvertSelfLinkToV1(v.(string)) } +func expandComputeGlobalAddressAddress(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) { + return v, nil +} + func expandComputeGlobalAddressDescription(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google-beta/resource_compute_global_address_test.go b/google-beta/resource_compute_global_address_test.go index cb24152bfa..0b83d23ef6 100644 --- a/google-beta/resource_compute_global_address_test.go +++ b/google-beta/resource_compute_global_address_test.go @@ -171,6 +171,7 @@ resource "google_compute_global_address" "foobar" { address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 24 + address = "172.20.181.0" network = "${google_compute_network.foobar.self_link}" }`, acctest.RandString(10), acctest.RandString(10)) } diff --git a/website/docs/r/compute_global_address.html.markdown b/website/docs/r/compute_global_address.html.markdown index 159b366a39..181c45dd64 100644 --- a/website/docs/r/compute_global_address.html.markdown +++ b/website/docs/r/compute_global_address.html.markdown @@ -64,6 +64,10 @@ The following arguments are supported: - - - +* `address` - + (Optional) + The static external IP address represented by this resource. + * `description` - (Optional) An optional description of this resource. @@ -111,9 +115,6 @@ The following arguments are supported: In addition to the arguments listed above, the following computed attributes are exported: -* `address` - - The static external IP address represented by this resource. - * `creation_timestamp` - Creation timestamp in RFC3339 text format.