Skip to content

Commit

Permalink
Add transfer configs (#975)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and Ty Larrabee committed Aug 13, 2019
1 parent d9e585c commit 2a6f9fe
Show file tree
Hide file tree
Showing 9 changed files with 789 additions and 19 deletions.
1 change: 1 addition & 0 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type Config struct {

AccessContextManagerBasePath string
AppEngineBasePath string
BigqueryDataTransferBasePath string
BinaryAuthorizationBasePath string
CloudBuildBasePath string
CloudRunBasePath string
Expand Down
19 changes: 19 additions & 0 deletions google-beta/error_retry_predicates.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package google

import (
"strings"

"google.golang.org/api/googleapi"
)

// If a permission necessary to provision a resource is created in the same config
// as the resource itself, the permission may not have propagated by the time terraform
// attempts to create the resource. This allows those errors to be retried until the timeout expires
func iamMemberMissing(err error) (bool, string) {
if gerr, ok := err.(*googleapi.Error); ok {
if gerr.Code == 400 && strings.Contains(gerr.Body, "permission") {
return true, "Waiting for IAM member permissions to propagate."
}
}
return false, ""
}
4 changes: 4 additions & 0 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func Provider() terraform.ResourceProvider {
// Generated Products
AccessContextManagerCustomEndpointEntryKey: AccessContextManagerCustomEndpointEntry,
AppEngineCustomEndpointEntryKey: AppEngineCustomEndpointEntry,
BigqueryDataTransferCustomEndpointEntryKey: BigqueryDataTransferCustomEndpointEntry,
BinaryAuthorizationCustomEndpointEntryKey: BinaryAuthorizationCustomEndpointEntry,
CloudBuildCustomEndpointEntryKey: CloudBuildCustomEndpointEntry,
CloudRunCustomEndpointEntryKey: CloudRunCustomEndpointEntry,
Expand Down Expand Up @@ -221,6 +222,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
return mergeResourceMaps(
GeneratedAccessContextManagerResourcesMap,
GeneratedAppEngineResourcesMap,
GeneratedBigqueryDataTransferResourcesMap,
GeneratedBinaryAuthorizationResourcesMap,
GeneratedCloudBuildResourcesMap,
GeneratedCloudRunResourcesMap,
Expand Down Expand Up @@ -412,6 +414,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
// Generated products
config.AccessContextManagerBasePath = d.Get(AccessContextManagerCustomEndpointEntryKey).(string)
config.AppEngineBasePath = d.Get(AppEngineCustomEndpointEntryKey).(string)
config.BigqueryDataTransferBasePath = d.Get(BigqueryDataTransferCustomEndpointEntryKey).(string)
config.BinaryAuthorizationBasePath = d.Get(BinaryAuthorizationCustomEndpointEntryKey).(string)
config.CloudBuildBasePath = d.Get(CloudBuildCustomEndpointEntryKey).(string)
config.CloudRunBasePath = d.Get(CloudRunCustomEndpointEntryKey).(string)
Expand Down Expand Up @@ -475,6 +478,7 @@ func ConfigureBasePaths(c *Config) {
// Generated Products
c.AccessContextManagerBasePath = AccessContextManagerDefaultBasePath
c.AppEngineBasePath = AppEngineDefaultBasePath
c.BigqueryDataTransferBasePath = BigqueryDataTransferDefaultBasePath
c.BinaryAuthorizationBasePath = BinaryAuthorizationDefaultBasePath
c.CloudBuildBasePath = CloudBuildDefaultBasePath
c.CloudRunBasePath = CloudRunDefaultBasePath
Expand Down
34 changes: 34 additions & 0 deletions google-beta/provider_bigquery_data_transfer_gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------

package google

import "github.com/hashicorp/terraform/helper/schema"

// If the base path has changed as a result of your PR, make sure to update
// the provider_reference page!
var BigqueryDataTransferDefaultBasePath = "https://bigquerydatatransfer.googleapis.com/v1/"
var BigqueryDataTransferCustomEndpointEntryKey = "bigquery_data_transfer_custom_endpoint"
var BigqueryDataTransferCustomEndpointEntry = &schema.Schema{
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_BIGQUERY_DATA_TRANSFER_CUSTOM_ENDPOINT",
}, BigqueryDataTransferDefaultBasePath),
}

var GeneratedBigqueryDataTransferResourcesMap = map[string]*schema.Resource{
"google_bigquery_data_transfer_config": resourceBigqueryDataTransferConfig(),
}
Loading

0 comments on commit 2a6f9fe

Please sign in to comment.