Skip to content

Commit 71b36d4

Browse files
Ty Larrabeemodular-magician
Ty Larrabee
authored andcommitted
Add transfer configs
Signed-off-by: Modular Magician <[email protected]>
1 parent 3022649 commit 71b36d4

9 files changed

+789
-19
lines changed

google/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ type Config struct {
7070

7171
AccessContextManagerBasePath string
7272
AppEngineBasePath string
73+
BigqueryDataTransferBasePath string
7374
BinaryAuthorizationBasePath string
7475
CloudBuildBasePath string
7576
CloudSchedulerBasePath string

google/error_retry_predicates.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package google
2+
3+
import (
4+
"strings"
5+
6+
"google.golang.org/api/googleapi"
7+
)
8+
9+
// If a permission necessary to provision a resource is created in the same config
10+
// as the resource itself, the permission may not have propagated by the time terraform
11+
// attempts to create the resource. This allows those errors to be retried until the timeout expires
12+
func iamMemberMissing(err error) (bool, string) {
13+
if gerr, ok := err.(*googleapi.Error); ok {
14+
if gerr.Code == 400 && strings.Contains(gerr.Body, "permission") {
15+
return true, "Waiting for IAM member permissions to propagate."
16+
}
17+
}
18+
return false, ""
19+
}

google/provider.go

+4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func Provider() terraform.ResourceProvider {
100100
// Generated Products
101101
AccessContextManagerCustomEndpointEntryKey: AccessContextManagerCustomEndpointEntry,
102102
AppEngineCustomEndpointEntryKey: AppEngineCustomEndpointEntry,
103+
BigqueryDataTransferCustomEndpointEntryKey: BigqueryDataTransferCustomEndpointEntry,
103104
BinaryAuthorizationCustomEndpointEntryKey: BinaryAuthorizationCustomEndpointEntry,
104105
CloudBuildCustomEndpointEntryKey: CloudBuildCustomEndpointEntry,
105106
CloudSchedulerCustomEndpointEntryKey: CloudSchedulerCustomEndpointEntry,
@@ -213,6 +214,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
213214
return mergeResourceMaps(
214215
GeneratedAccessContextManagerResourcesMap,
215216
GeneratedAppEngineResourcesMap,
217+
GeneratedBigqueryDataTransferResourcesMap,
216218
GeneratedBinaryAuthorizationResourcesMap,
217219
GeneratedCloudBuildResourcesMap,
218220
GeneratedCloudSchedulerResourcesMap,
@@ -384,6 +386,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
384386
// Generated products
385387
config.AccessContextManagerBasePath = d.Get(AccessContextManagerCustomEndpointEntryKey).(string)
386388
config.AppEngineBasePath = d.Get(AppEngineCustomEndpointEntryKey).(string)
389+
config.BigqueryDataTransferBasePath = d.Get(BigqueryDataTransferCustomEndpointEntryKey).(string)
387390
config.BinaryAuthorizationBasePath = d.Get(BinaryAuthorizationCustomEndpointEntryKey).(string)
388391
config.CloudBuildBasePath = d.Get(CloudBuildCustomEndpointEntryKey).(string)
389392
config.CloudSchedulerBasePath = d.Get(CloudSchedulerCustomEndpointEntryKey).(string)
@@ -441,6 +444,7 @@ func ConfigureBasePaths(c *Config) {
441444
// Generated Products
442445
c.AccessContextManagerBasePath = AccessContextManagerDefaultBasePath
443446
c.AppEngineBasePath = AppEngineDefaultBasePath
447+
c.BigqueryDataTransferBasePath = BigqueryDataTransferDefaultBasePath
444448
c.BinaryAuthorizationBasePath = BinaryAuthorizationDefaultBasePath
445449
c.CloudBuildBasePath = CloudBuildDefaultBasePath
446450
c.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package google
16+
17+
import "github.com/hashicorp/terraform/helper/schema"
18+
19+
// If the base path has changed as a result of your PR, make sure to update
20+
// the provider_reference page!
21+
var BigqueryDataTransferDefaultBasePath = "https://bigquerydatatransfer.googleapis.com/v1/"
22+
var BigqueryDataTransferCustomEndpointEntryKey = "bigquery_data_transfer_custom_endpoint"
23+
var BigqueryDataTransferCustomEndpointEntry = &schema.Schema{
24+
Type: schema.TypeString,
25+
Optional: true,
26+
ValidateFunc: validateCustomEndpoint,
27+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
28+
"GOOGLE_BIGQUERY_DATA_TRANSFER_CUSTOM_ENDPOINT",
29+
}, BigqueryDataTransferDefaultBasePath),
30+
}
31+
32+
var GeneratedBigqueryDataTransferResourcesMap = map[string]*schema.Resource{
33+
"google_bigquery_data_transfer_config": resourceBigqueryDataTransferConfig(),
34+
}

0 commit comments

Comments
 (0)