From 88d92546615a3e53ebe703482fd3048ec88c6851 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Tue, 23 May 2017 19:31:26 +0100 Subject: [PATCH] provider/aws: Add ability to define timeouts for DMS replication instance (#14729) Fixes: #13996 --- .../aws/resource_aws_dms_replication_instance.go | 10 ++++++++-- .../aws/resource_aws_dms_replication_instance_test.go | 4 ++++ .../aws/r/dms_replication_instance.html.markdown | 10 ++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_dms_replication_instance.go b/builtin/providers/aws/resource_aws_dms_replication_instance.go index 2b6948936..f0b0a3aed 100644 --- a/builtin/providers/aws/resource_aws_dms_replication_instance.go +++ b/builtin/providers/aws/resource_aws_dms_replication_instance.go @@ -19,6 +19,12 @@ func resourceAwsDmsReplicationInstance() *schema.Resource { Update: resourceAwsDmsReplicationInstanceUpdate, Delete: resourceAwsDmsReplicationInstanceDelete, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(30 * time.Minute), + Update: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(30 * time.Minute), + }, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -304,7 +310,7 @@ func resourceAwsDmsReplicationInstanceUpdate(d *schema.ResourceData, meta interf Pending: []string{"modifying"}, Target: []string{"available"}, Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta), - Timeout: d.Timeout(schema.TimeoutCreate), + Timeout: d.Timeout(schema.TimeoutUpdate), MinTimeout: 10 * time.Second, Delay: 30 * time.Second, // Wait 30 secs before starting } @@ -339,7 +345,7 @@ func resourceAwsDmsReplicationInstanceDelete(d *schema.ResourceData, meta interf Pending: []string{"deleting"}, Target: []string{}, Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta), - Timeout: d.Timeout(schema.TimeoutCreate), + Timeout: d.Timeout(schema.TimeoutDelete), MinTimeout: 10 * time.Second, Delay: 30 * time.Second, // Wait 30 secs before starting } diff --git a/builtin/providers/aws/resource_aws_dms_replication_instance_test.go b/builtin/providers/aws/resource_aws_dms_replication_instance_test.go index 0cb8a37d5..1b8ddfd3e 100644 --- a/builtin/providers/aws/resource_aws_dms_replication_instance_test.go +++ b/builtin/providers/aws/resource_aws_dms_replication_instance_test.go @@ -139,6 +139,10 @@ resource "aws_dms_replication_instance" "dms_replication_instance" { Update = "to-update" Remove = "to-remove" } + + timeouts { + create = "40m" + } } `, randId) } diff --git a/website/source/docs/providers/aws/r/dms_replication_instance.html.markdown b/website/source/docs/providers/aws/r/dms_replication_instance.html.markdown index c51665817..83e8e2cb5 100644 --- a/website/source/docs/providers/aws/r/dms_replication_instance.html.markdown +++ b/website/source/docs/providers/aws/r/dms_replication_instance.html.markdown @@ -77,6 +77,16 @@ The following attributes are exported: * `replication_instance_private_ips` - A list of the private IP addresses of the replication instance. * `replication_instance_public_ips` - A list of the public IP addresses of the replication instance. + +## Timeouts + +`aws_dms_replication_instance` provides the following +[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: + +- `create` - (Default `30 minutes`) Used for Creating Instances +- `update` - (Default `30 minutes`) Used for Database modifications +- `delete` - (Default `30 minutes`) Used for destroying databases. + ## Import Replication instances can be imported using the `replication_instance_id`, e.g.