provider/aws: Add ability to define timeouts for DMS replication instance (#14729)

Fixes: #13996
This commit is contained in:
Paul Stack 2017-05-23 19:31:26 +01:00 committed by GitHub
parent 346d34c383
commit 88d9254661
3 changed files with 22 additions and 2 deletions

View File

@ -19,6 +19,12 @@ func resourceAwsDmsReplicationInstance() *schema.Resource {
Update: resourceAwsDmsReplicationInstanceUpdate, Update: resourceAwsDmsReplicationInstanceUpdate,
Delete: resourceAwsDmsReplicationInstanceDelete, 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{ Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough, State: schema.ImportStatePassthrough,
}, },
@ -304,7 +310,7 @@ func resourceAwsDmsReplicationInstanceUpdate(d *schema.ResourceData, meta interf
Pending: []string{"modifying"}, Pending: []string{"modifying"},
Target: []string{"available"}, Target: []string{"available"},
Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta), Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta),
Timeout: d.Timeout(schema.TimeoutCreate), Timeout: d.Timeout(schema.TimeoutUpdate),
MinTimeout: 10 * time.Second, MinTimeout: 10 * time.Second,
Delay: 30 * time.Second, // Wait 30 secs before starting Delay: 30 * time.Second, // Wait 30 secs before starting
} }
@ -339,7 +345,7 @@ func resourceAwsDmsReplicationInstanceDelete(d *schema.ResourceData, meta interf
Pending: []string{"deleting"}, Pending: []string{"deleting"},
Target: []string{}, Target: []string{},
Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta), Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta),
Timeout: d.Timeout(schema.TimeoutCreate), Timeout: d.Timeout(schema.TimeoutDelete),
MinTimeout: 10 * time.Second, MinTimeout: 10 * time.Second,
Delay: 30 * time.Second, // Wait 30 secs before starting Delay: 30 * time.Second, // Wait 30 secs before starting
} }

View File

@ -139,6 +139,10 @@ resource "aws_dms_replication_instance" "dms_replication_instance" {
Update = "to-update" Update = "to-update"
Remove = "to-remove" Remove = "to-remove"
} }
timeouts {
create = "40m"
}
} }
`, randId) `, randId)
} }

View File

@ -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_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. * `replication_instance_public_ips` - A list of the public IP addresses of the replication instance.
<a id="timeouts"></a>
## 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 ## Import
Replication instances can be imported using the `replication_instance_id`, e.g. Replication instances can be imported using the `replication_instance_id`, e.g.