diff --git a/.changelog/29635.txt b/.changelog/29635.txt new file mode 100644 index 00000000000..331d79f483e --- /dev/null +++ b/.changelog/29635.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_qldb_ledger: Add configurable timeouts +``` \ No newline at end of file diff --git a/internal/service/qldb/ledger.go b/internal/service/qldb/ledger.go index 3072ead9910..9ebde64740c 100644 --- a/internal/service/qldb/ledger.go +++ b/internal/service/qldb/ledger.go @@ -32,6 +32,11 @@ func ResourceLedger() *schema.Resource { StateContext: schema.ImportStatePassthroughContext, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ "arn": { Type: schema.TypeString, @@ -100,7 +105,7 @@ func resourceLedgerCreate(ctx context.Context, d *schema.ResourceData, meta inte d.SetId(aws.StringValue(output.Name)) - if _, err := waitLedgerCreated(ctx, conn, d.Id()); err != nil { + if _, err := waitLedgerCreated(ctx, conn, d.Timeout(schema.TimeoutCreate), d.Id()); err != nil { return diag.Errorf("waiting for QLDB Ledger (%s) create: %s", d.Id(), err) } @@ -217,7 +222,7 @@ func resourceLedgerDelete(ctx context.Context, d *schema.ResourceData, meta inte return diag.Errorf("deleting QLDB Ledger (%s): %s", d.Id(), err) } - if _, err := waitLedgerDeleted(ctx, conn, d.Id()); err != nil { + if _, err := waitLedgerDeleted(ctx, conn, d.Timeout(schema.TimeoutDelete), d.Id()); err != nil { return diag.Errorf("waiting for QLDB Ledger (%s) delete: %s", d.Id(), err) } @@ -272,12 +277,12 @@ func statusLedgerState(ctx context.Context, conn *qldb.QLDB, name string) resour } } -func waitLedgerCreated(ctx context.Context, conn *qldb.QLDB, name string) (*qldb.DescribeLedgerOutput, error) { +func waitLedgerCreated(ctx context.Context, conn *qldb.QLDB, timeout time.Duration, name string) (*qldb.DescribeLedgerOutput, error) { stateConf := &resource.StateChangeConf{ Pending: []string{qldb.LedgerStateCreating}, Target: []string{qldb.LedgerStateActive}, Refresh: statusLedgerState(ctx, conn, name), - Timeout: 8 * time.Minute, + Timeout: timeout, MinTimeout: 3 * time.Second, } @@ -290,12 +295,12 @@ func waitLedgerCreated(ctx context.Context, conn *qldb.QLDB, name string) (*qldb return nil, err } -func waitLedgerDeleted(ctx context.Context, conn *qldb.QLDB, name string) (*qldb.DescribeLedgerOutput, error) { +func waitLedgerDeleted(ctx context.Context, conn *qldb.QLDB, timeout time.Duration, name string) (*qldb.DescribeLedgerOutput, error) { stateConf := &resource.StateChangeConf{ Pending: []string{qldb.LedgerStateActive, qldb.LedgerStateDeleting}, Target: []string{}, Refresh: statusLedgerState(ctx, conn, name), - Timeout: 5 * time.Minute, + Timeout: timeout, MinTimeout: 1 * time.Second, } diff --git a/website/docs/r/qldb_ledger.html.markdown b/website/docs/r/qldb_ledger.html.markdown index c11202963de..8b6c2e3e559 100644 --- a/website/docs/r/qldb_ledger.html.markdown +++ b/website/docs/r/qldb_ledger.html.markdown @@ -39,6 +39,13 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The ARN of the QLDB Ledger * `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +- `create` - (Default `10m`) +- `delete` - (Default `10m`) + ## Import QLDB Ledgers can be imported using the `name`, e.g., diff --git a/website/docs/r/rds_cluster_activity_stream.html.markdown b/website/docs/r/rds_cluster_activity_stream.html.markdown index 852207cff65..37f6726de57 100644 --- a/website/docs/r/rds_cluster_activity_stream.html.markdown +++ b/website/docs/r/rds_cluster_activity_stream.html.markdown @@ -14,7 +14,7 @@ Database Activity Streams have some limits and requirements, refer to the [Monit ~> **Note:** This resource always calls the RDS [`StartActivityStream`][2] API with the `ApplyImmediately` parameter set to `true`. This is because the Terraform needs the activity stream to be started in order for it to get the associated attributes. -~> **Note:** This resource depends on having at least one `aws_rds_cluster_instance` created. To avoid race conditions when all resources are being created together, add an explicit resource reference using the [resource `depends_on` meta-argument](/docs/configuration/resources.html#depends_on-explicit-resource-dependencies). +~> **Note:** This resource depends on having at least one `aws_rds_cluster_instance` created. To avoid race conditions when all resources are being created together, add an explicit resource reference using the [resource `depends_on` meta-argument](https://www.terraform.io/docs/configuration/resources.html#depends_on-explicit-resource-dependencies). ~> **Note:** This resource is available in all regions except the following: `cn-north-1`, `cn-northwest-1`, `us-gov-east-1`, `us-gov-west-1`