Skip to content

Commit

Permalink
add has been deleted status
Browse files Browse the repository at this point in the history
  • Loading branch information
runzexia committed Jan 23, 2018
1 parent 993c972 commit 9672630
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions qingcloud/resource_qingcloud_vpc_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,10 @@ func waitRouterLease(d *schema.ResourceData, meta interface{}) error {
WaitForLease(output.RouterSet[0].StatusTime)
return nil
}

func isRouterDeleted(routerSet []*qc.Router) bool {
if len(routerSet) == 0 || qc.StringValue(routerSet[0].Status) == "deleted" || qc.StringValue(routerSet[0].Status) == "ceased" {
return true
}
return false
}
2 changes: 1 addition & 1 deletion qingcloud/resource_qingcloud_vpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func testAccCheckVpcDestroyWithProvider(s *terraform.State, provider *schema.Pro
input.Routers = []*string{qc.String(rs.Primary.ID)}
output, err := client.router.DescribeRouters(input)
if err == nil {
if len(output.RouterSet) != 0 && qc.StringValue(output.RouterSet[0].Status) != "deleted" {
if isRouterDeleted(output.RouterSet) {
return fmt.Errorf("Found Router: %s", rs.Primary.ID)
}
}
Expand Down

0 comments on commit 9672630

Please sign in to comment.