diff --git a/google-beta/resource_compute_interconnect_attachment.go b/google-beta/resource_compute_interconnect_attachment.go index d62baa8d55..c77ce5e88f 100644 --- a/google-beta/resource_compute_interconnect_attachment.go +++ b/google-beta/resource_compute_interconnect_attachment.go @@ -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, @@ -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 @@ -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) } @@ -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 } @@ -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 } diff --git a/website/docs/r/compute_interconnect_attachment.html.markdown b/website/docs/r/compute_interconnect_attachment.html.markdown index 4bdad9a4df..ee0a878886 100644 --- a/website/docs/r/compute_interconnect_attachment.html.markdown +++ b/website/docs/r/compute_interconnect_attachment.html.markdown @@ -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