cmd/terraform provider: fix build
This commit is contained in:
parent
1ccc27adf7
commit
877ea527ab
|
@ -28,9 +28,9 @@ func routeResource() *schema.Resource {
|
|||
}
|
||||
|
||||
func resourceRouteCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
cli := meta.(*proto.RoutesClient)
|
||||
cli := meta.(proto.RoutesClient)
|
||||
|
||||
rt, err := rc.Put(context.Background(), &proto.Route{
|
||||
rt, err := cli.Put(context.Background(), &proto.Route{
|
||||
Host: d.Get("domain").(string),
|
||||
})
|
||||
|
||||
|
@ -38,38 +38,38 @@ func resourceRouteCreate(d *schema.ResourceData, meta interface{}) error {
|
|||
return err
|
||||
}
|
||||
|
||||
log.Printf("[INFO] created route for domain %s with ID %s", rt.Domain, r.Id)
|
||||
log.Printf("[INFO] created route for host %s with ID %s", rt.Host, rt.Id)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceRouteDelete(d *schema.ResourceData, meta interface{}) error {
|
||||
cli := meta.(*proto.RoutesClient)
|
||||
cli := meta.(proto.RoutesClient)
|
||||
|
||||
rt, err := cli.Get(context.Background(), &proto.GetRouteRequest{Id: d.Id()})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = cli.Delete(context.Background(), rt)
|
||||
_, err = cli.Delete(context.Background(), rt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("[INFO] deleted route for domain %s with ID %s", rt.Domain, r.Id)
|
||||
log.Printf("[INFO] deleted route for host %s with ID %s", rt.Host, rt.Id)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceRouteRead(d *schema.ResourceData, meta interface{}) error {
|
||||
cli := meta.(*proto.RoutesClient)
|
||||
cli := meta.(proto.RoutesClient)
|
||||
|
||||
rt, err := cli.Get(context.Background(), &proto.GetRouteRequest{Id: d.Id()})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetId(r.Id)
|
||||
d.SetId(rt.Id)
|
||||
d.Set("host", rt.Host)
|
||||
d.Set("creator", rt.Creator)
|
||||
|
||||
|
|
Loading…
Reference in New Issue