mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Add Private Service Connect endpoint support to GCS backend (#31967)
* Add support for `storage_custom_endpoint` in `gcs` backend * Add documentation for new `storage_custom_endpoint` endpoint * Empty commit to trigger Vercel deployment
This commit is contained in:
@@ -102,6 +102,15 @@ func New() backend.Backend {
|
||||
Description: "A Cloud KMS key ('customer managed encryption key') used when reading and writing state files in the bucket. Format should be 'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}/cryptoKeys/{{name}}'.",
|
||||
ConflictsWith: []string{"encryption_key"},
|
||||
},
|
||||
|
||||
"storage_custom_endpoint": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
|
||||
"GOOGLE_BACKEND_STORAGE_CUSTOM_ENDPOINT",
|
||||
"GOOGLE_STORAGE_CUSTOM_ENDPOINT",
|
||||
}, nil),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -195,6 +204,12 @@ func (b *Backend) configure(ctx context.Context) error {
|
||||
}
|
||||
|
||||
opts = append(opts, option.WithUserAgent(httpclient.UserAgentString()))
|
||||
|
||||
// Custom endpoint for storage API
|
||||
if storageEndpoint, ok := data.GetOk("storage_custom_endpoint"); ok {
|
||||
endpoint := option.WithEndpoint(storageEndpoint.(string))
|
||||
opts = append(opts, endpoint)
|
||||
}
|
||||
client, err := storage.NewClient(b.storageContext, opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("storage.NewClient() failed: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user