Skip to content

Commit

Permalink
adminEnabled on Interconnect Attachments (#1072)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and danawillow committed Aug 20, 2019
1 parent 4fe0f5d commit 9df153a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 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,11 @@ func resourceComputeInterconnectAttachment() *schema.Resource {
ForceNew: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"admin_enabled": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"bandwidth": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -164,6 +169,12 @@ func resourceComputeInterconnectAttachmentCreate(d *schema.ResourceData, meta in
config := meta.(*Config)

obj := make(map[string]interface{})
adminEnabledProp, err := expandComputeInterconnectAttachmentAdminEnabled(d.Get("admin_enabled"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("admin_enabled"); !isEmptyValue(reflect.ValueOf(adminEnabledProp)) && (ok || !reflect.DeepEqual(v, adminEnabledProp)) {
obj["adminEnabled"] = adminEnabledProp
}
interconnectProp, err := expandComputeInterconnectAttachmentInterconnect(d.Get("interconnect"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -289,6 +300,9 @@ func resourceComputeInterconnectAttachmentRead(d *schema.ResourceData, meta inte
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
}

if err := d.Set("admin_enabled", flattenComputeInterconnectAttachmentAdminEnabled(res["adminEnabled"], d)); err != nil {
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
}
if err := d.Set("cloud_router_ip_address", flattenComputeInterconnectAttachmentCloudRouterIpAddress(res["cloudRouterIpAddress"], d)); err != nil {
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
}
Expand Down Expand Up @@ -410,6 +424,10 @@ func resourceComputeInterconnectAttachmentImport(d *schema.ResourceData, meta in
return []*schema.ResourceData{d}, nil
}

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

func flattenComputeInterconnectAttachmentCloudRouterIpAddress(v interface{}, d *schema.ResourceData) interface{} {
return v
}
Expand Down Expand Up @@ -513,6 +531,10 @@ func flattenComputeInterconnectAttachmentRegion(v interface{}, d *schema.Resourc
return ConvertSelfLinkToV1(v.(string))
}

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

func expandComputeInterconnectAttachmentInterconnect(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Expand Down
5 changes: 5 additions & 0 deletions website/docs/r/compute_interconnect_attachment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ The following arguments are supported:
- - -


* `admin_enabled` -
(Optional)
Whether the VLAN attachment is enabled or disabled. When using
PARTNER type this will Pre-Activate the interconnect attachment

* `interconnect` -
(Optional)
URL of the underlying Interconnect object that this attachment's
Expand Down

0 comments on commit 9df153a

Please sign in to comment.