Skip to content

Commit

Permalink
Handle decommmissioned services
Browse files Browse the repository at this point in the history
They linger on the API after deletion, so we need to detect that for
terraform to behave as expected.

Signed-off-by: Dimitrios Karagiannis <[email protected]>
  • Loading branch information
alkar committed Oct 10, 2019
1 parent 16b49f1 commit 0736873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions megaport/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const (

Version = "0.1"
UserAgent = "megaport-api-go-client/" + Version

ProductStatusDecommissioned = "DECOMMISSIONED"
)

var (
Expand Down
4 changes: 4 additions & 0 deletions megaport/resource_megaport_private_vxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func resourceMegaportPrivateVxcRead(d *schema.ResourceData, m interface{}) error
d.SetId("")
return nil
}
if p.ProvisioningStatus == api.ProductStatusDecommissioned {
d.SetId("")
return nil
}
d.Set("name", p.ProductName)
d.Set("rate_limit", p.RateLimit)
d.Set("a_end", flattenVxcEnd(p.AEnd))
Expand Down

0 comments on commit 0736873

Please sign in to comment.