Skip to content

Commit

Permalink
Storage: Use configurable timeouts to google_storage_bucket (#5542) (#…
Browse files Browse the repository at this point in the history
…3938)

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Dec 21, 2021
1 parent 9e7d51d commit 294f59e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/5542.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
storage: added configurable read timeout to `google_storage_bucket`
```
8 changes: 7 additions & 1 deletion google-beta/resource_storage_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func resourceStorageBucket() *schema.Resource {
customdiff.ForceNewIfChange("retention_policy.0.is_locked", isPolicyLocked),
),

Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(4 * time.Minute),
Update: schema.DefaultTimeout(4 * time.Minute),
Read: schema.DefaultTimeout(4 * time.Minute),
},

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Expand Down Expand Up @@ -656,7 +662,7 @@ func resourceStorageBucketRead(d *schema.ResourceData, meta interface{}) error {
var retryErr error
res, retryErr = config.NewStorageClient(userAgent).Buckets.Get(bucket).Do()
return retryErr
}, d.Timeout(schema.TimeoutCreate), isNotFoundRetryableError("bucket creation"))
}, d.Timeout(schema.TimeoutRead), isNotFoundRetryableError("bucket read"))

if err != nil {
return handleNotFoundError(err, d, fmt.Sprintf("Storage Bucket %q", d.Get("name").(string)))
Expand Down
9 changes: 9 additions & 0 deletions website/docs/r/storage_bucket.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ exported:

* `url` - The base URL of the bucket, in the format `gs://<bucket-name>`.

## Timeouts

This resource provides the following
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:

- `create` - Default is 4 minutes.
- `update` - Default is 4 minutes.
- `read` - Default is 4 minutes.

## Import

Storage buckets can be imported using the `name` or `project/name`. If the project is not
Expand Down

0 comments on commit 294f59e

Please sign in to comment.