Skip to content

Commit

Permalink
Add support for timeouts on the machine resource.
Browse files Browse the repository at this point in the history
This adds create, update, and delete timeouts.
They are part of the base terraform operation.  Kinda cool.
Who knew?

Anyway, only create is used.  It is the only thing that iterates
through a timeout situation.  The other operations should all be
"quick" DRP API calls.
  • Loading branch information
galthaus committed Jun 13, 2018
1 parent 01f6986 commit e8184d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drp/resource_drp_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ func resourceMachine() *schema.Resource {
r.Update = resourceMachineUpdate
r.Delete = resourceMachineDelete

r.Timeouts = &schema.ResourceTimeout{
Create: schema.DefaultTimeout(25 * time.Minute),
Update: schema.DefaultTimeout(10 * time.Minute),
Delete: schema.DefaultTimeout(10 * time.Minute),
}

// Define what the machines completion stage.
r.Schema["completion_stage"] = &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -325,7 +331,7 @@ func resourceMachineCreate(d *schema.ResourceData, meta interface{}) error {
Pending: []string{"9:"},
Target: []string{"6:"},
Refresh: getMachineStatus(cc, machineObj.UUID(), stages),
Timeout: 25 * time.Minute,
Timeout: d.Timeout(schema.TimeoutCreate),
Delay: 10 * time.Second,
MinTimeout: 3 * time.Second,
}
Expand Down

0 comments on commit e8184d3

Please sign in to comment.