Skip to content

Commit

Permalink
Allowing address to be settable
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisst authored and modular-magician committed Dec 10, 2018
1 parent abf8b0b commit 37ff86b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
20 changes: 16 additions & 4 deletions google-beta/resource_compute_global_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 4 additions & 3 deletions website/docs/r/compute_global_address.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit 37ff86b

Please sign in to comment.