Skip to content

Commit

Permalink
Bandwidth addition to interconnect
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
Madankapoor authored and modular-magician committed Aug 20, 2019
1 parent f082bba commit b66185b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
24 changes: 24 additions & 0 deletions google-beta/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
2 changes: 1 addition & 1 deletion website/docs/r/compute_vpn_tunnel.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ The following arguments are supported:

* `peer_gcp_gateway` -
(Optional, [Beta](https://terraform.io/docs/providers/google/provider_versions.html))
URL of the peer side HA GCP VPN gateway to which this VPN tunnel is connected.
URL of the peer side HA GCP VPN gateway to which this VPN tunnel is connected.
If provided, the VPN tunnel will automatically use the same vpn_gateway_interface
ID in the peer GCP VPN gateway.
This field must reference a `google_compute_ha_vpn_gateway` resource.
Expand Down

0 comments on commit b66185b

Please sign in to comment.