@@ -335,6 +335,12 @@ func resourceCluster() *schema.Resource {
335
335
names .AttrTagsAll : tftags .TagsSchemaComputed (),
336
336
},
337
337
338
+ Timeouts : & schema.ResourceTimeout {
339
+ Create : schema .DefaultTimeout (40 * time .Minute ),
340
+ Update : schema .DefaultTimeout (80 * time .Minute ),
341
+ Delete : schema .DefaultTimeout (40 * time .Minute ),
342
+ },
343
+
338
344
CustomizeDiff : customdiff .Sequence (
339
345
clusterValidateAZMode ,
340
346
customizeDiffValidateClusterEngineVersion ,
@@ -471,10 +477,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta any
471
477
472
478
d .SetId (id )
473
479
474
- const (
475
- timeout = 40 * time .Minute
476
- )
477
- if _ , err := waitCacheClusterAvailable (ctx , conn , d .Id (), timeout ); err != nil {
480
+ if _ , err := waitCacheClusterAvailable (ctx , conn , d .Id (), d .Timeout (schema .TimeoutCreate )); err != nil {
478
481
return sdkdiag .AppendErrorf (diags , "waiting for ElastiCache Cache Cluster (%s) create: %s" , d .Id (), err )
479
482
}
480
483
@@ -702,10 +705,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta any
702
705
return sdkdiag .AppendErrorf (diags , "updating ElastiCache Cache Cluster (%s): %s" , d .Id (), err )
703
706
}
704
707
705
- const (
706
- timeout = 80 * time .Minute
707
- )
708
- if _ , err := waitCacheClusterAvailable (ctx , conn , d .Id (), timeout ); err != nil {
708
+ if _ , err := waitCacheClusterAvailable (ctx , conn , d .Id (), d .Timeout (schema .TimeoutUpdate )); err != nil {
709
709
return sdkdiag .AppendErrorf (diags , "waiting for ElastiCache Cache Cluster (%s) update: %s" , d .Id (), err )
710
710
}
711
711
}
@@ -729,11 +729,7 @@ func resourceClusterDelete(ctx context.Context, d *schema.ResourceData, meta any
729
729
return sdkdiag .AppendErrorf (diags , "deleting ElastiCache Cache Cluster (%s): %s" , d .Id (), err )
730
730
}
731
731
732
- const (
733
- timeout = 40 * time .Minute
734
- )
735
- _ , err = waitCacheClusterDeleted (ctx , conn , d .Id (), timeout )
736
-
732
+ _ , err = waitCacheClusterDeleted (ctx , conn , d .Id (), d .Timeout (schema .TimeoutDelete ))
737
733
if err != nil {
738
734
return sdkdiag .AppendErrorf (diags , "waiting for ElastiCache Cache Cluster (%s) delete: %s" , d .Id (), err )
739
735
}
0 commit comments