Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adminEnabled on Interconnect Attachments #4300

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions google/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