Skip to content

Commit 4bdbd11

Browse files
Make ELB resource timeout configurable with wait_for_ready_timeout #564
1 parent 838d69d commit 4bdbd11

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

aws/resource_aws_elb.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,14 @@ func resourceAwsElb() *schema.Resource {
246246
},
247247

248248
"tags": tagsSchema(),
249+
250+
"wait_for_ready_timeout": {
251+
Type: schema.TypeString,
252+
Optional: true,
253+
Default: "5m",
254+
ValidateFunc: validateDuration,
255+
},
256+
249257
},
250258
}
251259
}
@@ -295,8 +303,13 @@ func resourceAwsElbCreate(d *schema.ResourceData, meta interface{}) error {
295303
elbOpts.Subnets = expandStringList(v.(*schema.Set).List())
296304
}
297305

306+
waitForReadyTimeOut, err := time.ParseDuration(d.Get("wait_for_ready_timeout").(string))
307+
if err != nil {
308+
return err
309+
}
310+
298311
log.Printf("[DEBUG] ELB create configuration: %#v", elbOpts)
299-
err = resource.Retry(5*time.Minute, func() *resource.RetryError {
312+
err = resource.Retry(waitForReadyTimeOut, func() *resource.RetryError {
300313
_, err := elbconn.CreateLoadBalancer(elbOpts)
301314

302315
if err != nil {

website/docs/r/elb.html.markdown

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ The following arguments are supported:
8989
* `connection_draining` - (Optional) Boolean to enable connection draining. Default: `false`
9090
* `connection_draining_timeout` - (Optional) The time in seconds to allow for connections to drain. Default: `300`
9191
* `tags` - (Optional) A mapping of tags to assign to the resource.
92+
* `wait_for_ready_timeout` - (Default: `5m`) The maximum
93+
[duration](https://golang.org/pkg/time/#ParseDuration) that Terraform should
94+
wait for an ELB to be in a ready state before timing out.
9295

9396
Exactly one of `availability_zones` or `subnets` must be specified: this
9497
determines if the ELB exists in a VPC or in EC2-classic.

0 commit comments

Comments
 (0)