Skip to content

Commit

Permalink
Bandwidth addition to interconnect (#4212)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored and danawillow committed Aug 20, 2019
1 parent 4185432 commit 53b60e1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions google/resource_compute_interconnect_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ func resourceComputeInterconnectAttachment() *schema.Resource {
ForceNew: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"bandwidth": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"BPS_50M", "BPS_100M", "BPS_200M", "BPS_300M", "BPS_400M", "BPS_500M", "BPS_1G", "BPS_2G", "BPS_5G", "BPS_10G", "BPS_20G", "BPS_50G", ""}, false),
},
"candidate_subnets": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -169,6 +176,12 @@ func resourceComputeInterconnectAttachmentCreate(d *schema.ResourceData, meta in
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
bandwidthProp, err := expandComputeInterconnectAttachmentBandwidth(d.Get("bandwidth"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("bandwidth"); !isEmptyValue(reflect.ValueOf(bandwidthProp)) && (ok || !reflect.DeepEqual(v, bandwidthProp)) {
obj["bandwidth"] = bandwidthProp
}
edgeAvailabilityDomainProp, err := expandComputeInterconnectAttachmentEdgeAvailabilityDomain(d.Get("edge_availability_domain"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -288,6 +301,9 @@ func resourceComputeInterconnectAttachmentRead(d *schema.ResourceData, meta inte
if err := d.Set("description", flattenComputeInterconnectAttachmentDescription(res["description"], d)); err != nil {
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
}
if err := d.Set("bandwidth", flattenComputeInterconnectAttachmentBandwidth(res["bandwidth"], d)); err != nil {
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
}
if err := d.Set("edge_availability_domain", flattenComputeInterconnectAttachmentEdgeAvailabilityDomain(res["edgeAvailabilityDomain"], d)); err != nil {
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
}
Expand Down Expand Up @@ -410,6 +426,10 @@ func flattenComputeInterconnectAttachmentDescription(v interface{}, d *schema.Re
return v
}

func flattenComputeInterconnectAttachmentBandwidth(v interface{}, d *schema.ResourceData) interface{} {
return v
}

func flattenComputeInterconnectAttachmentEdgeAvailabilityDomain(v interface{}, d *schema.ResourceData) interface{} {
return v
}
Expand Down Expand Up @@ -501,6 +521,10 @@ func expandComputeInterconnectAttachmentDescription(v interface{}, d TerraformRe
return v, nil
}

func expandComputeInterconnectAttachmentBandwidth(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputeInterconnectAttachmentEdgeAvailabilityDomain(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/compute_interconnect_attachment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ The following arguments are supported:
(Optional)
An optional description of this resource.

* `bandwidth` -
(Optional)
Provisioned bandwidth capacity for the interconnect attachment.
For attachments of type DEDICATED, the user can set the bandwidth.
For attachments of type PARTNER, the Google Partner that is operating the interconnect must set the bandwidth.
Output only for PARTNER type, mutable for PARTNER_PROVIDER and DEDICATED,
Defaults to BPS_10G

* `edge_availability_domain` -
(Optional)
Desired availability domain for the attachment. Only available for type
Expand Down

0 comments on commit 53b60e1

Please sign in to comment.