Skip to content

Commit

Permalink
Merge branch 'rm-port-associated-vxc'
Browse files Browse the repository at this point in the history
  • Loading branch information
alkar committed Jan 31, 2020
2 parents 193ea49 + de1e257 commit f1fbcac
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
26 changes: 0 additions & 26 deletions megaport/resource_megaport_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ func resourceMegaportPort() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"associated_vxcs": {
Type: schema.TypeSet,
Computed: true,
Elem: resourceMegaportPrivateVxc(),
Set: schema.HashResource(resourceMegaportPrivateVxc()),
},
"marketplace_visibility": resourceAttributePrivatePublic(),
},
}
Expand Down Expand Up @@ -79,9 +73,6 @@ func resourceMegaportPortRead(d *schema.ResourceData, m interface{}) error {
if err := d.Set("invoice_reference", p.CostCentre); err != nil {
return err
}
if err := d.Set("associated_vxcs", schema.NewSet(schema.HashResource(resourceMegaportPrivateVxc()), flattenVxcList(p.AssociatedVxcs))); err != nil {
return err
}
if err := d.Set("marketplace_visibility", "private"); err != nil {
return err
}
Expand Down Expand Up @@ -134,20 +125,3 @@ func resourceMegaportPortDelete(d *schema.ResourceData, m interface{}) error {
}
return nil
}

func flattenVxc(v api.ProductAssociatedVxc) interface{} {
return map[string]interface{}{
"name": v.ProductName,
"rate_limit": int(v.RateLimit),
"a_end": flattenVxcEnd(v.AEnd),
"b_end": flattenVxcEnd(v.BEnd),
}
}

func flattenVxcList(vs []api.ProductAssociatedVxc) []interface{} {
ret := make([]interface{}, len(vs))
for i, v := range vs {
ret[i] = flattenVxc(v)
}
return ret
}
3 changes: 0 additions & 3 deletions megaport/resource_megaport_port_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestAccMegaportPort_basic(t *testing.T) {
resource.TestCheckResourceAttr("megaport_port.foo", "term", "1"),
resource.TestCheckResourceAttrPair("megaport_port.foo", "location_id", "data.megaport_location.foo", "id"),
resource.TestCheckResourceAttr("megaport_port.foo", "invoice_reference", ""),
resource.TestCheckNoResourceAttr("megaport_port.foo", "associated_vxcs"),
resource.TestCheckResourceAttr("megaport_port.foo", "marketplace_visibility", "private"),
),
},
Expand All @@ -89,7 +88,6 @@ func TestAccMegaportPort_basic(t *testing.T) {
resource.TestCheckResourceAttr("megaport_port.foo", "term", "1"),
resource.TestCheckResourceAttrPair("megaport_port.foo", "location_id", "data.megaport_location.foo", "id"),
resource.TestCheckResourceAttr("megaport_port.foo", "invoice_reference", rName),
resource.TestCheckNoResourceAttr("megaport_port.foo", "associated_vxcs"),
resource.TestCheckResourceAttr("megaport_port.foo", "marketplace_visibility", "public"),
),
},
Expand All @@ -103,7 +101,6 @@ func TestAccMegaportPort_basic(t *testing.T) {
resource.TestCheckResourceAttr("megaport_port.foo", "term", "12"),
resource.TestCheckResourceAttrPair("megaport_port.foo", "location_id", "data.megaport_location.foo", "id"),
resource.TestCheckResourceAttr("megaport_port.foo", "invoice_reference", rName),
resource.TestCheckNoResourceAttr("megaport_port.foo", "associated_vxcs"),
resource.TestCheckResourceAttr("megaport_port.foo", "marketplace_visibility", "public"),
),
},
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/port.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ will be listed on the Megaport Marketplace.
In addition to all arguments above, the following attributes are exported:

* `id` - The unique product id of the port.
* `associated_vxcs` - A list of all the VXCs associated with this port.

0 comments on commit f1fbcac

Please sign in to comment.