mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-01 16:21:06 +00:00
timeout is now passed to operation wait (#3082)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
9b8f72603d
commit
82f0251ce1
@ -18,12 +18,12 @@ func (w *CloudFunctionsOperationWaiter) QueryOp() (interface{}, error) {
|
|||||||
return w.Service.Operations.Get(w.Op.Name).Do()
|
return w.Service.Operations.Get(w.Op.Name).Do()
|
||||||
}
|
}
|
||||||
|
|
||||||
func cloudFunctionsOperationWait(service *cloudfunctions.Service, op *cloudfunctions.Operation, activity string) error {
|
func cloudFunctionsOperationWait(service *cloudfunctions.Service, op *cloudfunctions.Operation, activity string, timeoutMin int) error {
|
||||||
w := &CloudFunctionsOperationWaiter{
|
w := &CloudFunctionsOperationWaiter{
|
||||||
Service: service,
|
Service: service,
|
||||||
}
|
}
|
||||||
if err := w.SetOp(op); err != nil {
|
if err := w.SetOp(op); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return OperationWait(w, activity, 4)
|
return OperationWait(w, activity, timeoutMin)
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,8 @@ func resourceCloudFunctionsCreate(d *schema.ResourceData, meta interface{}) erro
|
|||||||
// Name of function should be unique
|
// Name of function should be unique
|
||||||
d.SetId(cloudFuncId.terraformId())
|
d.SetId(cloudFuncId.terraformId())
|
||||||
|
|
||||||
err = cloudFunctionsOperationWait(config.clientCloudFunctions, op, "Creating CloudFunctions Function")
|
err = cloudFunctionsOperationWait(config.clientCloudFunctions, op, "Creating CloudFunctions Function",
|
||||||
|
int(d.Timeout(schema.TimeoutCreate).Minutes()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -522,8 +523,8 @@ func resourceCloudFunctionsUpdate(d *schema.ResourceData, meta interface{}) erro
|
|||||||
return fmt.Errorf("Error while updating cloudfunction configuration: %s", err)
|
return fmt.Errorf("Error while updating cloudfunction configuration: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = cloudFunctionsOperationWait(config.clientCloudFunctions, op,
|
err = cloudFunctionsOperationWait(config.clientCloudFunctions, op, "Updating CloudFunctions Function",
|
||||||
"Updating CloudFunctions Function")
|
int(d.Timeout(schema.TimeoutUpdate).Minutes()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -545,7 +546,8 @@ func resourceCloudFunctionsDestroy(d *schema.ResourceData, meta interface{}) err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = cloudFunctionsOperationWait(config.clientCloudFunctions, op, "Deleting CloudFunctions Function")
|
err = cloudFunctionsOperationWait(config.clientCloudFunctions, op, "Deleting CloudFunctions Function",
|
||||||
|
int(d.Timeout(schema.TimeoutDelete).Minutes()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,15 @@ exported:
|
|||||||
|
|
||||||
* `region` - Region of function. Currently can be only "us-central1". If it is not provided, the provider region is used.
|
* `region` - Region of function. Currently can be only "us-central1". If it is not provided, the provider region is used.
|
||||||
|
|
||||||
|
## Timeouts
|
||||||
|
|
||||||
|
This resource provides the following
|
||||||
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
||||||
|
|
||||||
|
- `create` - Default is 5 minutes.
|
||||||
|
- `update` - Default is 5 minutes.
|
||||||
|
- `delete` - Default is 5 minutes.
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
Functions can be imported using the `name`, e.g.
|
Functions can be imported using the `name`, e.g.
|
||||||
|
Loading…
Reference in New Issue
Block a user