Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Configure bucket read timeout
Browse files Browse the repository at this point in the history
Fixes #12

Signed-off-by: Hasan Turken <turkenh@gmail.com>
  • Loading branch information
turkenh committed Apr 21, 2022
1 parent 2d5e5be commit 51a50aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 9 additions & 0 deletions config/storage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package storage
import (
"context"
"path/filepath"
"time"

"github.com/crossplane/terrajet/pkg/config"

Expand All @@ -28,5 +29,13 @@ func Configure(p *config.Provider) {
project, err := common.GetField(providerConfig, common.KeyProject)
return filepath.Join(project, externalName), err
}
// Note(turkenh): Terraform provider added retries to bucket resource
// for eventual consistency: https://github.com/hashicorp/terraform-provider-google/pull/10287
// However, this causes refresh to keep retrying until timeout if the
// bucket does not exist indeed. This causes the initial observe call to
// hang on until timeout. We configure read timeout to a relatively
// smaller value as a workaround/solution.
// Related issue: https://github.com/crossplane-contrib/provider-jet-gcp/issues/12
r.OperationTimeouts.Read = 1 * time.Minute
})
}
6 changes: 0 additions & 6 deletions examples/storage/bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ metadata:
# Note that this will be the actual bucket name, so it has to be globally
# unique/available.
crossplane.io/external-name: crossplane-example-bucket
# This annotation is a workaround for the following bug which sets
# create/read timeouts to 1 min:
# "https://github.com/crossplane-contrib/provider-jet-gcp/issues/12
# "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0" is the TimeoutKey:
# https://github.com/hashicorp/terraform-plugin-sdk/blob/112e2164c381d80e8ada3170dac9a8a5db01079a/helper/schema/resource_timeout.go#L14
terrajet.crossplane.io/provider-meta: '{"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0":{"create":60000000000,"read":60000000000}}'
spec:
forProvider:
location: US
Expand Down

0 comments on commit 51a50aa

Please sign in to comment.