From c8e0416ce8447ebb61c5f11f93592b0004008f8d Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Tue, 11 Jun 2019 22:49:11 +0000 Subject: [PATCH] Allow overriding the base path for a URL with custom endpoints Signed-off-by: Modular Magician --- google-beta/config.go | 281 ++++++++++++++---- ...a_source_google_composer_image_versions.go | 2 +- .../data_source_tpu_tensorflow_versions.go | 2 +- google-beta/gcp_sweeper_test.go | 2 + google-beta/provider.go | 143 +++++++++ .../provider_access_context_manager_gen.go | 13 + google-beta/provider_app_engine_gen.go | 13 + .../provider_binary_authorization_gen.go | 13 + google-beta/provider_cloud_build_gen.go | 13 + google-beta/provider_cloud_scheduler_gen.go | 13 + google-beta/provider_compute_gen.go | 13 + .../provider_container_analysis_gen.go | 13 + google-beta/provider_dns_gen.go | 13 + google-beta/provider_filestore_gen.go | 13 + google-beta/provider_firestore_gen.go | 13 + google-beta/provider_handwritten_endpoint.go | 233 +++++++++++++++ google-beta/provider_kms_gen.go | 13 + google-beta/provider_logging_gen.go | 13 + google-beta/provider_monitoring_gen.go | 13 + google-beta/provider_pubsub_gen.go | 13 + google-beta/provider_redis_gen.go | 13 + google-beta/provider_resource_manager_gen.go | 13 + google-beta/provider_security_scanner_gen.go | 13 + google-beta/provider_source_repo_gen.go | 13 + google-beta/provider_spanner_gen.go | 13 + google-beta/provider_sql_gen.go | 13 + google-beta/provider_storage_gen.go | 13 + google-beta/provider_test.go | 50 ++++ google-beta/provider_tpu_gen.go | 13 + ...rce_access_context_manager_access_level.go | 8 +- ...ccess_context_manager_access_level_test.go | 2 +- ...ce_access_context_manager_access_policy.go | 8 +- ...cess_context_manager_access_policy_test.go | 2 +- ...ccess_context_manager_service_perimeter.go | 8 +- ..._context_manager_service_perimeter_test.go | 2 +- .../resource_app_engine_firewall_rule.go | 8 +- ...app_engine_firewall_rule_generated_test.go | 2 +- .../resource_binary_authorization_attestor.go | 8 +- .../resource_binary_authorization_policy.go | 8 +- google-beta/resource_cloud_build_trigger.go | 8 +- ...urce_cloud_build_trigger_generated_test.go | 2 +- google-beta/resource_cloud_scheduler_job.go | 6 +- ...urce_cloud_scheduler_job_generated_test.go | 2 +- google-beta/resource_compute_address.go | 10 +- ...resource_compute_address_generated_test.go | 2 +- google-beta/resource_compute_autoscaler.go | 8 +- ...ource_compute_autoscaler_generated_test.go | 2 +- .../resource_compute_backend_bucket.go | 8 +- ...e_compute_backend_bucket_generated_test.go | 2 +- ...e_compute_backend_bucket_signed_url_key.go | 6 +- ...pute_backend_bucket_signed_url_key_test.go | 2 +- .../resource_compute_backend_service.go | 8 +- ..._compute_backend_service_generated_test.go | 2 +- ..._compute_backend_service_signed_url_key.go | 6 +- ...ute_backend_service_signed_url_key_test.go | 2 +- google-beta/resource_compute_disk.go | 10 +- .../resource_compute_disk_generated_test.go | 2 +- google-beta/resource_compute_firewall.go | 8 +- ...esource_compute_firewall_generated_test.go | 2 +- .../resource_compute_forwarding_rule.go | 20 +- ..._compute_forwarding_rule_generated_test.go | 2 +- .../resource_compute_global_address.go | 10 +- ...e_compute_global_address_generated_test.go | 2 +- ...resource_compute_global_forwarding_rule.go | 12 +- ...e_global_forwarding_rule_generated_test.go | 2 +- .../resource_compute_ha_vpn_gateway.go | 6 +- ...e_compute_ha_vpn_gateway_generated_test.go | 2 +- google-beta/resource_compute_health_check.go | 8 +- ...rce_compute_health_check_generated_test.go | 2 +- .../resource_compute_http_health_check.go | 8 +- ...ompute_http_health_check_generated_test.go | 2 +- .../resource_compute_https_health_check.go | 8 +- ...mpute_https_health_check_generated_test.go | 2 +- google-beta/resource_compute_image.go | 8 +- .../resource_compute_image_generated_test.go | 2 +- ...esource_compute_interconnect_attachment.go | 6 +- ...esource_compute_managed_ssl_certificate.go | 6 +- ..._managed_ssl_certificate_generated_test.go | 2 +- google-beta/resource_compute_network.go | 8 +- .../resource_compute_network_endpoint.go | 6 +- ...resource_compute_network_endpoint_group.go | 6 +- ...e_network_endpoint_group_generated_test.go | 2 +- ...resource_compute_network_generated_test.go | 2 +- google-beta/resource_compute_node_group.go | 8 +- ...ource_compute_node_group_generated_test.go | 2 +- google-beta/resource_compute_node_template.go | 6 +- ...ce_compute_node_template_generated_test.go | 2 +- .../resource_compute_region_autoscaler.go | 8 +- ...ompute_region_autoscaler_generated_test.go | 2 +- ...resource_compute_region_backend_service.go | 8 +- ...e_region_backend_service_generated_test.go | 2 +- google-beta/resource_compute_region_disk.go | 10 +- ...urce_compute_region_disk_generated_test.go | 2 +- .../resource_compute_resource_policy.go | 6 +- ..._compute_resource_policy_generated_test.go | 2 +- google-beta/resource_compute_route.go | 6 +- .../resource_compute_route_generated_test.go | 2 +- google-beta/resource_compute_router.go | 8 +- .../resource_compute_router_generated_test.go | 2 +- google-beta/resource_compute_snapshot.go | 8 +- ...esource_compute_snapshot_generated_test.go | 2 +- .../resource_compute_ssl_certificate.go | 6 +- ..._compute_ssl_certificate_generated_test.go | 2 +- google-beta/resource_compute_ssl_policy.go | 8 +- ...ource_compute_ssl_policy_generated_test.go | 2 +- google-beta/resource_compute_subnetwork.go | 12 +- ...ource_compute_subnetwork_generated_test.go | 2 +- .../resource_compute_target_http_proxy.go | 8 +- ...ompute_target_http_proxy_generated_test.go | 2 +- .../resource_compute_target_https_proxy.go | 14 +- ...mpute_target_https_proxy_generated_test.go | 2 +- .../resource_compute_target_instance.go | 10 +- ..._compute_target_instance_generated_test.go | 2 +- .../resource_compute_target_ssl_proxy.go | 14 +- ...compute_target_ssl_proxy_generated_test.go | 2 +- .../resource_compute_target_tcp_proxy.go | 10 +- ...compute_target_tcp_proxy_generated_test.go | 2 +- google-beta/resource_compute_url_map.go | 8 +- ...resource_compute_url_map_generated_test.go | 2 +- google-beta/resource_compute_vpn_gateway.go | 6 +- ...urce_compute_vpn_gateway_generated_test.go | 2 +- google-beta/resource_compute_vpn_tunnel.go | 10 +- ...ource_compute_vpn_tunnel_generated_test.go | 2 +- .../resource_container_analysis_note.go | 8 +- ..._container_analysis_note_generated_test.go | 2 +- google-beta/resource_dns_managed_zone.go | 8 +- ...esource_dns_managed_zone_generated_test.go | 2 +- google-beta/resource_dns_policy.go | 10 +- .../resource_dns_policy_generated_test.go | 2 +- google-beta/resource_filestore_instance.go | 8 +- ...ource_filestore_instance_generated_test.go | 2 +- google-beta/resource_firestore_index.go | 6 +- ...resource_firestore_index_generated_test.go | 2 +- google-beta/resource_kms_key_ring.go | 4 +- google-beta/resource_logging_metric.go | 8 +- .../resource_logging_metric_generated_test.go | 2 +- .../resource_monitoring_alert_policy.go | 8 +- ..._monitoring_alert_policy_generated_test.go | 2 +- google-beta/resource_monitoring_group.go | 8 +- ...esource_monitoring_group_generated_test.go | 2 +- ...esource_monitoring_notification_channel.go | 8 +- ...ing_notification_channel_generated_test.go | 2 +- ...resource_monitoring_uptime_check_config.go | 8 +- ...ring_uptime_check_config_generated_test.go | 2 +- google-beta/resource_pubsub_subscription.go | 8 +- ...urce_pubsub_subscription_generated_test.go | 2 +- google-beta/resource_pubsub_topic.go | 6 +- .../resource_pubsub_topic_generated_test.go | 2 +- google-beta/resource_redis_instance.go | 8 +- .../resource_redis_instance_generated_test.go | 2 +- google-beta/resource_resource_manager_lien.go | 8 +- .../resource_security_scanner_scan_config.go | 8 +- ...rity_scanner_scan_config_generated_test.go | 2 +- .../resource_source_repo_repository.go | 6 +- ...e_source_repo_repository_generated_test.go | 2 +- google-beta/resource_spanner_database.go | 6 +- ...esource_spanner_database_generated_test.go | 2 +- google-beta/resource_spanner_instance.go | 8 +- ...esource_spanner_instance_generated_test.go | 2 +- google-beta/resource_sql_database.go | 8 +- ...e_storage_default_object_access_control.go | 8 +- ...lt_object_access_control_generated_test.go | 2 +- .../resource_storage_object_access_control.go | 8 +- ...ge_object_access_control_generated_test.go | 2 +- google-beta/resource_tpu_node.go | 8 +- .../resource_tpu_node_generated_test.go | 2 +- google-beta/transport.go | 9 + website/docs/provider_reference.html.markdown | 75 +++++ 168 files changed, 1374 insertions(+), 425 deletions(-) create mode 100644 google-beta/provider_handwritten_endpoint.go diff --git a/google-beta/config.go b/google-beta/config.go index a91b6a3373..fd717a63fa 100644 --- a/google-beta/config.go +++ b/google-beta/config.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "net/http" + "regexp" "time" "github.com/hashicorp/terraform/helper/logging" @@ -65,39 +66,112 @@ type Config struct { tokenSource oauth2.TokenSource - clientBilling *cloudbilling.APIService - clientBuild *cloudbuild.Service - clientComposer *composer.Service - clientCompute *compute.Service - clientComputeBeta *computeBeta.Service - clientContainer *container.Service - clientContainerBeta *containerBeta.Service - clientDataproc *dataproc.Service - clientDataflow *dataflow.Service - clientDns *dns.Service - clientDnsBeta *dnsBeta.Service - clientFilestore *file.Service - clientIamCredentials *iamcredentials.Service - clientKms *cloudkms.Service - clientLogging *cloudlogging.Service - clientPubsub *pubsub.Service - clientResourceManager *cloudresourcemanager.Service - clientResourceManagerV2Beta1 *resourceManagerV2Beta1.Service - clientRuntimeconfig *runtimeconfig.Service - clientSpanner *spanner.Service - clientSourceRepo *sourcerepo.Service - clientStorage *storage.Service - clientSqlAdmin *sqladmin.Service - clientIAM *iam.Service - clientIAP *iap.Service - clientServiceMan *servicemanagement.APIService - clientServiceUsage *serviceusage.Service - clientBigQuery *bigquery.Service - clientCloudFunctions *cloudfunctions.Service - clientCloudIoT *cloudiot.Service - clientAppEngine *appengine.APIService - clientServiceNetworking *servicenetworking.APIService - clientStorageTransfer *storagetransfer.Service + BinaryAuthorizationBasePath string + ContainerAnalysisBasePath string + SecurityScannerBasePath string + + AccessContextManagerBasePath string + CloudSchedulerBasePath string + FirestoreBasePath string + + CloudBillingBasePath string + clientBilling *cloudbilling.APIService + + CloudBuildBasePath string + clientBuild *cloudbuild.Service + + ComposerBasePath string + clientComposer *composer.Service + + ComputeBasePath string + clientCompute *compute.Service + + ComputeBetaBasePath string + clientComputeBeta *computeBeta.Service + + ContainerBasePath string + clientContainer *container.Service + + ContainerBetaBasePath string + clientContainerBeta *containerBeta.Service + + DataprocBasePath string + clientDataproc *dataproc.Service + + DataflowBasePath string + clientDataflow *dataflow.Service + + DnsBasePath string + clientDns *dns.Service + + DnsBetaBasePath string + clientDnsBeta *dnsBeta.Service + + FilestoreBasePath string + clientFilestore *file.Service + + IamCredentialsBasePath string + clientIamCredentials *iamcredentials.Service + + KmsBasePath string + clientKms *cloudkms.Service + + LoggingBasePath string + clientLogging *cloudlogging.Service + + PubsubBasePath string + clientPubsub *pubsub.Service + + ResourceManagerBasePath string + clientResourceManager *cloudresourcemanager.Service + + ResourceManagerV2Beta1BasePath string + clientResourceManagerV2Beta1 *resourceManagerV2Beta1.Service + + RuntimeconfigBasePath string + clientRuntimeconfig *runtimeconfig.Service + + SpannerBasePath string + clientSpanner *spanner.Service + + SourceRepoBasePath string + clientSourceRepo *sourcerepo.Service + + StorageBasePath string + clientStorage *storage.Service + + SqlBasePath string + clientSqlAdmin *sqladmin.Service + + IAMBasePath string + clientIAM *iam.Service + + IAPBasePath string + clientIAP *iap.Service + + ServiceManagementBasePath string + clientServiceMan *servicemanagement.APIService + + ServiceUsageBasePath string + clientServiceUsage *serviceusage.Service + + BigQueryBasePath string + clientBigQuery *bigquery.Service + + CloudFunctionsBasePath string + clientCloudFunctions *cloudfunctions.Service + + CloudIoTBasePath string + clientCloudIoT *cloudiot.Service + + AppEngineBasePath string + clientAppEngine *appengine.APIService + + ServiceNetworkingBasePath string + clientServiceNetworking *servicenetworking.APIService + + StorageTransferBasePath string + clientStorageTransfer *storagetransfer.Service bigtableClientFactory *BigtableClientFactory } @@ -137,240 +211,312 @@ func (c *Config) LoadAndValidate() error { context := context.Background() - log.Printf("[INFO] Instantiating GCE client...") + // This base path and some others below need the version and possibly more of the path + // set on them. The client libraries are inconsistent about which values they need; + // while most only want the host URL, some older ones also want the version and some + // of those "projects" as well. You can find out if this is required by looking at + // the basePath value in the client library file. + computeClientBasePath := removeBasePathVersion(c.ComputeBasePath) + "v1/projects/" + log.Printf("[INFO] Instantiating GCE client for path %s", computeClientBasePath) c.clientCompute, err = compute.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientCompute.UserAgent = userAgent + c.clientCompute.BasePath = computeClientBasePath - log.Printf("[INFO] Instantiating GCE Beta client...") + computeBetaClientBasePath := removeBasePathVersion(c.ComputeBetaBasePath) + "beta/projects/" + log.Printf("[INFO] Instantiating GCE Beta client for path %s", computeBetaClientBasePath) c.clientComputeBeta, err = computeBeta.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientComputeBeta.UserAgent = userAgent + c.clientComputeBeta.BasePath = computeBetaClientBasePath - log.Printf("[INFO] Instantiating GKE client...") + containerClientBasePath := removeBasePathVersion(c.ContainerBasePath) + log.Printf("[INFO] Instantiating GKE client for path %s", containerClientBasePath) c.clientContainer, err = container.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientContainer.UserAgent = userAgent + c.clientContainer.BasePath = containerClientBasePath - log.Printf("[INFO] Instantiating GKE Beta client...") + containerBetaClientBasePath := removeBasePathVersion(c.ContainerBetaBasePath) + log.Printf("[INFO] Instantiating GKE Beta client for path %s", containerBetaClientBasePath) c.clientContainerBeta, err = containerBeta.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientContainerBeta.UserAgent = userAgent + c.clientContainerBeta.BasePath = containerBetaClientBasePath - log.Printf("[INFO] Instantiating Google Cloud DNS client...") + dnsClientBasePath := removeBasePathVersion(c.DnsBasePath) + "v1/projects/" + log.Printf("[INFO] Instantiating Google Cloud DNS client for path %s", dnsClientBasePath) c.clientDns, err = dns.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientDns.UserAgent = userAgent + c.clientDns.BasePath = removeBasePathVersion(dnsClientBasePath) - log.Printf("[INFO] Instantiating Google Cloud DNS Beta client...") + dnsBetaClientBasePath := removeBasePathVersion(c.DnsBetaBasePath) + "v1beta2/projects/" + log.Printf("[INFO] Instantiating Google Cloud DNS Beta client for path %s", dnsBetaClientBasePath) c.clientDnsBeta, err = dnsBeta.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientDnsBeta.UserAgent = userAgent + c.clientDnsBeta.BasePath = dnsBetaClientBasePath - log.Printf("[INFO] Instantiating Google Cloud KMS Client...") + kmsClientBasePath := removeBasePathVersion(c.KmsBasePath) + log.Printf("[INFO] Instantiating Google Cloud KMS client for path %s", kmsClientBasePath) c.clientKms, err = cloudkms.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientKms.UserAgent = userAgent + c.clientKms.BasePath = kmsClientBasePath - log.Printf("[INFO] Instantiating Google Stackdriver Logging client...") + loggingClientBasePath := removeBasePathVersion(c.LoggingBasePath) + log.Printf("[INFO] Instantiating Google Stackdriver Logging client for path %s", loggingClientBasePath) c.clientLogging, err = cloudlogging.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientLogging.UserAgent = userAgent + c.clientLogging.BasePath = loggingClientBasePath - log.Printf("[INFO] Instantiating Google Storage Client...") + storageClientBasePath := removeBasePathVersion(c.StorageBasePath) + log.Printf("[INFO] Instantiating Google Storage client for path %s", storageClientBasePath) c.clientStorage, err = storage.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientStorage.UserAgent = userAgent + c.clientStorage.BasePath = storageClientBasePath - log.Printf("[INFO] Instantiating Google SqlAdmin Client...") + sqlClientBasePath := removeBasePathVersion(c.SqlBasePath) + "v1beta4/" + log.Printf("[INFO] Instantiating Google SqlAdmin client for path %s", sqlClientBasePath) c.clientSqlAdmin, err = sqladmin.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientSqlAdmin.UserAgent = userAgent + c.clientSqlAdmin.BasePath = sqlClientBasePath - log.Printf("[INFO] Instantiating Google Pubsub Client...") + pubsubClientBasePath := removeBasePathVersion(c.PubsubBasePath) + log.Printf("[INFO] Instantiating Google Pubsub client for path %s", pubsubClientBasePath) c.clientPubsub, err = pubsub.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientPubsub.UserAgent = userAgent + c.clientPubsub.BasePath = pubsubClientBasePath - log.Printf("[INFO] Instantiating Google Dataflow Client...") + dataflowClientBasePath := removeBasePathVersion(c.DataflowBasePath) + log.Printf("[INFO] Instantiating Google Dataflow client for path %s", dataflowClientBasePath) c.clientDataflow, err = dataflow.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientDataflow.UserAgent = userAgent + c.clientDataflow.BasePath = dataflowClientBasePath - log.Printf("[INFO] Instantiating Google Cloud ResourceManager Client...") + resourceManagerBasePath := removeBasePathVersion(c.ResourceManagerBasePath) + log.Printf("[INFO] Instantiating Google Cloud ResourceManager client for path %s", resourceManagerBasePath) c.clientResourceManager, err = cloudresourcemanager.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientResourceManager.UserAgent = userAgent + c.clientResourceManager.BasePath = resourceManagerBasePath - log.Printf("[INFO] Instantiating Google Cloud ResourceManager V Client...") + resourceManagerV2Beta1BasePath := removeBasePathVersion(c.ResourceManagerV2Beta1BasePath) + log.Printf("[INFO] Instantiating Google Cloud ResourceManager V client for path %s", resourceManagerV2Beta1BasePath) c.clientResourceManagerV2Beta1, err = resourceManagerV2Beta1.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientResourceManagerV2Beta1.UserAgent = userAgent + c.clientResourceManagerV2Beta1.BasePath = resourceManagerV2Beta1BasePath - log.Printf("[INFO] Instantiating Google Cloud Runtimeconfig Client...") + runtimeconfigClientBasePath := removeBasePathVersion(c.RuntimeconfigBasePath) + log.Printf("[INFO] Instantiating Google Cloud Runtimeconfig client for path %s", runtimeconfigClientBasePath) c.clientRuntimeconfig, err = runtimeconfig.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientRuntimeconfig.UserAgent = userAgent + c.clientRuntimeconfig.BasePath = runtimeconfigClientBasePath - log.Printf("[INFO] Instantiating Google Cloud IAM Client...") + iamClientBasePath := removeBasePathVersion(c.IAMBasePath) + log.Printf("[INFO] Instantiating Google Cloud IAM client for path %s", iamClientBasePath) c.clientIAM, err = iam.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientIAM.UserAgent = userAgent + c.clientIAM.BasePath = iamClientBasePath - log.Printf("[INFO] Instantiating Google Cloud IAMCredentials Client...") + iamCredentialsClientBasePath := removeBasePathVersion(c.IamCredentialsBasePath) + log.Printf("[INFO] Instantiating Google Cloud IAMCredentials client for path %s", iamCredentialsClientBasePath) c.clientIamCredentials, err = iamcredentials.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientIamCredentials.UserAgent = userAgent + c.clientIamCredentials.BasePath = iamCredentialsClientBasePath - log.Printf("[INFO] Instantiating IAP Client...") + iapClientBasePath := removeBasePathVersion(c.IAPBasePath) + log.Printf("[INFO] Instantiating IAP client for path %s", iapClientBasePath) c.clientIAP, err = iap.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientIAP.UserAgent = userAgent + c.clientIAP.BasePath = iapClientBasePath - log.Printf("[INFO] Instantiating Google Cloud Service Management Client...") + serviceManagementClientBasePath := removeBasePathVersion(c.ServiceManagementBasePath) + log.Printf("[INFO] Instantiating Google Cloud Service Management client for path %s", serviceManagementClientBasePath) c.clientServiceMan, err = servicemanagement.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientServiceMan.UserAgent = userAgent + c.clientServiceMan.BasePath = serviceManagementClientBasePath - log.Printf("[INFO] Instantiating Google Cloud Service Usage Client...") + serviceUsageClientBasePath := removeBasePathVersion(c.ServiceUsageBasePath) + log.Printf("[INFO] Instantiating Google Cloud Service Usage client for path %s", serviceUsageClientBasePath) c.clientServiceUsage, err = serviceusage.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientServiceUsage.UserAgent = userAgent + c.clientServiceUsage.BasePath = serviceUsageClientBasePath - log.Printf("[INFO] Instantiating Google Cloud Billing Client...") + cloudBillingClientBasePath := removeBasePathVersion(c.CloudBillingBasePath) + log.Printf("[INFO] Instantiating Google Cloud Billing client for path %s", cloudBillingClientBasePath) c.clientBilling, err = cloudbilling.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientBilling.UserAgent = userAgent + c.clientBilling.BasePath = cloudBillingClientBasePath - log.Printf("[INFO] Instantiating Google Cloud Build Client...") + cloudBuildClientBasePath := removeBasePathVersion(c.CloudBuildBasePath) + log.Printf("[INFO] Instantiating Google Cloud Build client for path %s", cloudBuildClientBasePath) c.clientBuild, err = cloudbuild.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientBuild.UserAgent = userAgent + c.clientBuild.BasePath = cloudBuildClientBasePath - log.Printf("[INFO] Instantiating Google Cloud BigQuery Client...") + bigQueryClientBasePath := removeBasePathVersion(c.BigQueryBasePath) + "v2/" + log.Printf("[INFO] Instantiating Google Cloud BigQuery client for path %s", bigQueryClientBasePath) c.clientBigQuery, err = bigquery.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientBigQuery.UserAgent = userAgent + c.clientBigQuery.BasePath = bigQueryClientBasePath - log.Printf("[INFO] Instantiating Google Cloud CloudFunctions Client...") + cloudFunctionsClientBasePath := removeBasePathVersion(c.CloudFunctionsBasePath) + log.Printf("[INFO] Instantiating Google Cloud CloudFunctions Client for path %s", cloudFunctionsClientBasePath) c.clientCloudFunctions, err = cloudfunctions.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientCloudFunctions.UserAgent = userAgent + c.clientCloudFunctions.BasePath = cloudFunctionsClientBasePath c.bigtableClientFactory = &BigtableClientFactory{ UserAgent: userAgent, TokenSource: tokenSource, } - log.Printf("[INFO] Instantiating Google Cloud Source Repo Client...") + sourceRepoClientBasePath := removeBasePathVersion(c.SourceRepoBasePath) + log.Printf("[INFO] Instantiating Google Cloud Source Repo client for path %s", sourceRepoClientBasePath) c.clientSourceRepo, err = sourcerepo.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientSourceRepo.UserAgent = userAgent + c.clientSourceRepo.BasePath = sourceRepoClientBasePath - log.Printf("[INFO] Instantiating Google Cloud Spanner Client...") + spannerClientBasePath := removeBasePathVersion(c.SpannerBasePath) + log.Printf("[INFO] Instantiating Google Cloud Spanner client for path %s", spannerClientBasePath) c.clientSpanner, err = spanner.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientSpanner.UserAgent = userAgent + c.clientSpanner.BasePath = spannerClientBasePath - log.Printf("[INFO] Instantiating Google Cloud Dataproc Client...") + dataprocClientBasePath := removeBasePathVersion(c.DataprocBasePath) + log.Printf("[INFO] Instantiating Google Cloud Dataproc client for path %s", dataprocClientBasePath) c.clientDataproc, err = dataproc.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientDataproc.UserAgent = userAgent + c.clientDataproc.BasePath = dataprocClientBasePath + filestoreClientBasePath := removeBasePathVersion(c.FilestoreBasePath) + log.Printf("[INFO] Instantiating Filestore client for path %s", filestoreClientBasePath) c.clientFilestore, err = file.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientFilestore.UserAgent = userAgent + c.clientFilestore.BasePath = filestoreClientBasePath - log.Printf("[INFO] Instantiating Google Cloud IoT Core Client...") + cloudIoTClientBasePath := removeBasePathVersion(c.CloudIoTBasePath) + log.Printf("[INFO] Instantiating Google Cloud IoT Core client for path %s", cloudIoTClientBasePath) c.clientCloudIoT, err = cloudiot.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientCloudIoT.UserAgent = userAgent + c.clientCloudIoT.BasePath = cloudIoTClientBasePath - log.Printf("[INFO] Instantiating App Engine Client...") + appEngineClientBasePath := removeBasePathVersion(c.AppEngineBasePath) + log.Printf("[INFO] Instantiating App Engine client for path %s", appEngineClientBasePath) c.clientAppEngine, err = appengine.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientAppEngine.UserAgent = userAgent + c.clientAppEngine.BasePath = appEngineClientBasePath - log.Printf("[INFO] Instantiating Cloud Composer Client...") + composerClientBasePath := removeBasePathVersion(c.ComposerBasePath) + log.Printf("[INFO] Instantiating Cloud Composer client for path %s", composerClientBasePath) c.clientComposer, err = composer.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientComposer.UserAgent = userAgent + c.clientComposer.BasePath = composerClientBasePath - log.Printf("[INFO] Instantiating Service Networking Client...") + serviceNetworkingClientBasePath := removeBasePathVersion(c.ServiceNetworkingBasePath) + log.Printf("[INFO] Instantiating Service Networking client for path %s", serviceNetworkingClientBasePath) c.clientServiceNetworking, err = servicenetworking.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientServiceNetworking.UserAgent = userAgent + c.clientServiceNetworking.BasePath = serviceNetworkingClientBasePath - log.Printf("[INFO] Instantiating Google Cloud Storage Transfer Client...") + storageTransferClientBasePath := removeBasePathVersion(c.StorageTransferBasePath) + log.Printf("[INFO] Instantiating Google Cloud Storage Transfer client for path %s", storageTransferClientBasePath) c.clientStorageTransfer, err = storagetransfer.NewService(context, option.WithHTTPClient(client)) if err != nil { return err } c.clientStorageTransfer.UserAgent = userAgent + c.clientStorageTransfer.BasePath = storageTransferClientBasePath return nil } @@ -408,3 +554,8 @@ func (c *Config) getTokenSource(clientScopes []string) (oauth2.TokenSource, erro log.Printf("[INFO] -- Scopes: %s", clientScopes) return googleoauth.DefaultTokenSource(context.Background(), clientScopes...) } + +// Remove the `/{{version}}/` from a base path, replacing it with `/` +func removeBasePathVersion(url string) string { + return regexp.MustCompile(`/[^/]+/$`).ReplaceAllString(url, "/") +} diff --git a/google-beta/data_source_google_composer_image_versions.go b/google-beta/data_source_google_composer_image_versions.go index 5ced5c4d5c..1750b5e487 100644 --- a/google-beta/data_source_google_composer_image_versions.go +++ b/google-beta/data_source_google_composer_image_versions.go @@ -56,7 +56,7 @@ func dataSourceGoogleComposerImageVersionsRead(d *schema.ResourceData, meta inte return err } - url, err := replaceVars(d, config, "https://composer.googleapis.com/v1/projects/{{project}}/locations/{{region}}/imageVersions") + url, err := replaceVars(d, config, "{{ComposerBasePath}}projects/{{project}}/locations/{{region}}/imageVersions") if err != nil { return err } diff --git a/google-beta/data_source_tpu_tensorflow_versions.go b/google-beta/data_source_tpu_tensorflow_versions.go index 0c36811b48..56806f74ed 100644 --- a/google-beta/data_source_tpu_tensorflow_versions.go +++ b/google-beta/data_source_tpu_tensorflow_versions.go @@ -45,7 +45,7 @@ func dataSourceTpuTensorFlowVersionsRead(d *schema.ResourceData, meta interface{ return err } - url, err := replaceVars(d, config, "https://tpu.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/tensorflowVersions") + url, err := replaceVars(d, config, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/tensorflowVersions") if err != nil { return err } diff --git a/google-beta/gcp_sweeper_test.go b/google-beta/gcp_sweeper_test.go index f04d8ae587..3f1411997d 100644 --- a/google-beta/gcp_sweeper_test.go +++ b/google-beta/gcp_sweeper_test.go @@ -30,5 +30,7 @@ func sharedConfigForRegion(region string) (*Config, error) { Project: project, } + BasePathsConfigure(conf) + return conf, nil } diff --git a/google-beta/provider.go b/google-beta/provider.go index cd8cb0fcb2..284218ae61 100644 --- a/google-beta/provider.go +++ b/google-beta/provider.go @@ -69,11 +69,59 @@ func Provider() terraform.ResourceProvider { "CLOUDSDK_COMPUTE_ZONE", }, nil), }, + "scopes": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, + + // Generated Products + // start beta-only products + BinaryAuthorizationCustomEndpointEntryKey: BinaryAuthorizationCustomEndpointEntry, + ContainerAnalysisCustomEndpointEntryKey: ContainerAnalysisCustomEndpointEntry, + SecurityScannerCustomEndpointEntryKey: SecurityScannerCustomEndpointEntry, + // end beta-only products + AccessContextManagerCustomEndpointEntryKey: AccessContextManagerCustomEndpointEntry, + AppEngineCustomEndpointEntryKey: AppEngineCustomEndpointEntry, + ComputeCustomEndpointEntryKey: ComputeCustomEndpointEntry, + CloudBuildCustomEndpointEntryKey: CloudBuildCustomEndpointEntry, + CloudSchedulerCustomEndpointEntryKey: CloudSchedulerCustomEndpointEntry, + DnsCustomEndpointEntryKey: DnsCustomEndpointEntry, + FilestoreCustomEndpointEntryKey: FilestoreCustomEndpointEntry, + FirestoreCustomEndpointEntryKey: FirestoreCustomEndpointEntry, + KmsCustomEndpointEntryKey: KmsCustomEndpointEntry, + PubsubCustomEndpointEntryKey: PubsubCustomEndpointEntry, + ResourceManagerCustomEndpointEntryKey: ResourceManagerCustomEndpointEntry, + SourceRepoCustomEndpointEntryKey: SourceRepoCustomEndpointEntry, + SpannerCustomEndpointEntryKey: SpannerCustomEndpointEntry, + SqlCustomEndpointEntryKey: SqlCustomEndpointEntry, + StorageCustomEndpointEntryKey: StorageCustomEndpointEntry, + + // Handwritten Products / Versioned / Atypical Entries + // start beta-only products + IAPCustomEndpointEntryKey: IAPCustomEndpointEntry, + ServiceNetworkingCustomEndpointEntryKey: ServiceNetworkingCustomEndpointEntry, + // end beta-only products + CloudBillingCustomEndpointEntryKey: CloudBillingCustomEndpointEntry, + ComposerCustomEndpointEntryKey: ComposerCustomEndpointEntry, + ComputeBetaCustomEndpointEntryKey: ComputeBetaCustomEndpointEntry, + ContainerCustomEndpointEntryKey: ContainerCustomEndpointEntry, + ContainerBetaCustomEndpointEntryKey: ContainerBetaCustomEndpointEntry, + DataprocCustomEndpointEntryKey: DataprocCustomEndpointEntry, + DataflowCustomEndpointEntryKey: DataflowCustomEndpointEntry, + DnsBetaCustomEndpointEntryKey: DnsBetaCustomEndpointEntry, + IamCredentialsCustomEndpointEntryKey: IamCredentialsCustomEndpointEntry, + LoggingCustomEndpointEntryKey: LoggingCustomEndpointEntry, + ResourceManagerV2Beta1CustomEndpointEntryKey: ResourceManagerV2Beta1CustomEndpointEntry, + RuntimeconfigCustomEndpointEntryKey: RuntimeconfigCustomEndpointEntry, + IAMCustomEndpointEntryKey: IAMCustomEndpointEntry, + ServiceManagementCustomEndpointEntryKey: ServiceManagementCustomEndpointEntry, + ServiceUsageCustomEndpointEntryKey: ServiceUsageCustomEndpointEntry, + BigQueryCustomEndpointEntryKey: BigQueryCustomEndpointEntry, + CloudFunctionsCustomEndpointEntryKey: CloudFunctionsCustomEndpointEntry, + CloudIoTCustomEndpointEntryKey: CloudIoTCustomEndpointEntry, + StorageTransferCustomEndpointEntryKey: StorageTransferCustomEndpointEntry, }, DataSourcesMap: map[string]*schema.Resource{ @@ -313,6 +361,49 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { config.Scopes[i] = scope.(string) } + config.BinaryAuthorizationBasePath = d.Get(BinaryAuthorizationCustomEndpointEntryKey).(string) + config.ContainerAnalysisBasePath = d.Get(ContainerAnalysisCustomEndpointEntryKey).(string) + config.SecurityScannerBasePath = d.Get(SecurityScannerCustomEndpointEntryKey).(string) + + config.AccessContextManagerBasePath = d.Get(AccessContextManagerCustomEndpointEntryKey).(string) + config.CloudSchedulerBasePath = d.Get(CloudSchedulerCustomEndpointEntryKey).(string) + config.FirestoreBasePath = d.Get(FirestoreCustomEndpointEntryKey).(string) + + config.AppEngineBasePath = d.Get(AppEngineCustomEndpointEntryKey).(string) + config.ComputeBasePath = d.Get(ComputeCustomEndpointEntryKey).(string) + config.CloudBuildBasePath = d.Get(CloudBuildCustomEndpointEntryKey).(string) + config.DnsBasePath = d.Get(DnsCustomEndpointEntryKey).(string) + config.FilestoreBasePath = d.Get(FilestoreCustomEndpointEntryKey).(string) + config.KmsBasePath = d.Get(KmsCustomEndpointEntryKey).(string) + config.PubsubBasePath = d.Get(PubsubCustomEndpointEntryKey).(string) + config.ResourceManagerBasePath = d.Get(ResourceManagerCustomEndpointEntryKey).(string) + config.SourceRepoBasePath = d.Get(SourceRepoCustomEndpointEntryKey).(string) + config.SpannerBasePath = d.Get(SpannerCustomEndpointEntryKey).(string) + config.SqlBasePath = d.Get(SqlCustomEndpointEntryKey).(string) + config.StorageBasePath = d.Get(StorageCustomEndpointEntryKey).(string) + + config.IAPBasePath = d.Get(IAPCustomEndpointEntryKey).(string) + config.ServiceNetworkingBasePath = d.Get(ServiceNetworkingCustomEndpointEntryKey).(string) + config.CloudBillingBasePath = d.Get(CloudBillingCustomEndpointEntryKey).(string) + config.ComposerBasePath = d.Get(ComposerCustomEndpointEntryKey).(string) + config.ComputeBetaBasePath = d.Get(ComputeBetaCustomEndpointEntryKey).(string) + config.ContainerBasePath = d.Get(ContainerCustomEndpointEntryKey).(string) + config.ContainerBetaBasePath = d.Get(ContainerBetaCustomEndpointEntryKey).(string) + config.DataprocBasePath = d.Get(DataprocCustomEndpointEntryKey).(string) + config.DataflowBasePath = d.Get(DataflowCustomEndpointEntryKey).(string) + config.DnsBetaBasePath = d.Get(DnsBetaCustomEndpointEntryKey).(string) + config.IamCredentialsBasePath = d.Get(IamCredentialsCustomEndpointEntryKey).(string) + config.LoggingBasePath = d.Get(LoggingCustomEndpointEntryKey).(string) + config.ResourceManagerV2Beta1BasePath = d.Get(ResourceManagerV2Beta1CustomEndpointEntryKey).(string) + config.RuntimeconfigBasePath = d.Get(RuntimeconfigCustomEndpointEntryKey).(string) + config.IAMBasePath = d.Get(IAMCustomEndpointEntryKey).(string) + config.ServiceManagementBasePath = d.Get(ServiceManagementCustomEndpointEntryKey).(string) + config.ServiceUsageBasePath = d.Get(ServiceUsageCustomEndpointEntryKey).(string) + config.BigQueryBasePath = d.Get(BigQueryCustomEndpointEntryKey).(string) + config.CloudFunctionsBasePath = d.Get(CloudFunctionsCustomEndpointEntryKey).(string) + config.CloudIoTBasePath = d.Get(CloudIoTCustomEndpointEntryKey).(string) + config.StorageTransferBasePath = d.Get(StorageTransferCustomEndpointEntryKey).(string) + if err := config.LoadAndValidate(); err != nil { return nil, err } @@ -320,6 +411,58 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { return &config, nil } +// For a consumer of config.go that isn't a full fledged provider and doesn't +// have its own endpoint mechanism such as sweepers, init {{service}}BasePath +// values to a default. After using this, you should call config.LoadAndValidate. +func BasePathsConfigure(c *Config) { + // Generated Products + // start beta-only products + c.BinaryAuthorizationBasePath = BinaryAuthorizationDefaultBasePath + c.ContainerAnalysisBasePath = ContainerAnalysisDefaultBasePath + c.SecurityScannerBasePath = SecurityScannerDefaultBasePath + // end beta-only products + c.AccessContextManagerBasePath = AccessContextManagerDefaultBasePath + c.AppEngineBasePath = AppEngineDefaultBasePath + c.ComputeBasePath = ComputeDefaultBasePath + c.CloudBuildBasePath = CloudBuildDefaultBasePath + c.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath + c.DnsBasePath = DnsDefaultBasePath + c.FilestoreBasePath = FilestoreDefaultBasePath + c.FirestoreBasePath = FirestoreDefaultBasePath + c.KmsBasePath = KmsDefaultBasePath + c.PubsubBasePath = PubsubDefaultBasePath + c.ResourceManagerBasePath = ResourceManagerDefaultBasePath + c.SourceRepoBasePath = SourceRepoDefaultBasePath + c.SpannerBasePath = SpannerDefaultBasePath + c.SqlBasePath = SqlDefaultBasePath + c.StorageBasePath = StorageDefaultBasePath + + // Handwritten Products / Versioned / Atypical Entries + // start beta-only products + c.IAPBasePath = IAPDefaultBasePath + c.ServiceNetworkingBasePath = ServiceNetworkingDefaultBasePath + // end beta-only products + c.CloudBillingBasePath = CloudBillingDefaultBasePath + c.ComposerBasePath = ComposerDefaultBasePath + c.ComputeBetaBasePath = ComputeBetaDefaultBasePath + c.ContainerBasePath = ContainerDefaultBasePath + c.ContainerBetaBasePath = ContainerBetaDefaultBasePath + c.DataprocBasePath = DataprocDefaultBasePath + c.DataflowBasePath = DataflowDefaultBasePath + c.DnsBetaBasePath = DnsBetaDefaultBasePath + c.IamCredentialsBasePath = IamCredentialsDefaultBasePath + c.LoggingBasePath = LoggingDefaultBasePath + c.ResourceManagerV2Beta1BasePath = ResourceManagerV2Beta1DefaultBasePath + c.RuntimeconfigBasePath = RuntimeconfigDefaultBasePath + c.IAMBasePath = IAMDefaultBasePath + c.ServiceManagementBasePath = ServiceManagementDefaultBasePath + c.ServiceUsageBasePath = ServiceUsageDefaultBasePath + c.BigQueryBasePath = BigQueryDefaultBasePath + c.CloudFunctionsBasePath = CloudFunctionsDefaultBasePath + c.CloudIoTBasePath = CloudIoTDefaultBasePath + c.StorageTransferBasePath = StorageTransferDefaultBasePath +} + func validateCredentials(v interface{}, k string) (warnings []string, errors []error) { if v == nil || v.(string) == "" { return diff --git a/google-beta/provider_access_context_manager_gen.go b/google-beta/provider_access_context_manager_gen.go index c09d393ab6..a8799c4e29 100644 --- a/google-beta/provider_access_context_manager_gen.go +++ b/google-beta/provider_access_context_manager_gen.go @@ -16,6 +16,19 @@ 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 AccessContextManagerDefaultBasePath = "https://accesscontextmanager.googleapis.com/v1/" +var AccessContextManagerCustomEndpointEntryKey = "access_context_manager_custom_endpoint" +var AccessContextManagerCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_ACCESS_CONTEXT_MANAGER_CUSTOM_ENDPOINT", + }, AccessContextManagerDefaultBasePath), +} + var GeneratedAccessContextManagerResourcesMap = map[string]*schema.Resource{ "google_access_context_manager_access_policy": resourceAccessContextManagerAccessPolicy(), "google_access_context_manager_access_level": resourceAccessContextManagerAccessLevel(), diff --git a/google-beta/provider_app_engine_gen.go b/google-beta/provider_app_engine_gen.go index 19cc25e047..20f783025b 100644 --- a/google-beta/provider_app_engine_gen.go +++ b/google-beta/provider_app_engine_gen.go @@ -16,6 +16,19 @@ 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 AppEngineDefaultBasePath = "https://appengine.googleapis.com/v1/" +var AppEngineCustomEndpointEntryKey = "app_engine_custom_endpoint" +var AppEngineCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_APP_ENGINE_CUSTOM_ENDPOINT", + }, AppEngineDefaultBasePath), +} + var GeneratedAppEngineResourcesMap = map[string]*schema.Resource{ "google_app_engine_firewall_rule": resourceAppEngineFirewallRule(), } diff --git a/google-beta/provider_binary_authorization_gen.go b/google-beta/provider_binary_authorization_gen.go index 4041d0fef7..f042d0f6a3 100644 --- a/google-beta/provider_binary_authorization_gen.go +++ b/google-beta/provider_binary_authorization_gen.go @@ -16,6 +16,19 @@ 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 BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis.com/v1beta1/" +var BinaryAuthorizationCustomEndpointEntryKey = "binary_authorization_custom_endpoint" +var BinaryAuthorizationCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_BINARY_AUTHORIZATION_CUSTOM_ENDPOINT", + }, BinaryAuthorizationDefaultBasePath), +} + var GeneratedBinaryAuthorizationResourcesMap = map[string]*schema.Resource{ "google_binary_authorization_attestor": resourceBinaryAuthorizationAttestor(), "google_binary_authorization_policy": resourceBinaryAuthorizationPolicy(), diff --git a/google-beta/provider_cloud_build_gen.go b/google-beta/provider_cloud_build_gen.go index 34bb1e6da2..fb135eb801 100644 --- a/google-beta/provider_cloud_build_gen.go +++ b/google-beta/provider_cloud_build_gen.go @@ -16,6 +16,19 @@ 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 CloudBuildDefaultBasePath = "https://cloudbuild.googleapis.com/v1/" +var CloudBuildCustomEndpointEntryKey = "cloud_build_custom_endpoint" +var CloudBuildCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CLOUD_BUILD_CUSTOM_ENDPOINT", + }, CloudBuildDefaultBasePath), +} + var GeneratedCloudBuildResourcesMap = map[string]*schema.Resource{ "google_cloudbuild_trigger": resourceCloudBuildTrigger(), } diff --git a/google-beta/provider_cloud_scheduler_gen.go b/google-beta/provider_cloud_scheduler_gen.go index 907c080299..96c5b246f3 100644 --- a/google-beta/provider_cloud_scheduler_gen.go +++ b/google-beta/provider_cloud_scheduler_gen.go @@ -16,6 +16,19 @@ 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 CloudSchedulerDefaultBasePath = "https://cloudscheduler.googleapis.com/v1/" +var CloudSchedulerCustomEndpointEntryKey = "cloud_scheduler_custom_endpoint" +var CloudSchedulerCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CLOUD_SCHEDULER_CUSTOM_ENDPOINT", + }, CloudSchedulerDefaultBasePath), +} + var GeneratedCloudSchedulerResourcesMap = map[string]*schema.Resource{ "google_cloud_scheduler_job": resourceCloudSchedulerJob(), } diff --git a/google-beta/provider_compute_gen.go b/google-beta/provider_compute_gen.go index 69c645260d..8eea9b3081 100644 --- a/google-beta/provider_compute_gen.go +++ b/google-beta/provider_compute_gen.go @@ -16,6 +16,19 @@ 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 ComputeDefaultBasePath = "https://www.googleapis.com/compute/beta/" +var ComputeCustomEndpointEntryKey = "compute_custom_endpoint" +var ComputeCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_COMPUTE_CUSTOM_ENDPOINT", + }, ComputeDefaultBasePath), +} + var GeneratedComputeResourcesMap = map[string]*schema.Resource{ "google_compute_address": resourceComputeAddress(), "google_compute_autoscaler": resourceComputeAutoscaler(), diff --git a/google-beta/provider_container_analysis_gen.go b/google-beta/provider_container_analysis_gen.go index 624fadbd3a..356667e600 100644 --- a/google-beta/provider_container_analysis_gen.go +++ b/google-beta/provider_container_analysis_gen.go @@ -16,6 +16,19 @@ 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 ContainerAnalysisDefaultBasePath = "https://containeranalysis.googleapis.com/v1beta1/" +var ContainerAnalysisCustomEndpointEntryKey = "container_analysis_custom_endpoint" +var ContainerAnalysisCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CONTAINER_ANALYSIS_CUSTOM_ENDPOINT", + }, ContainerAnalysisDefaultBasePath), +} + var GeneratedContainerAnalysisResourcesMap = map[string]*schema.Resource{ "google_container_analysis_note": resourceContainerAnalysisNote(), } diff --git a/google-beta/provider_dns_gen.go b/google-beta/provider_dns_gen.go index fe78dc65ef..6f09739f6b 100644 --- a/google-beta/provider_dns_gen.go +++ b/google-beta/provider_dns_gen.go @@ -16,6 +16,19 @@ 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 DnsDefaultBasePath = "https://www.googleapis.com/dns/v1beta2/" +var DnsCustomEndpointEntryKey = "dns_custom_endpoint" +var DnsCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_DNS_CUSTOM_ENDPOINT", + }, DnsDefaultBasePath), +} + var GeneratedDnsResourcesMap = map[string]*schema.Resource{ "google_dns_managed_zone": resourceDnsManagedZone(), "google_dns_policy": resourceDnsPolicy(), diff --git a/google-beta/provider_filestore_gen.go b/google-beta/provider_filestore_gen.go index 7bf114b2ff..711a49cf08 100644 --- a/google-beta/provider_filestore_gen.go +++ b/google-beta/provider_filestore_gen.go @@ -16,6 +16,19 @@ 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 FilestoreDefaultBasePath = "https://file.googleapis.com/v1/" +var FilestoreCustomEndpointEntryKey = "filestore_custom_endpoint" +var FilestoreCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_FILESTORE_CUSTOM_ENDPOINT", + }, FilestoreDefaultBasePath), +} + var GeneratedFilestoreResourcesMap = map[string]*schema.Resource{ "google_filestore_instance": resourceFilestoreInstance(), } diff --git a/google-beta/provider_firestore_gen.go b/google-beta/provider_firestore_gen.go index aa4a7f848b..35fc86037a 100644 --- a/google-beta/provider_firestore_gen.go +++ b/google-beta/provider_firestore_gen.go @@ -16,6 +16,19 @@ 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 FirestoreDefaultBasePath = "https://firestore.googleapis.com/v1/" +var FirestoreCustomEndpointEntryKey = "firestore_custom_endpoint" +var FirestoreCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_FIRESTORE_CUSTOM_ENDPOINT", + }, FirestoreDefaultBasePath), +} + var GeneratedFirestoreResourcesMap = map[string]*schema.Resource{ "google_firestore_index": resourceFirestoreIndex(), } diff --git a/google-beta/provider_handwritten_endpoint.go b/google-beta/provider_handwritten_endpoint.go new file mode 100644 index 0000000000..10a2bf6dcf --- /dev/null +++ b/google-beta/provider_handwritten_endpoint.go @@ -0,0 +1,233 @@ +package google + +import ( + "github.com/hashicorp/terraform/helper/schema" +) + +// For generated resources, endpoint entries live in product-specific provider +// files. Collect handwritten ones here. If any of these are modified, be sure +// to update the provider_reference docs page. + +var BigQueryDefaultBasePath = "https://www.googleapis.com/bigquery/v2/" +var BigQueryCustomEndpointEntryKey = "bigquery_custom_endpoint" +var BigQueryCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_BIGQUERY_CUSTOM_ENDPOINT", + }, BigQueryDefaultBasePath), +} + +var CloudBillingDefaultBasePath = "https://cloudbilling.googleapis.com/v1/" +var CloudBillingCustomEndpointEntryKey = "cloud_billing_custom_endpoint" +var CloudBillingCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CLOUD_BILLING_CUSTOM_ENDPOINT", + }, CloudBillingDefaultBasePath), +} + +var CloudFunctionsDefaultBasePath = "https://cloudfunctions.googleapis.com/v1/" +var CloudFunctionsCustomEndpointEntryKey = "cloud_functions_custom_endpoint" +var CloudFunctionsCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CLOUD_FUNCTIONS_CUSTOM_ENDPOINT", + }, CloudFunctionsDefaultBasePath), +} + +var CloudIoTDefaultBasePath = "https://cloudiot.googleapis.com/v1/" +var CloudIoTCustomEndpointEntryKey = "cloud_iot_custom_endpoint" +var CloudIoTCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CLOUD_IOT_CUSTOM_ENDPOINT", + }, CloudIoTDefaultBasePath), +} + +var ComposerDefaultBasePath = "https://composer.googleapis.com/v1beta1/" +var ComposerCustomEndpointEntryKey = "composer_custom_endpoint" +var ComposerCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_COMPOSER_CUSTOM_ENDPOINT", + }, ComposerDefaultBasePath), +} + +var ComputeBetaDefaultBasePath = "https://www.googleapis.com/compute/beta/" +var ComputeBetaCustomEndpointEntryKey = "compute_beta_custom_endpoint" +var ComputeBetaCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_COMPUTE_BETA_CUSTOM_ENDPOINT", + }, ComputeBetaDefaultBasePath), +} + +var ContainerDefaultBasePath = "https://container.googleapis.com/v1/" +var ContainerCustomEndpointEntryKey = "container_custom_endpoint" +var ContainerCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CONTAINER_CUSTOM_ENDPOINT", + }, ContainerDefaultBasePath), +} + +var ContainerBetaDefaultBasePath = "https://container.googleapis.com/v1beta1/" +var ContainerBetaCustomEndpointEntryKey = "container_beta_custom_endpoint" +var ContainerBetaCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_CONTAINER_BETA_CUSTOM_ENDPOINT", + }, ContainerBetaDefaultBasePath), +} + +var DataprocDefaultBasePath = "https://dataproc.googleapis.com/v1/" +var DataprocCustomEndpointEntryKey = "dataproc_custom_endpoint" +var DataprocCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_DATAPROC_CUSTOM_ENDPOINT", + }, DataprocDefaultBasePath), +} + +var DataflowDefaultBasePath = "https://dataflow.googleapis.com/v1b3/" +var DataflowCustomEndpointEntryKey = "dataflow_custom_endpoint" +var DataflowCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_DATAFLOW_CUSTOM_ENDPOINT", + }, DataflowDefaultBasePath), +} +var DnsBetaDefaultBasePath = "https://www.googleapis.com/dns/v1beta2/" +var DnsBetaCustomEndpointEntryKey = "dns_beta_custom_endpoint" +var DnsBetaCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_DNS_BETA_CUSTOM_ENDPOINT", + }, DnsBetaDefaultBasePath), +} + +var IAMDefaultBasePath = "https://iam.googleapis.com/v1/" +var IAMCustomEndpointEntryKey = "iam_custom_endpoint" +var IAMCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_IAM_CUSTOM_ENDPOINT", + }, IAMDefaultBasePath), +} + +var IamCredentialsDefaultBasePath = "https://iamcredentials.googleapis.com/v1/" +var IamCredentialsCustomEndpointEntryKey = "iam_credentials_custom_endpoint" +var IamCredentialsCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_IAM_CREDENTIALS_CUSTOM_ENDPOINT", + }, IamCredentialsDefaultBasePath), +} + +var IAPDefaultBasePath = "https://iap.googleapis.com/v1beta1/" +var IAPCustomEndpointEntryKey = "iap_custom_endpoint" +var IAPCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_IAP_CUSTOM_ENDPOINT", + }, IAPDefaultBasePath), +} + +var ResourceManagerV2Beta1DefaultBasePath = "https://cloudresourcemanager.googleapis.com/v2beta1/" +var ResourceManagerV2Beta1CustomEndpointEntryKey = "resource_manager_v2beta1_custom_endpoint" +var ResourceManagerV2Beta1CustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_RESOURCE_MANAGER_V2BETA1_CUSTOM_ENDPOINT", + }, ResourceManagerV2Beta1DefaultBasePath), +} + +var RuntimeconfigDefaultBasePath = "https://runtimeconfig.googleapis.com/v1beta1/" +var RuntimeconfigCustomEndpointEntryKey = "runtimeconfig_custom_endpoint" +var RuntimeconfigCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_RUNTIMECONFIG_CUSTOM_ENDPOINT", + }, RuntimeconfigDefaultBasePath), +} + +var ServiceManagementDefaultBasePath = "https://servicemanagement.googleapis.com/v1/" +var ServiceManagementCustomEndpointEntryKey = "service_management_custom_endpoint" +var ServiceManagementCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SERVICE_MANAGEMENT_CUSTOM_ENDPOINT", + }, ServiceManagementDefaultBasePath), +} + +var ServiceNetworkingDefaultBasePath = "https://servicenetworking.googleapis.com/v1beta/" +var ServiceNetworkingCustomEndpointEntryKey = "service_networking_custom_endpoint" +var ServiceNetworkingCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SERVICE_NETWORKING_CUSTOM_ENDPOINT", + }, ServiceNetworkingDefaultBasePath), +} + +var ServiceUsageDefaultBasePath = "https://serviceusage.googleapis.com/v1/" +var ServiceUsageCustomEndpointEntryKey = "service_usage_custom_endpoint" +var ServiceUsageCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SERVICE_USAGE_CUSTOM_ENDPOINT", + }, ServiceUsageDefaultBasePath), +} + +var StorageTransferDefaultBasePath = "https://storagetransfer.googleapis.com/v1/" +var StorageTransferCustomEndpointEntryKey = "storage_transfer_custom_endpoint" +var StorageTransferCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_STORAGE_TRANSFER_CUSTOM_ENDPOINT", + }, StorageTransferDefaultBasePath), +} + +func validateCustomEndpoint(v interface{}, k string) (ws []string, errors []error) { + re := `.*/[^/]+/$` + return validateRegexp(re)(v, k) +} diff --git a/google-beta/provider_kms_gen.go b/google-beta/provider_kms_gen.go index 99518c3d0b..740ac6b587 100644 --- a/google-beta/provider_kms_gen.go +++ b/google-beta/provider_kms_gen.go @@ -16,6 +16,19 @@ 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 KmsDefaultBasePath = "https://cloudkms.googleapis.com/v1/" +var KmsCustomEndpointEntryKey = "kms_custom_endpoint" +var KmsCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_KMS_CUSTOM_ENDPOINT", + }, KmsDefaultBasePath), +} + var GeneratedKmsResourcesMap = map[string]*schema.Resource{ "google_kms_key_ring": resourceKmsKeyRing(), } diff --git a/google-beta/provider_logging_gen.go b/google-beta/provider_logging_gen.go index 2450bf56f0..5470119829 100644 --- a/google-beta/provider_logging_gen.go +++ b/google-beta/provider_logging_gen.go @@ -16,6 +16,19 @@ 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 LoggingDefaultBasePath = "https://logging.googleapis.com/v2/" +var LoggingCustomEndpointEntryKey = "logging_custom_endpoint" +var LoggingCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_LOGGING_CUSTOM_ENDPOINT", + }, LoggingDefaultBasePath), +} + var GeneratedLoggingResourcesMap = map[string]*schema.Resource{ "google_logging_metric": resourceLoggingMetric(), } diff --git a/google-beta/provider_monitoring_gen.go b/google-beta/provider_monitoring_gen.go index 25a1319d04..55a9074806 100644 --- a/google-beta/provider_monitoring_gen.go +++ b/google-beta/provider_monitoring_gen.go @@ -16,6 +16,19 @@ 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 MonitoringDefaultBasePath = "https://monitoring.googleapis.com/v3/" +var MonitoringCustomEndpointEntryKey = "monitoring_custom_endpoint" +var MonitoringCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_MONITORING_CUSTOM_ENDPOINT", + }, MonitoringDefaultBasePath), +} + var GeneratedMonitoringResourcesMap = map[string]*schema.Resource{ "google_monitoring_alert_policy": resourceMonitoringAlertPolicy(), "google_monitoring_group": resourceMonitoringGroup(), diff --git a/google-beta/provider_pubsub_gen.go b/google-beta/provider_pubsub_gen.go index 7de26f50a9..9c1a14ddef 100644 --- a/google-beta/provider_pubsub_gen.go +++ b/google-beta/provider_pubsub_gen.go @@ -16,6 +16,19 @@ 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 PubsubDefaultBasePath = "https://pubsub.googleapis.com/v1/" +var PubsubCustomEndpointEntryKey = "pubsub_custom_endpoint" +var PubsubCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_PUBSUB_CUSTOM_ENDPOINT", + }, PubsubDefaultBasePath), +} + var GeneratedPubsubResourcesMap = map[string]*schema.Resource{ "google_pubsub_topic": resourcePubsubTopic(), "google_pubsub_subscription": resourcePubsubSubscription(), diff --git a/google-beta/provider_redis_gen.go b/google-beta/provider_redis_gen.go index 804a0a9587..15d0bc3736 100644 --- a/google-beta/provider_redis_gen.go +++ b/google-beta/provider_redis_gen.go @@ -16,6 +16,19 @@ 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 RedisDefaultBasePath = "https://redis.googleapis.com/v1beta1/" +var RedisCustomEndpointEntryKey = "redis_custom_endpoint" +var RedisCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_REDIS_CUSTOM_ENDPOINT", + }, RedisDefaultBasePath), +} + var GeneratedRedisResourcesMap = map[string]*schema.Resource{ "google_redis_instance": resourceRedisInstance(), } diff --git a/google-beta/provider_resource_manager_gen.go b/google-beta/provider_resource_manager_gen.go index a2a474739e..1234b44e0a 100644 --- a/google-beta/provider_resource_manager_gen.go +++ b/google-beta/provider_resource_manager_gen.go @@ -16,6 +16,19 @@ 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 ResourceManagerDefaultBasePath = "https://cloudresourcemanager.googleapis.com/v1/" +var ResourceManagerCustomEndpointEntryKey = "resource_manager_custom_endpoint" +var ResourceManagerCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_RESOURCE_MANAGER_CUSTOM_ENDPOINT", + }, ResourceManagerDefaultBasePath), +} + var GeneratedResourceManagerResourcesMap = map[string]*schema.Resource{ "google_resource_manager_lien": resourceResourceManagerLien(), } diff --git a/google-beta/provider_security_scanner_gen.go b/google-beta/provider_security_scanner_gen.go index 2002648d74..79b26fd093 100644 --- a/google-beta/provider_security_scanner_gen.go +++ b/google-beta/provider_security_scanner_gen.go @@ -16,6 +16,19 @@ 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 SecurityScannerDefaultBasePath = "https://websecurityscanner.googleapis.com/v1beta/" +var SecurityScannerCustomEndpointEntryKey = "security_scanner_custom_endpoint" +var SecurityScannerCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SECURITY_SCANNER_CUSTOM_ENDPOINT", + }, SecurityScannerDefaultBasePath), +} + var GeneratedSecurityScannerResourcesMap = map[string]*schema.Resource{ "google_security_scanner_scan_config": resourceSecurityScannerScanConfig(), } diff --git a/google-beta/provider_source_repo_gen.go b/google-beta/provider_source_repo_gen.go index e70a51f6db..c0452752d7 100644 --- a/google-beta/provider_source_repo_gen.go +++ b/google-beta/provider_source_repo_gen.go @@ -16,6 +16,19 @@ 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 SourceRepoDefaultBasePath = "https://sourcerepo.googleapis.com/v1/" +var SourceRepoCustomEndpointEntryKey = "source_repo_custom_endpoint" +var SourceRepoCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SOURCE_REPO_CUSTOM_ENDPOINT", + }, SourceRepoDefaultBasePath), +} + var GeneratedSourceRepoResourcesMap = map[string]*schema.Resource{ "google_sourcerepo_repository": resourceSourceRepoRepository(), } diff --git a/google-beta/provider_spanner_gen.go b/google-beta/provider_spanner_gen.go index 634d491ed9..e5523ea293 100644 --- a/google-beta/provider_spanner_gen.go +++ b/google-beta/provider_spanner_gen.go @@ -16,6 +16,19 @@ 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 SpannerDefaultBasePath = "https://spanner.googleapis.com/v1/" +var SpannerCustomEndpointEntryKey = "spanner_custom_endpoint" +var SpannerCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SPANNER_CUSTOM_ENDPOINT", + }, SpannerDefaultBasePath), +} + var GeneratedSpannerResourcesMap = map[string]*schema.Resource{ "google_spanner_instance": resourceSpannerInstance(), "google_spanner_database": resourceSpannerDatabase(), diff --git a/google-beta/provider_sql_gen.go b/google-beta/provider_sql_gen.go index f5a4636878..808f3fe609 100644 --- a/google-beta/provider_sql_gen.go +++ b/google-beta/provider_sql_gen.go @@ -16,6 +16,19 @@ 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 SqlDefaultBasePath = "https://www.googleapis.com/sql/v1beta4/" +var SqlCustomEndpointEntryKey = "sql_custom_endpoint" +var SqlCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SQL_CUSTOM_ENDPOINT", + }, SqlDefaultBasePath), +} + var GeneratedSqlResourcesMap = map[string]*schema.Resource{ "google_sql_database": resourceSqlDatabase(), } diff --git a/google-beta/provider_storage_gen.go b/google-beta/provider_storage_gen.go index 3cef38691e..167e4d3331 100644 --- a/google-beta/provider_storage_gen.go +++ b/google-beta/provider_storage_gen.go @@ -16,6 +16,19 @@ 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 StorageDefaultBasePath = "https://www.googleapis.com/storage/v1/" +var StorageCustomEndpointEntryKey = "storage_custom_endpoint" +var StorageCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_STORAGE_CUSTOM_ENDPOINT", + }, StorageDefaultBasePath), +} + var GeneratedStorageResourcesMap = map[string]*schema.Resource{ "google_storage_object_access_control": resourceStorageObjectAccessControl(), "google_storage_default_object_access_control": resourceStorageDefaultObjectAccessControl(), diff --git a/google-beta/provider_test.go b/google-beta/provider_test.go index 0402c04b38..56db43b29d 100644 --- a/google-beta/provider_test.go +++ b/google-beta/provider_test.go @@ -4,9 +4,12 @@ import ( "fmt" "io/ioutil" "os" + "regexp" "strings" "testing" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" "github.com/terraform-providers/terraform-provider-random/random" @@ -154,6 +157,53 @@ func TestProvider_loadCredentialsFromJSON(t *testing.T) { } } +func TestAccProviderBasePath_setBasePath(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckComputeAddressDestroy, + Steps: []resource.TestStep{ + { + Config: testAccProviderBasePath_setBasePath("https://www.googleapis.com/compute/beta/", acctest.RandString(10)), + }, + { + ResourceName: "google_compute_address.default", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccProviderBasePath_setInvalidBasePath(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckComputeAddressDestroy, + Steps: []resource.TestStep{ + { + Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(10)), + ExpectError: regexp.MustCompile("got HTTP response code 404 with body"), + }, + }, + }) +} + +func testAccProviderBasePath_setBasePath(endpoint, name string) string { + return fmt.Sprintf(` +provider "google" { + compute_custom_endpoint = "%s" +} + +resource "google_compute_address" "default" { + name = "address-test-%s" +}`, endpoint, name) +} + // getTestRegion has the same logic as the provider's getRegion, to be used in tests. func getTestRegion(is *terraform.InstanceState, config *Config) (string, error) { if res, ok := is.Attributes["region"]; ok { diff --git a/google-beta/provider_tpu_gen.go b/google-beta/provider_tpu_gen.go index f2690560bd..3f385c3818 100644 --- a/google-beta/provider_tpu_gen.go +++ b/google-beta/provider_tpu_gen.go @@ -16,6 +16,19 @@ 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 TpuDefaultBasePath = "https://tpu.googleapis.com/v1/" +var TpuCustomEndpointEntryKey = "tpu_custom_endpoint" +var TpuCustomEndpointEntry = &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_TPU_CUSTOM_ENDPOINT", + }, TpuDefaultBasePath), +} + var GeneratedTpuResourcesMap = map[string]*schema.Resource{ "google_tpu_node": resourceTpuNode(), } diff --git a/google-beta/resource_access_context_manager_access_level.go b/google-beta/resource_access_context_manager_access_level.go index e471a2da6a..dba8d13f37 100644 --- a/google-beta/resource_access_context_manager_access_level.go +++ b/google-beta/resource_access_context_manager_access_level.go @@ -198,7 +198,7 @@ func resourceAccessContextManagerAccessLevelCreate(d *schema.ResourceData, meta return err } - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{parent}}/accessLevels") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{parent}}/accessLevels") if err != nil { return err } @@ -234,7 +234,7 @@ func resourceAccessContextManagerAccessLevelCreate(d *schema.ResourceData, meta func resourceAccessContextManagerAccessLevelRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } @@ -288,7 +288,7 @@ func resourceAccessContextManagerAccessLevelUpdate(d *schema.ResourceData, meta return err } - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } @@ -333,7 +333,7 @@ func resourceAccessContextManagerAccessLevelUpdate(d *schema.ResourceData, meta func resourceAccessContextManagerAccessLevelDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_access_context_manager_access_level_test.go b/google-beta/resource_access_context_manager_access_level_test.go index 8c853732e7..cf1d8ed836 100644 --- a/google-beta/resource_access_context_manager_access_level_test.go +++ b/google-beta/resource_access_context_manager_access_level_test.go @@ -67,7 +67,7 @@ func testAccCheckAccessContextManagerAccessLevelDestroy(s *terraform.State) erro config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://accesscontextmanager.googleapis.com/v1beta/{{name}}") + url, err := replaceVarsForTest(rs, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_access_context_manager_access_policy.go b/google-beta/resource_access_context_manager_access_policy.go index 3751004a9a..6a9f786d8e 100644 --- a/google-beta/resource_access_context_manager_access_policy.go +++ b/google-beta/resource_access_context_manager_access_policy.go @@ -84,7 +84,7 @@ func resourceAccessContextManagerAccessPolicyCreate(d *schema.ResourceData, meta obj["title"] = titleProp } - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/accessPolicies") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}accessPolicies") if err != nil { return err } @@ -130,7 +130,7 @@ func resourceAccessContextManagerAccessPolicyCreate(d *schema.ResourceData, meta func resourceAccessContextManagerAccessPolicyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/accessPolicies/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}accessPolicies/{{name}}") if err != nil { return err } @@ -170,7 +170,7 @@ func resourceAccessContextManagerAccessPolicyUpdate(d *schema.ResourceData, meta obj["title"] = titleProp } - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/accessPolicies/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}accessPolicies/{{name}}") if err != nil { return err } @@ -207,7 +207,7 @@ func resourceAccessContextManagerAccessPolicyUpdate(d *schema.ResourceData, meta func resourceAccessContextManagerAccessPolicyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/accessPolicies/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}accessPolicies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_access_context_manager_access_policy_test.go b/google-beta/resource_access_context_manager_access_policy_test.go index baaed00318..336eeb98a5 100644 --- a/google-beta/resource_access_context_manager_access_policy_test.go +++ b/google-beta/resource_access_context_manager_access_policy_test.go @@ -67,7 +67,7 @@ func testAccCheckAccessContextManagerAccessPolicyDestroy(s *terraform.State) err config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://accesscontextmanager.googleapis.com/v1beta/accessPolicies/{{name}}") + url, err := replaceVarsForTest(rs, "{{AccessContextManagerBasePath}}accessPolicies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_access_context_manager_service_perimeter.go b/google-beta/resource_access_context_manager_service_perimeter.go index be7aa44944..25b0b36664 100644 --- a/google-beta/resource_access_context_manager_service_perimeter.go +++ b/google-beta/resource_access_context_manager_service_perimeter.go @@ -156,7 +156,7 @@ func resourceAccessContextManagerServicePerimeterCreate(d *schema.ResourceData, return err } - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{parent}}/servicePerimeters") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{parent}}/servicePerimeters") if err != nil { return err } @@ -192,7 +192,7 @@ func resourceAccessContextManagerServicePerimeterCreate(d *schema.ResourceData, func resourceAccessContextManagerServicePerimeterRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } @@ -255,7 +255,7 @@ func resourceAccessContextManagerServicePerimeterUpdate(d *schema.ResourceData, return err } - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } @@ -300,7 +300,7 @@ func resourceAccessContextManagerServicePerimeterUpdate(d *schema.ResourceData, func resourceAccessContextManagerServicePerimeterDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://accesscontextmanager.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_access_context_manager_service_perimeter_test.go b/google-beta/resource_access_context_manager_service_perimeter_test.go index 57d18d3b1b..066a1380f3 100644 --- a/google-beta/resource_access_context_manager_service_perimeter_test.go +++ b/google-beta/resource_access_context_manager_service_perimeter_test.go @@ -66,7 +66,7 @@ func testAccCheckAccessContextManagerServicePerimeterDestroy(s *terraform.State) config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://accesscontextmanager.googleapis.com/v1beta/{{name}}") + url, err := replaceVarsForTest(rs, "{{AccessContextManagerBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_app_engine_firewall_rule.go b/google-beta/resource_app_engine_firewall_rule.go index 743e31fdaa..af358b99e7 100644 --- a/google-beta/resource_app_engine_firewall_rule.go +++ b/google-beta/resource_app_engine_firewall_rule.go @@ -100,7 +100,7 @@ func resourceAppEngineFirewallRuleCreate(d *schema.ResourceData, meta interface{ obj["priority"] = priorityProp } - url, err := replaceVars(d, config, "https://appengine.googleapis.com/v1/apps/{{project}}/firewall/ingressRules") + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/firewall/ingressRules") if err != nil { return err } @@ -126,7 +126,7 @@ func resourceAppEngineFirewallRuleCreate(d *schema.ResourceData, meta interface{ func resourceAppEngineFirewallRuleRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://appengine.googleapis.com/v1/apps/{{project}}/firewall/ingressRules/{{priority}}") + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/firewall/ingressRules/{{priority}}") if err != nil { return err } @@ -189,7 +189,7 @@ func resourceAppEngineFirewallRuleUpdate(d *schema.ResourceData, meta interface{ obj["priority"] = priorityProp } - url, err := replaceVars(d, config, "https://appengine.googleapis.com/v1/apps/{{project}}/firewall/ingressRules/{{priority}}") + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/firewall/ingressRules/{{priority}}") if err != nil { return err } @@ -230,7 +230,7 @@ func resourceAppEngineFirewallRuleUpdate(d *schema.ResourceData, meta interface{ func resourceAppEngineFirewallRuleDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://appengine.googleapis.com/v1/apps/{{project}}/firewall/ingressRules/{{priority}}") + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/firewall/ingressRules/{{priority}}") if err != nil { return err } diff --git a/google-beta/resource_app_engine_firewall_rule_generated_test.go b/google-beta/resource_app_engine_firewall_rule_generated_test.go index 595b949d6f..251f49572d 100644 --- a/google-beta/resource_app_engine_firewall_rule_generated_test.go +++ b/google-beta/resource_app_engine_firewall_rule_generated_test.go @@ -82,7 +82,7 @@ func testAccCheckAppEngineFirewallRuleDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://appengine.googleapis.com/v1/apps/{{project}}/firewall/ingressRules/{{priority}}") + url, err := replaceVarsForTest(rs, "{{AppEngineBasePath}}apps/{{project}}/firewall/ingressRules/{{priority}}") if err != nil { return err } diff --git a/google-beta/resource_binary_authorization_attestor.go b/google-beta/resource_binary_authorization_attestor.go index b14b5d0a0d..7a56e6201b 100644 --- a/google-beta/resource_binary_authorization_attestor.go +++ b/google-beta/resource_binary_authorization_attestor.go @@ -123,7 +123,7 @@ func resourceBinaryAuthorizationAttestorCreate(d *schema.ResourceData, meta inte obj["userOwnedDrydockNote"] = userOwnedDrydockNoteProp } - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors?attestorId={{name}}") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors?attestorId={{name}}") if err != nil { return err } @@ -149,7 +149,7 @@ func resourceBinaryAuthorizationAttestorCreate(d *schema.ResourceData, meta inte func resourceBinaryAuthorizationAttestorRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors/{{name}}") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors/{{name}}") if err != nil { return err } @@ -203,7 +203,7 @@ func resourceBinaryAuthorizationAttestorUpdate(d *schema.ResourceData, meta inte obj["userOwnedDrydockNote"] = userOwnedDrydockNoteProp } - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors/{{name}}") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors/{{name}}") if err != nil { return err } @@ -221,7 +221,7 @@ func resourceBinaryAuthorizationAttestorUpdate(d *schema.ResourceData, meta inte func resourceBinaryAuthorizationAttestorDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors/{{name}}") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_binary_authorization_policy.go b/google-beta/resource_binary_authorization_policy.go index 9e41bee673..4739e7ed95 100644 --- a/google-beta/resource_binary_authorization_policy.go +++ b/google-beta/resource_binary_authorization_policy.go @@ -197,7 +197,7 @@ func resourceBinaryAuthorizationPolicyCreate(d *schema.ResourceData, meta interf obj["defaultAdmissionRule"] = defaultAdmissionRuleProp } - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/policy") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/policy") if err != nil { return err } @@ -223,7 +223,7 @@ func resourceBinaryAuthorizationPolicyCreate(d *schema.ResourceData, meta interf func resourceBinaryAuthorizationPolicyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/policy") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/policy") if err != nil { return err } @@ -286,7 +286,7 @@ func resourceBinaryAuthorizationPolicyUpdate(d *schema.ResourceData, meta interf obj["defaultAdmissionRule"] = defaultAdmissionRuleProp } - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/policy") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/policy") if err != nil { return err } @@ -304,7 +304,7 @@ func resourceBinaryAuthorizationPolicyUpdate(d *schema.ResourceData, meta interf func resourceBinaryAuthorizationPolicyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/policy") + url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/policy") if err != nil { return err } diff --git a/google-beta/resource_cloud_build_trigger.go b/google-beta/resource_cloud_build_trigger.go index ad25a5165f..30dace768f 100644 --- a/google-beta/resource_cloud_build_trigger.go +++ b/google-beta/resource_cloud_build_trigger.go @@ -281,7 +281,7 @@ func resourceCloudBuildTriggerCreate(d *schema.ResourceData, meta interface{}) e obj["build"] = buildProp } - url, err := replaceVars(d, config, "https://cloudbuild.googleapis.com/v1/projects/{{project}}/triggers") + url, err := replaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/triggers") if err != nil { return err } @@ -322,7 +322,7 @@ func resourceCloudBuildTriggerCreate(d *schema.ResourceData, meta interface{}) e func resourceCloudBuildTriggerRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://cloudbuild.googleapis.com/v1/projects/{{project}}/triggers/{{trigger_id}}") + url, err := replaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/triggers/{{trigger_id}}") if err != nil { return err } @@ -427,7 +427,7 @@ func resourceCloudBuildTriggerUpdate(d *schema.ResourceData, meta interface{}) e obj["build"] = buildProp } - url, err := replaceVars(d, config, "https://cloudbuild.googleapis.com/v1/projects/{{project}}/triggers/{{trigger_id}}") + url, err := replaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/triggers/{{trigger_id}}") if err != nil { return err } @@ -446,7 +446,7 @@ func resourceCloudBuildTriggerUpdate(d *schema.ResourceData, meta interface{}) e func resourceCloudBuildTriggerDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://cloudbuild.googleapis.com/v1/projects/{{project}}/triggers/{{trigger_id}}") + url, err := replaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/triggers/{{trigger_id}}") if err != nil { return err } diff --git a/google-beta/resource_cloud_build_trigger_generated_test.go b/google-beta/resource_cloud_build_trigger_generated_test.go index 4e9506fdb4..1c28e238df 100644 --- a/google-beta/resource_cloud_build_trigger_generated_test.go +++ b/google-beta/resource_cloud_build_trigger_generated_test.go @@ -77,7 +77,7 @@ func testAccCheckCloudBuildTriggerDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://cloudbuild.googleapis.com/v1/projects/{{project}}/triggers/{{trigger_id}}") + url, err := replaceVarsForTest(rs, "{{CloudBuildBasePath}}projects/{{project}}/triggers/{{trigger_id}}") if err != nil { return err } diff --git a/google-beta/resource_cloud_scheduler_job.go b/google-beta/resource_cloud_scheduler_job.go index b31a473f60..794b661fee 100644 --- a/google-beta/resource_cloud_scheduler_job.go +++ b/google-beta/resource_cloud_scheduler_job.go @@ -285,7 +285,7 @@ func resourceCloudSchedulerJobCreate(d *schema.ResourceData, meta interface{}) e obj["httpTarget"] = httpTargetProp } - url, err := replaceVars(d, config, "https://cloudscheduler.googleapis.com/v1/projects/{{project}}/locations/{{region}}/jobs") + url, err := replaceVars(d, config, "{{CloudSchedulerBasePath}}projects/{{project}}/locations/{{region}}/jobs") if err != nil { return err } @@ -311,7 +311,7 @@ func resourceCloudSchedulerJobCreate(d *schema.ResourceData, meta interface{}) e func resourceCloudSchedulerJobRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://cloudscheduler.googleapis.com/v1/projects/{{project}}/locations/{{region}}/jobs/{{name}}") + url, err := replaceVars(d, config, "{{CloudSchedulerBasePath}}projects/{{project}}/locations/{{region}}/jobs/{{name}}") if err != nil { return err } @@ -368,7 +368,7 @@ func resourceCloudSchedulerJobRead(d *schema.ResourceData, meta interface{}) err func resourceCloudSchedulerJobDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://cloudscheduler.googleapis.com/v1/projects/{{project}}/locations/{{region}}/jobs/{{name}}") + url, err := replaceVars(d, config, "{{CloudSchedulerBasePath}}projects/{{project}}/locations/{{region}}/jobs/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_cloud_scheduler_job_generated_test.go b/google-beta/resource_cloud_scheduler_job_generated_test.go index 49616d2941..97002950a2 100644 --- a/google-beta/resource_cloud_scheduler_job_generated_test.go +++ b/google-beta/resource_cloud_scheduler_job_generated_test.go @@ -168,7 +168,7 @@ func testAccCheckCloudSchedulerJobDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://cloudscheduler.googleapis.com/v1/projects/{{project}}/locations/{{region}}/jobs/{{name}}") + url, err := replaceVarsForTest(rs, "{{CloudSchedulerBasePath}}projects/{{project}}/locations/{{region}}/jobs/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_address.go b/google-beta/resource_compute_address.go index bbca640d57..1acf63587a 100644 --- a/google-beta/resource_compute_address.go +++ b/google-beta/resource_compute_address.go @@ -181,7 +181,7 @@ func resourceComputeAddressCreate(d *schema.ResourceData, meta interface{}) erro obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/addresses") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses") if err != nil { return err } @@ -238,7 +238,7 @@ func resourceComputeAddressCreate(d *schema.ResourceData, meta interface{}) erro labelFingerprintProp := d.Get("label_fingerprint") obj["labelFingerprint"] = labelFingerprintProp - url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/addresses/{{name}}/setLabels") + url, err = replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}/setLabels") if err != nil { return err } @@ -268,7 +268,7 @@ func resourceComputeAddressCreate(d *schema.ResourceData, meta interface{}) erro func resourceComputeAddressRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/addresses/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}") if err != nil { return err } @@ -346,7 +346,7 @@ func resourceComputeAddressUpdate(d *schema.ResourceData, meta interface{}) erro obj["labelFingerprint"] = labelFingerprintProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/addresses/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}/setLabels") if err != nil { return err } @@ -385,7 +385,7 @@ func resourceComputeAddressUpdate(d *schema.ResourceData, meta interface{}) erro func resourceComputeAddressDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/addresses/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_address_generated_test.go b/google-beta/resource_compute_address_generated_test.go index 0af74708b8..26b3c0ff51 100644 --- a/google-beta/resource_compute_address_generated_test.go +++ b/google-beta/resource_compute_address_generated_test.go @@ -170,7 +170,7 @@ func testAccCheckComputeAddressDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/addresses/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_autoscaler.go b/google-beta/resource_compute_autoscaler.go index 9dbd23f479..7cc9ebed2f 100644 --- a/google-beta/resource_compute_autoscaler.go +++ b/google-beta/resource_compute_autoscaler.go @@ -197,7 +197,7 @@ func resourceComputeAutoscalerCreate(d *schema.ResourceData, meta interface{}) e obj["zone"] = zoneProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/autoscalers") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/autoscalers") if err != nil { return err } @@ -243,7 +243,7 @@ func resourceComputeAutoscalerCreate(d *schema.ResourceData, meta interface{}) e func resourceComputeAutoscalerRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}") if err != nil { return err } @@ -321,7 +321,7 @@ func resourceComputeAutoscalerUpdate(d *schema.ResourceData, meta interface{}) e obj["zone"] = zoneProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/autoscalers?autoscaler={{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/autoscalers?autoscaler={{name}}") if err != nil { return err } @@ -357,7 +357,7 @@ func resourceComputeAutoscalerUpdate(d *schema.ResourceData, meta interface{}) e func resourceComputeAutoscalerDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_autoscaler_generated_test.go b/google-beta/resource_compute_autoscaler_generated_test.go index dfc9a30907..6ca6915fc6 100644 --- a/google-beta/resource_compute_autoscaler_generated_test.go +++ b/google-beta/resource_compute_autoscaler_generated_test.go @@ -224,7 +224,7 @@ func testAccCheckComputeAutoscalerDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_backend_bucket.go b/google-beta/resource_compute_backend_bucket.go index 74baea5fb2..39a92bb1d4 100644 --- a/google-beta/resource_compute_backend_bucket.go +++ b/google-beta/resource_compute_backend_bucket.go @@ -129,7 +129,7 @@ func resourceComputeBackendBucketCreate(d *schema.ResourceData, meta interface{} obj["name"] = nameProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets") if err != nil { return err } @@ -175,7 +175,7 @@ func resourceComputeBackendBucketCreate(d *schema.ResourceData, meta interface{} func resourceComputeBackendBucketRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{name}}") if err != nil { return err } @@ -253,7 +253,7 @@ func resourceComputeBackendBucketUpdate(d *schema.ResourceData, meta interface{} obj["name"] = nameProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{name}}") if err != nil { return err } @@ -289,7 +289,7 @@ func resourceComputeBackendBucketUpdate(d *schema.ResourceData, meta interface{} func resourceComputeBackendBucketDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_backend_bucket_generated_test.go b/google-beta/resource_compute_backend_bucket_generated_test.go index 0ab0235ac0..852cee4145 100644 --- a/google-beta/resource_compute_backend_bucket_generated_test.go +++ b/google-beta/resource_compute_backend_bucket_generated_test.go @@ -75,7 +75,7 @@ func testAccCheckComputeBackendBucketDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_backend_bucket_signed_url_key.go b/google-beta/resource_compute_backend_bucket_signed_url_key.go index 229637f1c0..e721498d87 100644 --- a/google-beta/resource_compute_backend_bucket_signed_url_key.go +++ b/google-beta/resource_compute_backend_bucket_signed_url_key.go @@ -94,7 +94,7 @@ func resourceComputeBackendBucketSignedUrlKeyCreate(d *schema.ResourceData, meta mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets/{{backend_bucket}}/addSignedUrlKey") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{backend_bucket}}/addSignedUrlKey") if err != nil { return err } @@ -140,7 +140,7 @@ func resourceComputeBackendBucketSignedUrlKeyCreate(d *schema.ResourceData, meta func resourceComputeBackendBucketSignedUrlKeyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets/{{backend_bucket}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{backend_bucket}}") if err != nil { return err } @@ -187,7 +187,7 @@ func resourceComputeBackendBucketSignedUrlKeyDelete(d *schema.ResourceData, meta mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendBuckets/{{backend_bucket}}/deleteSignedUrlKey?keyName={{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{backend_bucket}}/deleteSignedUrlKey?keyName={{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_backend_bucket_signed_url_key_test.go b/google-beta/resource_compute_backend_bucket_signed_url_key_test.go index 23aaeaa903..7e4a9c5225 100644 --- a/google-beta/resource_compute_backend_bucket_signed_url_key_test.go +++ b/google-beta/resource_compute_backend_bucket_signed_url_key_test.go @@ -86,7 +86,7 @@ func checkComputeBackendBucketSignedUrlKeyExists(s *terraform.State) (bool, erro config := testAccProvider.Meta().(*Config) keyName := rs.Primary.ID - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/backendBuckets/{{backend_bucket}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/backendBuckets/{{backend_bucket}}") if err != nil { return false, err } diff --git a/google-beta/resource_compute_backend_service.go b/google-beta/resource_compute_backend_service.go index 27782c5e51..2409baec87 100644 --- a/google-beta/resource_compute_backend_service.go +++ b/google-beta/resource_compute_backend_service.go @@ -474,7 +474,7 @@ func resourceComputeBackendServiceCreate(d *schema.ResourceData, meta interface{ return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendServices") if err != nil { return err } @@ -539,7 +539,7 @@ func resourceComputeBackendServiceCreate(d *schema.ResourceData, meta interface{ func resourceComputeBackendServiceRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{name}}") if err != nil { return err } @@ -742,7 +742,7 @@ func resourceComputeBackendServiceUpdate(d *schema.ResourceData, meta interface{ return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{name}}") if err != nil { return err } @@ -796,7 +796,7 @@ func resourceComputeBackendServiceUpdate(d *schema.ResourceData, meta interface{ func resourceComputeBackendServiceDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_backend_service_generated_test.go b/google-beta/resource_compute_backend_service_generated_test.go index 1d77ee2234..694a33d0c7 100644 --- a/google-beta/resource_compute_backend_service_generated_test.go +++ b/google-beta/resource_compute_backend_service_generated_test.go @@ -75,7 +75,7 @@ func testAccCheckComputeBackendServiceDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_backend_service_signed_url_key.go b/google-beta/resource_compute_backend_service_signed_url_key.go index c997ee2304..c1654eb0d9 100644 --- a/google-beta/resource_compute_backend_service_signed_url_key.go +++ b/google-beta/resource_compute_backend_service_signed_url_key.go @@ -94,7 +94,7 @@ func resourceComputeBackendServiceSignedUrlKeyCreate(d *schema.ResourceData, met mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices/{{backend_service}}/addSignedUrlKey") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{backend_service}}/addSignedUrlKey") if err != nil { return err } @@ -140,7 +140,7 @@ func resourceComputeBackendServiceSignedUrlKeyCreate(d *schema.ResourceData, met func resourceComputeBackendServiceSignedUrlKeyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices/{{backend_service}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{backend_service}}") if err != nil { return err } @@ -187,7 +187,7 @@ func resourceComputeBackendServiceSignedUrlKeyDelete(d *schema.ResourceData, met mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/backendServices/{{backend_service}}/deleteSignedUrlKey?keyName={{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{backend_service}}/deleteSignedUrlKey?keyName={{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_backend_service_signed_url_key_test.go b/google-beta/resource_compute_backend_service_signed_url_key_test.go index 7d22301aca..27fbfa363f 100644 --- a/google-beta/resource_compute_backend_service_signed_url_key_test.go +++ b/google-beta/resource_compute_backend_service_signed_url_key_test.go @@ -86,7 +86,7 @@ func checkComputeBackendServiceSignedUrlKeyExists(s *terraform.State) (bool, err config := testAccProvider.Meta().(*Config) keyName := rs.Primary.ID - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/backendServices/{{backend_service}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/backendServices/{{backend_service}}") if err != nil { return false, err } diff --git a/google-beta/resource_compute_disk.go b/google-beta/resource_compute_disk.go index 9a96ad0397..3a8cb97704 100644 --- a/google-beta/resource_compute_disk.go +++ b/google-beta/resource_compute_disk.go @@ -518,7 +518,7 @@ func resourceComputeDiskCreate(d *schema.ResourceData, meta interface{}) error { return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/disks") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/disks") if err != nil { return err } @@ -564,7 +564,7 @@ func resourceComputeDiskCreate(d *schema.ResourceData, meta interface{}) error { func resourceComputeDiskRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/disks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/disks/{{name}}") if err != nil { return err } @@ -671,7 +671,7 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error { obj["labels"] = labelsProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/disks/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/disks/{{name}}/setLabels") if err != nil { return err } @@ -710,7 +710,7 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error { obj["sizeGb"] = sizeGbProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/disks/{{name}}/resize") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/disks/{{name}}/resize") if err != nil { return err } @@ -748,7 +748,7 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error { func resourceComputeDiskDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/disks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/disks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_disk_generated_test.go b/google-beta/resource_compute_disk_generated_test.go index 6ee51ae81f..5731c62633 100644 --- a/google-beta/resource_compute_disk_generated_test.go +++ b/google-beta/resource_compute_disk_generated_test.go @@ -74,7 +74,7 @@ func testAccCheckComputeDiskDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/disks/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/disks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_firewall.go b/google-beta/resource_compute_firewall.go index 20d9e57c3b..3e1b99ebda 100644 --- a/google-beta/resource_compute_firewall.go +++ b/google-beta/resource_compute_firewall.go @@ -326,7 +326,7 @@ func resourceComputeFirewallCreate(d *schema.ResourceData, meta interface{}) err obj["targetTags"] = targetTagsProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/firewalls") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/firewalls") if err != nil { return err } @@ -372,7 +372,7 @@ func resourceComputeFirewallCreate(d *schema.ResourceData, meta interface{}) err func resourceComputeFirewallRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/firewalls/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/firewalls/{{name}}") if err != nil { return err } @@ -528,7 +528,7 @@ func resourceComputeFirewallUpdate(d *schema.ResourceData, meta interface{}) err obj["targetTags"] = targetTagsProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/firewalls/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/firewalls/{{name}}") if err != nil { return err } @@ -564,7 +564,7 @@ func resourceComputeFirewallUpdate(d *schema.ResourceData, meta interface{}) err func resourceComputeFirewallDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/firewalls/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/firewalls/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_firewall_generated_test.go b/google-beta/resource_compute_firewall_generated_test.go index 079be81da6..52e7feafc8 100644 --- a/google-beta/resource_compute_firewall_generated_test.go +++ b/google-beta/resource_compute_firewall_generated_test.go @@ -83,7 +83,7 @@ func testAccCheckComputeFirewallDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/firewalls/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/firewalls/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_forwarding_rule.go b/google-beta/resource_compute_forwarding_rule.go index 27b4ac3fab..68f0288d48 100644 --- a/google-beta/resource_compute_forwarding_rule.go +++ b/google-beta/resource_compute_forwarding_rule.go @@ -292,7 +292,7 @@ func resourceComputeForwardingRuleCreate(d *schema.ResourceData, meta interface{ obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/forwardingRules") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/forwardingRules") if err != nil { return err } @@ -349,7 +349,7 @@ func resourceComputeForwardingRuleCreate(d *schema.ResourceData, meta interface{ labelFingerprintProp := d.Get("label_fingerprint") obj["labelFingerprint"] = labelFingerprintProp - url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setLabels") + url, err = replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setLabels") if err != nil { return err } @@ -379,7 +379,7 @@ func resourceComputeForwardingRuleCreate(d *schema.ResourceData, meta interface{ func resourceComputeForwardingRuleRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}") if err != nil { return err } @@ -478,7 +478,7 @@ func resourceComputeForwardingRuleUpdate(d *schema.ResourceData, meta interface{ obj["target"] = targetProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setTarget") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setTarget") if err != nil { return err } @@ -522,7 +522,7 @@ func resourceComputeForwardingRuleUpdate(d *schema.ResourceData, meta interface{ obj["labelFingerprint"] = labelFingerprintProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}/setLabels") if err != nil { return err } @@ -561,7 +561,7 @@ func resourceComputeForwardingRuleUpdate(d *schema.ResourceData, meta interface{ func resourceComputeForwardingRuleDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}") if err != nil { return err } @@ -734,7 +734,7 @@ func expandComputeForwardingRuleBackendService(v interface{}, d TerraformResourc return "https://www.googleapis.com/compute/v1/" + v.(string), nil } else if strings.HasPrefix(v.(string), "regions/") || strings.HasPrefix(v.(string), "zones/") { // For regional or zonal resources which include their region or zone, just put the project in front. - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/") if err != nil { return nil, err } @@ -743,7 +743,7 @@ func expandComputeForwardingRuleBackendService(v interface{}, d TerraformResourc // Anything else is assumed to be a regional resource, with a partial link that begins with the resource name. // This isn't very likely - it's a last-ditch effort to extract something useful here. We can do a better job // as soon as MultiResourceRefs are working since we'll know the types that this field is supposed to point to. - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/regions/{{region}}/") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/") if err != nil { return nil, err } @@ -799,7 +799,7 @@ func expandComputeForwardingRuleTarget(v interface{}, d TerraformResourceData, c return "https://www.googleapis.com/compute/v1/" + v.(string), nil } else if strings.HasPrefix(v.(string), "regions/") || strings.HasPrefix(v.(string), "zones/") { // For regional or zonal resources which include their region or zone, just put the project in front. - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/") if err != nil { return nil, err } @@ -808,7 +808,7 @@ func expandComputeForwardingRuleTarget(v interface{}, d TerraformResourceData, c // Anything else is assumed to be a regional resource, with a partial link that begins with the resource name. // This isn't very likely - it's a last-ditch effort to extract something useful here. We can do a better job // as soon as MultiResourceRefs are working since we'll know the types that this field is supposed to point to. - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/regions/{{region}}/") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/") if err != nil { return nil, err } diff --git a/google-beta/resource_compute_forwarding_rule_generated_test.go b/google-beta/resource_compute_forwarding_rule_generated_test.go index cfcff69fe9..b753fcfede 100644 --- a/google-beta/resource_compute_forwarding_rule_generated_test.go +++ b/google-beta/resource_compute_forwarding_rule_generated_test.go @@ -141,7 +141,7 @@ func testAccCheckComputeForwardingRuleDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_global_address.go b/google-beta/resource_compute_global_address.go index 5e3032637c..bf97da0299 100644 --- a/google-beta/resource_compute_global_address.go +++ b/google-beta/resource_compute_global_address.go @@ -184,7 +184,7 @@ func resourceComputeGlobalAddressCreate(d *schema.ResourceData, meta interface{} obj["network"] = networkProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/addresses") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/addresses") if err != nil { return err } @@ -241,7 +241,7 @@ func resourceComputeGlobalAddressCreate(d *schema.ResourceData, meta interface{} labelFingerprintProp := d.Get("label_fingerprint") obj["labelFingerprint"] = labelFingerprintProp - url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/addresses/{{name}}/setLabels") + url, err = replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/addresses/{{name}}/setLabels") if err != nil { return err } @@ -271,7 +271,7 @@ func resourceComputeGlobalAddressCreate(d *schema.ResourceData, meta interface{} func resourceComputeGlobalAddressRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/addresses/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/addresses/{{name}}") if err != nil { return err } @@ -349,7 +349,7 @@ func resourceComputeGlobalAddressUpdate(d *schema.ResourceData, meta interface{} obj["labelFingerprint"] = labelFingerprintProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/addresses/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/addresses/{{name}}/setLabels") if err != nil { return err } @@ -388,7 +388,7 @@ func resourceComputeGlobalAddressUpdate(d *schema.ResourceData, meta interface{} func resourceComputeGlobalAddressDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/addresses/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/addresses/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_global_address_generated_test.go b/google-beta/resource_compute_global_address_generated_test.go index c8aeafceb8..4b07e1c631 100644 --- a/google-beta/resource_compute_global_address_generated_test.go +++ b/google-beta/resource_compute_global_address_generated_test.go @@ -67,7 +67,7 @@ func testAccCheckComputeGlobalAddressDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/addresses/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/addresses/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_global_forwarding_rule.go b/google-beta/resource_compute_global_forwarding_rule.go index 38c822a7df..6865e89437 100644 --- a/google-beta/resource_compute_global_forwarding_rule.go +++ b/google-beta/resource_compute_global_forwarding_rule.go @@ -192,7 +192,7 @@ func resourceComputeGlobalForwardingRuleCreate(d *schema.ResourceData, meta inte obj["target"] = targetProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/forwardingRules") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/forwardingRules") if err != nil { return err } @@ -249,7 +249,7 @@ func resourceComputeGlobalForwardingRuleCreate(d *schema.ResourceData, meta inte labelFingerprintProp := d.Get("label_fingerprint") obj["labelFingerprint"] = labelFingerprintProp - url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/forwardingRules/{{name}}/setLabels") + url, err = replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/forwardingRules/{{name}}/setLabels") if err != nil { return err } @@ -279,7 +279,7 @@ func resourceComputeGlobalForwardingRuleCreate(d *schema.ResourceData, meta inte func resourceComputeGlobalForwardingRuleRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/forwardingRules/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/forwardingRules/{{name}}") if err != nil { return err } @@ -357,7 +357,7 @@ func resourceComputeGlobalForwardingRuleUpdate(d *schema.ResourceData, meta inte obj["labelFingerprint"] = labelFingerprintProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/forwardingRules/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/forwardingRules/{{name}}/setLabels") if err != nil { return err } @@ -396,7 +396,7 @@ func resourceComputeGlobalForwardingRuleUpdate(d *schema.ResourceData, meta inte obj["target"] = targetProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/forwardingRules/{{name}}/setTarget") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/forwardingRules/{{name}}/setTarget") if err != nil { return err } @@ -434,7 +434,7 @@ func resourceComputeGlobalForwardingRuleUpdate(d *schema.ResourceData, meta inte func resourceComputeGlobalForwardingRuleDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/forwardingRules/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/forwardingRules/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_global_forwarding_rule_generated_test.go b/google-beta/resource_compute_global_forwarding_rule_generated_test.go index 794104f9ca..33efe8db5a 100644 --- a/google-beta/resource_compute_global_forwarding_rule_generated_test.go +++ b/google-beta/resource_compute_global_forwarding_rule_generated_test.go @@ -236,7 +236,7 @@ func testAccCheckComputeGlobalForwardingRuleDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/forwardingRules/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/forwardingRules/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_ha_vpn_gateway.go b/google-beta/resource_compute_ha_vpn_gateway.go index 4419337485..a959cdd67d 100644 --- a/google-beta/resource_compute_ha_vpn_gateway.go +++ b/google-beta/resource_compute_ha_vpn_gateway.go @@ -124,7 +124,7 @@ func resourceComputeHaVpnGatewayCreate(d *schema.ResourceData, meta interface{}) obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnGateways") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnGateways") if err != nil { return err } @@ -170,7 +170,7 @@ func resourceComputeHaVpnGatewayCreate(d *schema.ResourceData, meta interface{}) func resourceComputeHaVpnGatewayRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}") if err != nil { return err } @@ -213,7 +213,7 @@ func resourceComputeHaVpnGatewayRead(d *schema.ResourceData, meta interface{}) e func resourceComputeHaVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_ha_vpn_gateway_generated_test.go b/google-beta/resource_compute_ha_vpn_gateway_generated_test.go index d742c25e6b..2b1131ae90 100644 --- a/google-beta/resource_compute_ha_vpn_gateway_generated_test.go +++ b/google-beta/resource_compute_ha_vpn_gateway_generated_test.go @@ -296,7 +296,7 @@ func testAccCheckComputeHaVpnGatewayDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_health_check.go b/google-beta/resource_compute_health_check.go index 354bfea8b1..edcb6a4dde 100644 --- a/google-beta/resource_compute_health_check.go +++ b/google-beta/resource_compute_health_check.go @@ -291,7 +291,7 @@ func resourceComputeHealthCheckCreate(d *schema.ResourceData, meta interface{}) return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/healthChecks") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/healthChecks") if err != nil { return err } @@ -337,7 +337,7 @@ func resourceComputeHealthCheckCreate(d *schema.ResourceData, meta interface{}) func resourceComputeHealthCheckRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/healthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/healthChecks/{{name}}") if err != nil { return err } @@ -468,7 +468,7 @@ func resourceComputeHealthCheckUpdate(d *schema.ResourceData, meta interface{}) return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/healthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/healthChecks/{{name}}") if err != nil { return err } @@ -504,7 +504,7 @@ func resourceComputeHealthCheckUpdate(d *schema.ResourceData, meta interface{}) func resourceComputeHealthCheckDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/healthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/healthChecks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_health_check_generated_test.go b/google-beta/resource_compute_health_check_generated_test.go index 3c4888dec8..39d77a0550 100644 --- a/google-beta/resource_compute_health_check_generated_test.go +++ b/google-beta/resource_compute_health_check_generated_test.go @@ -74,7 +74,7 @@ func testAccCheckComputeHealthCheckDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/healthChecks/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/healthChecks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_http_health_check.go b/google-beta/resource_compute_http_health_check.go index a0494533ad..1d2aeb4f33 100644 --- a/google-beta/resource_compute_http_health_check.go +++ b/google-beta/resource_compute_http_health_check.go @@ -163,7 +163,7 @@ func resourceComputeHttpHealthCheckCreate(d *schema.ResourceData, meta interface obj["unhealthyThreshold"] = unhealthyThresholdProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpHealthChecks") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpHealthChecks") if err != nil { return err } @@ -209,7 +209,7 @@ func resourceComputeHttpHealthCheckCreate(d *schema.ResourceData, meta interface func resourceComputeHttpHealthCheckRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpHealthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpHealthChecks/{{name}}") if err != nil { return err } @@ -323,7 +323,7 @@ func resourceComputeHttpHealthCheckUpdate(d *schema.ResourceData, meta interface obj["unhealthyThreshold"] = unhealthyThresholdProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpHealthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpHealthChecks/{{name}}") if err != nil { return err } @@ -359,7 +359,7 @@ func resourceComputeHttpHealthCheckUpdate(d *schema.ResourceData, meta interface func resourceComputeHttpHealthCheckDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpHealthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpHealthChecks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_http_health_check_generated_test.go b/google-beta/resource_compute_http_health_check_generated_test.go index b57e0f0db4..b67a225764 100644 --- a/google-beta/resource_compute_http_health_check_generated_test.go +++ b/google-beta/resource_compute_http_health_check_generated_test.go @@ -71,7 +71,7 @@ func testAccCheckComputeHttpHealthCheckDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpHealthChecks/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/httpHealthChecks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_https_health_check.go b/google-beta/resource_compute_https_health_check.go index 01ff31441f..8a37c601ca 100644 --- a/google-beta/resource_compute_https_health_check.go +++ b/google-beta/resource_compute_https_health_check.go @@ -163,7 +163,7 @@ func resourceComputeHttpsHealthCheckCreate(d *schema.ResourceData, meta interfac obj["unhealthyThreshold"] = unhealthyThresholdProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpsHealthChecks") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpsHealthChecks") if err != nil { return err } @@ -209,7 +209,7 @@ func resourceComputeHttpsHealthCheckCreate(d *schema.ResourceData, meta interfac func resourceComputeHttpsHealthCheckRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpsHealthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpsHealthChecks/{{name}}") if err != nil { return err } @@ -323,7 +323,7 @@ func resourceComputeHttpsHealthCheckUpdate(d *schema.ResourceData, meta interfac obj["unhealthyThreshold"] = unhealthyThresholdProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpsHealthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpsHealthChecks/{{name}}") if err != nil { return err } @@ -359,7 +359,7 @@ func resourceComputeHttpsHealthCheckUpdate(d *schema.ResourceData, meta interfac func resourceComputeHttpsHealthCheckDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpsHealthChecks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/httpsHealthChecks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_https_health_check_generated_test.go b/google-beta/resource_compute_https_health_check_generated_test.go index 807693b44e..2f431a7c5b 100644 --- a/google-beta/resource_compute_https_health_check_generated_test.go +++ b/google-beta/resource_compute_https_health_check_generated_test.go @@ -71,7 +71,7 @@ func testAccCheckComputeHttpsHealthCheckDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/httpsHealthChecks/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/httpsHealthChecks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_image.go b/google-beta/resource_compute_image.go index 26730c082c..643492f360 100644 --- a/google-beta/resource_compute_image.go +++ b/google-beta/resource_compute_image.go @@ -198,7 +198,7 @@ func resourceComputeImageCreate(d *schema.ResourceData, meta interface{}) error obj["sourceDisk"] = sourceDiskProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/images") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/images") if err != nil { return err } @@ -244,7 +244,7 @@ func resourceComputeImageCreate(d *schema.ResourceData, meta interface{}) error func resourceComputeImageRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/images/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/images/{{name}}") if err != nil { return err } @@ -319,7 +319,7 @@ func resourceComputeImageUpdate(d *schema.ResourceData, meta interface{}) error obj["labelFingerprint"] = labelFingerprintProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/images/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/images/{{name}}/setLabels") if err != nil { return err } @@ -358,7 +358,7 @@ func resourceComputeImageUpdate(d *schema.ResourceData, meta interface{}) error func resourceComputeImageDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/images/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/images/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_image_generated_test.go b/google-beta/resource_compute_image_generated_test.go index 4639c87fce..f6027b23dd 100644 --- a/google-beta/resource_compute_image_generated_test.go +++ b/google-beta/resource_compute_image_generated_test.go @@ -72,7 +72,7 @@ func testAccCheckComputeImageDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/images/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/images/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_interconnect_attachment.go b/google-beta/resource_compute_interconnect_attachment.go index 8bd88e9914..11a67dcd82 100644 --- a/google-beta/resource_compute_interconnect_attachment.go +++ b/google-beta/resource_compute_interconnect_attachment.go @@ -212,7 +212,7 @@ func resourceComputeInterconnectAttachmentCreate(d *schema.ResourceData, meta in obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/interconnectAttachments") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/interconnectAttachments") if err != nil { return err } @@ -258,7 +258,7 @@ func resourceComputeInterconnectAttachmentCreate(d *schema.ResourceData, meta in func resourceComputeInterconnectAttachmentRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/interconnectAttachments/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/interconnectAttachments/{{name}}") if err != nil { return err } @@ -337,7 +337,7 @@ func resourceComputeInterconnectAttachmentRead(d *schema.ResourceData, meta inte func resourceComputeInterconnectAttachmentDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/interconnectAttachments/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/interconnectAttachments/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_managed_ssl_certificate.go b/google-beta/resource_compute_managed_ssl_certificate.go index a86c75dea6..c02d9ecb78 100644 --- a/google-beta/resource_compute_managed_ssl_certificate.go +++ b/google-beta/resource_compute_managed_ssl_certificate.go @@ -142,7 +142,7 @@ func resourceComputeManagedSslCertificateCreate(d *schema.ResourceData, meta int obj["type"] = typeProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates") if err != nil { return err } @@ -188,7 +188,7 @@ func resourceComputeManagedSslCertificateCreate(d *schema.ResourceData, meta int func resourceComputeManagedSslCertificateRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates/{{name}}") if err != nil { return err } @@ -240,7 +240,7 @@ func resourceComputeManagedSslCertificateRead(d *schema.ResourceData, meta inter func resourceComputeManagedSslCertificateDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_managed_ssl_certificate_generated_test.go b/google-beta/resource_compute_managed_ssl_certificate_generated_test.go index fd7ea62e64..afa74c7165 100644 --- a/google-beta/resource_compute_managed_ssl_certificate_generated_test.go +++ b/google-beta/resource_compute_managed_ssl_certificate_generated_test.go @@ -150,7 +150,7 @@ func testAccCheckComputeManagedSslCertificateDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_network.go b/google-beta/resource_compute_network.go index d81c950acc..03baffd6f2 100644 --- a/google-beta/resource_compute_network.go +++ b/google-beta/resource_compute_network.go @@ -135,7 +135,7 @@ func resourceComputeNetworkCreate(d *schema.ResourceData, meta interface{}) erro return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/networks") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/networks") if err != nil { return err } @@ -210,7 +210,7 @@ func resourceComputeNetworkCreate(d *schema.ResourceData, meta interface{}) erro func resourceComputeNetworkRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/networks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/networks/{{name}}") if err != nil { return err } @@ -279,7 +279,7 @@ func resourceComputeNetworkUpdate(d *schema.ResourceData, meta interface{}) erro obj["routingConfig"] = routingConfigProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/networks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/networks/{{name}}") if err != nil { return err } @@ -317,7 +317,7 @@ func resourceComputeNetworkUpdate(d *schema.ResourceData, meta interface{}) erro func resourceComputeNetworkDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/networks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/networks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_network_endpoint.go b/google-beta/resource_compute_network_endpoint.go index 63b77e0df7..aa7c9542e6 100644 --- a/google-beta/resource_compute_network_endpoint.go +++ b/google-beta/resource_compute_network_endpoint.go @@ -114,7 +114,7 @@ func resourceComputeNetworkEndpointCreate(d *schema.ResourceData, meta interface mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/attachNetworkEndpoints") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/attachNetworkEndpoints") if err != nil { return err } @@ -160,7 +160,7 @@ func resourceComputeNetworkEndpointCreate(d *schema.ResourceData, meta interface func resourceComputeNetworkEndpointRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/listNetworkEndpoints") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/listNetworkEndpoints") if err != nil { return err } @@ -218,7 +218,7 @@ func resourceComputeNetworkEndpointDelete(d *schema.ResourceData, meta interface mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/detachNetworkEndpoints") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/detachNetworkEndpoints") if err != nil { return err } diff --git a/google-beta/resource_compute_network_endpoint_group.go b/google-beta/resource_compute_network_endpoint_group.go index 19572f9581..69d42eb600 100644 --- a/google-beta/resource_compute_network_endpoint_group.go +++ b/google-beta/resource_compute_network_endpoint_group.go @@ -145,7 +145,7 @@ func resourceComputeNetworkEndpointGroupCreate(d *schema.ResourceData, meta inte obj["zone"] = zoneProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/networkEndpointGroups") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups") if err != nil { return err } @@ -191,7 +191,7 @@ func resourceComputeNetworkEndpointGroupCreate(d *schema.ResourceData, meta inte func resourceComputeNetworkEndpointGroupRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{name}}") if err != nil { return err } @@ -240,7 +240,7 @@ func resourceComputeNetworkEndpointGroupRead(d *schema.ResourceData, meta interf func resourceComputeNetworkEndpointGroupDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_network_endpoint_group_generated_test.go b/google-beta/resource_compute_network_endpoint_group_generated_test.go index 5873ff11ae..cd2a27257a 100644 --- a/google-beta/resource_compute_network_endpoint_group_generated_test.go +++ b/google-beta/resource_compute_network_endpoint_group_generated_test.go @@ -89,7 +89,7 @@ func testAccCheckComputeNetworkEndpointGroupDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_network_generated_test.go b/google-beta/resource_compute_network_generated_test.go index f821200998..2b5d9fffcd 100644 --- a/google-beta/resource_compute_network_generated_test.go +++ b/google-beta/resource_compute_network_generated_test.go @@ -67,7 +67,7 @@ func testAccCheckComputeNetworkDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/networks/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/networks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_node_group.go b/google-beta/resource_compute_node_group.go index 3808c77b63..48c646c4ba 100644 --- a/google-beta/resource_compute_node_group.go +++ b/google-beta/resource_compute_node_group.go @@ -123,7 +123,7 @@ func resourceComputeNodeGroupCreate(d *schema.ResourceData, meta interface{}) er obj["zone"] = zoneProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/nodeGroups?initialNodeCount={{size}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/nodeGroups?initialNodeCount={{size}}") if err != nil { return err } @@ -169,7 +169,7 @@ func resourceComputeNodeGroupCreate(d *schema.ResourceData, meta interface{}) er func resourceComputeNodeGroupRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}") if err != nil { return err } @@ -226,7 +226,7 @@ func resourceComputeNodeGroupUpdate(d *schema.ResourceData, meta interface{}) er obj["nodeTemplate"] = nodeTemplateProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}/setNodeTemplate") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}/setNodeTemplate") if err != nil { return err } @@ -264,7 +264,7 @@ func resourceComputeNodeGroupUpdate(d *schema.ResourceData, meta interface{}) er func resourceComputeNodeGroupDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_node_group_generated_test.go b/google-beta/resource_compute_node_group_generated_test.go index 4791693a46..b0754c45bf 100644 --- a/google-beta/resource_compute_node_group_generated_test.go +++ b/google-beta/resource_compute_node_group_generated_test.go @@ -82,7 +82,7 @@ func testAccCheckComputeNodeGroupDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_node_template.go b/google-beta/resource_compute_node_template.go index 62b38fda01..4b3d5e0439 100644 --- a/google-beta/resource_compute_node_template.go +++ b/google-beta/resource_compute_node_template.go @@ -177,7 +177,7 @@ func resourceComputeNodeTemplateCreate(d *schema.ResourceData, meta interface{}) obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/nodeTemplates") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/nodeTemplates") if err != nil { return err } @@ -223,7 +223,7 @@ func resourceComputeNodeTemplateCreate(d *schema.ResourceData, meta interface{}) func resourceComputeNodeTemplateRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}") if err != nil { return err } @@ -275,7 +275,7 @@ func resourceComputeNodeTemplateRead(d *schema.ResourceData, meta interface{}) e func resourceComputeNodeTemplateDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_node_template_generated_test.go b/google-beta/resource_compute_node_template_generated_test.go index 3d3b8a2601..bfa39ff884 100644 --- a/google-beta/resource_compute_node_template_generated_test.go +++ b/google-beta/resource_compute_node_template_generated_test.go @@ -122,7 +122,7 @@ func testAccCheckComputeNodeTemplateDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_region_autoscaler.go b/google-beta/resource_compute_region_autoscaler.go index 2829adbc81..c7caf9d807 100644 --- a/google-beta/resource_compute_region_autoscaler.go +++ b/google-beta/resource_compute_region_autoscaler.go @@ -197,7 +197,7 @@ func resourceComputeRegionAutoscalerCreate(d *schema.ResourceData, meta interfac obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/autoscalers") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/autoscalers") if err != nil { return err } @@ -243,7 +243,7 @@ func resourceComputeRegionAutoscalerCreate(d *schema.ResourceData, meta interfac func resourceComputeRegionAutoscalerRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/autoscalers/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/autoscalers/{{name}}") if err != nil { return err } @@ -321,7 +321,7 @@ func resourceComputeRegionAutoscalerUpdate(d *schema.ResourceData, meta interfac obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/autoscalers?autoscaler={{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/autoscalers?autoscaler={{name}}") if err != nil { return err } @@ -357,7 +357,7 @@ func resourceComputeRegionAutoscalerUpdate(d *schema.ResourceData, meta interfac func resourceComputeRegionAutoscalerDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/autoscalers/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/autoscalers/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_region_autoscaler_generated_test.go b/google-beta/resource_compute_region_autoscaler_generated_test.go index c0852fe161..5522ced9d9 100644 --- a/google-beta/resource_compute_region_autoscaler_generated_test.go +++ b/google-beta/resource_compute_region_autoscaler_generated_test.go @@ -222,7 +222,7 @@ func testAccCheckComputeRegionAutoscalerDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/autoscalers/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/autoscalers/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_region_backend_service.go b/google-beta/resource_compute_region_backend_service.go index 634bd2be91..7ebaeba822 100644 --- a/google-beta/resource_compute_region_backend_service.go +++ b/google-beta/resource_compute_region_backend_service.go @@ -249,7 +249,7 @@ func resourceComputeRegionBackendServiceCreate(d *schema.ResourceData, meta inte obj["loadBalancingScheme"] = loadBalancingSchemeProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/backendServices") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/backendServices") if err != nil { return err } @@ -295,7 +295,7 @@ func resourceComputeRegionBackendServiceCreate(d *schema.ResourceData, meta inte func resourceComputeRegionBackendServiceRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/backendServices/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/backendServices/{{name}}") if err != nil { return err } @@ -440,7 +440,7 @@ func resourceComputeRegionBackendServiceUpdate(d *schema.ResourceData, meta inte obj["loadBalancingScheme"] = loadBalancingSchemeProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/backendServices/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/backendServices/{{name}}") if err != nil { return err } @@ -476,7 +476,7 @@ func resourceComputeRegionBackendServiceUpdate(d *schema.ResourceData, meta inte func resourceComputeRegionBackendServiceDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/backendServices/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/backendServices/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_region_backend_service_generated_test.go b/google-beta/resource_compute_region_backend_service_generated_test.go index 01df998750..fa3cc880d0 100644 --- a/google-beta/resource_compute_region_backend_service_generated_test.go +++ b/google-beta/resource_compute_region_backend_service_generated_test.go @@ -81,7 +81,7 @@ func testAccCheckComputeRegionBackendServiceDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/backendServices/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/backendServices/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_region_disk.go b/google-beta/resource_compute_region_disk.go index c844dfec51..17985f126b 100644 --- a/google-beta/resource_compute_region_disk.go +++ b/google-beta/resource_compute_region_disk.go @@ -278,7 +278,7 @@ func resourceComputeRegionDiskCreate(d *schema.ResourceData, meta interface{}) e return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/disks") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/disks") if err != nil { return err } @@ -324,7 +324,7 @@ func resourceComputeRegionDiskCreate(d *schema.ResourceData, meta interface{}) e func resourceComputeRegionDiskRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/disks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/disks/{{name}}") if err != nil { return err } @@ -425,7 +425,7 @@ func resourceComputeRegionDiskUpdate(d *schema.ResourceData, meta interface{}) e obj["labels"] = labelsProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/disks/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/disks/{{name}}/setLabels") if err != nil { return err } @@ -464,7 +464,7 @@ func resourceComputeRegionDiskUpdate(d *schema.ResourceData, meta interface{}) e obj["sizeGb"] = sizeGbProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/disks/{{name}}/resize") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/disks/{{name}}/resize") if err != nil { return err } @@ -502,7 +502,7 @@ func resourceComputeRegionDiskUpdate(d *schema.ResourceData, meta interface{}) e func resourceComputeRegionDiskDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/disks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/disks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_region_disk_generated_test.go b/google-beta/resource_compute_region_disk_generated_test.go index 3c8e054a78..c3b264f225 100644 --- a/google-beta/resource_compute_region_disk_generated_test.go +++ b/google-beta/resource_compute_region_disk_generated_test.go @@ -87,7 +87,7 @@ func testAccCheckComputeRegionDiskDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/disks/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/disks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_resource_policy.go b/google-beta/resource_compute_resource_policy.go index 0bbb0b19f1..5e2ae7f688 100644 --- a/google-beta/resource_compute_resource_policy.go +++ b/google-beta/resource_compute_resource_policy.go @@ -241,7 +241,7 @@ func resourceComputeResourcePolicyCreate(d *schema.ResourceData, meta interface{ obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/resourcePolicies") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/resourcePolicies") if err != nil { return err } @@ -287,7 +287,7 @@ func resourceComputeResourcePolicyCreate(d *schema.ResourceData, meta interface{ func resourceComputeResourcePolicyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}") if err != nil { return err } @@ -324,7 +324,7 @@ func resourceComputeResourcePolicyRead(d *schema.ResourceData, meta interface{}) func resourceComputeResourcePolicyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_resource_policy_generated_test.go b/google-beta/resource_compute_resource_policy_generated_test.go index 31dabee1d5..821dfb8fb1 100644 --- a/google-beta/resource_compute_resource_policy_generated_test.go +++ b/google-beta/resource_compute_resource_policy_generated_test.go @@ -130,7 +130,7 @@ func testAccCheckComputeResourcePolicyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_route.go b/google-beta/resource_compute_route.go index 5b05129f38..a2995a3394 100644 --- a/google-beta/resource_compute_route.go +++ b/google-beta/resource_compute_route.go @@ -189,7 +189,7 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error obj["nextHopVpnTunnel"] = nextHopVpnTunnelProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/routes") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/routes") if err != nil { return err } @@ -235,7 +235,7 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error func resourceComputeRouteRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/routes/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/routes/{{name}}") if err != nil { return err } @@ -301,7 +301,7 @@ func resourceComputeRouteRead(d *schema.ResourceData, meta interface{}) error { func resourceComputeRouteDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/routes/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/routes/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_route_generated_test.go b/google-beta/resource_compute_route_generated_test.go index ca59670631..a031433a60 100644 --- a/google-beta/resource_compute_route_generated_test.go +++ b/google-beta/resource_compute_route_generated_test.go @@ -75,7 +75,7 @@ func testAccCheckComputeRouteDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/routes/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/routes/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_router.go b/google-beta/resource_compute_router.go index caf211b452..b43d469ab5 100644 --- a/google-beta/resource_compute_router.go +++ b/google-beta/resource_compute_router.go @@ -169,7 +169,7 @@ func resourceComputeRouterCreate(d *schema.ResourceData, meta interface{}) error mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/routers") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/routers") if err != nil { return err } @@ -215,7 +215,7 @@ func resourceComputeRouterCreate(d *schema.ResourceData, meta interface{}) error func resourceComputeRouterRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/routers/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/routers/{{name}}") if err != nil { return err } @@ -282,7 +282,7 @@ func resourceComputeRouterUpdate(d *schema.ResourceData, meta interface{}) error mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/routers/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/routers/{{name}}") if err != nil { return err } @@ -325,7 +325,7 @@ func resourceComputeRouterDelete(d *schema.ResourceData, meta interface{}) error mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/routers/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/routers/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_router_generated_test.go b/google-beta/resource_compute_router_generated_test.go index 34ae3fe60a..a81a760cb7 100644 --- a/google-beta/resource_compute_router_generated_test.go +++ b/google-beta/resource_compute_router_generated_test.go @@ -84,7 +84,7 @@ func testAccCheckComputeRouterDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/routers/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/routers/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_snapshot.go b/google-beta/resource_compute_snapshot.go index 3300d2ecc3..cc2adf90fd 100644 --- a/google-beta/resource_compute_snapshot.go +++ b/google-beta/resource_compute_snapshot.go @@ -232,7 +232,7 @@ func resourceComputeSnapshotCreate(d *schema.ResourceData, meta interface{}) err obj["sourceDiskEncryptionKey"] = sourceDiskEncryptionKeyProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/disks/{{source_disk}}/createSnapshot") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/disks/{{source_disk}}/createSnapshot") if err != nil { return err } @@ -278,7 +278,7 @@ func resourceComputeSnapshotCreate(d *schema.ResourceData, meta interface{}) err func resourceComputeSnapshotRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/snapshots/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/snapshots/{{name}}") if err != nil { return err } @@ -361,7 +361,7 @@ func resourceComputeSnapshotUpdate(d *schema.ResourceData, meta interface{}) err obj["labelFingerprint"] = labelFingerprintProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/snapshots/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/snapshots/{{name}}/setLabels") if err != nil { return err } @@ -400,7 +400,7 @@ func resourceComputeSnapshotUpdate(d *schema.ResourceData, meta interface{}) err func resourceComputeSnapshotDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/snapshots/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/snapshots/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_snapshot_generated_test.go b/google-beta/resource_compute_snapshot_generated_test.go index bff95e3dbc..631dff7f99 100644 --- a/google-beta/resource_compute_snapshot_generated_test.go +++ b/google-beta/resource_compute_snapshot_generated_test.go @@ -86,7 +86,7 @@ func testAccCheckComputeSnapshotDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/snapshots/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/snapshots/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_ssl_certificate.go b/google-beta/resource_compute_ssl_certificate.go index ec9c5c2322..c18b0bad1a 100644 --- a/google-beta/resource_compute_ssl_certificate.go +++ b/google-beta/resource_compute_ssl_certificate.go @@ -135,7 +135,7 @@ func resourceComputeSslCertificateCreate(d *schema.ResourceData, meta interface{ obj["privateKey"] = privateKeyProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates") if err != nil { return err } @@ -181,7 +181,7 @@ func resourceComputeSslCertificateCreate(d *schema.ResourceData, meta interface{ func resourceComputeSslCertificateRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates/{{name}}") if err != nil { return err } @@ -224,7 +224,7 @@ func resourceComputeSslCertificateRead(d *schema.ResourceData, meta interface{}) func resourceComputeSslCertificateDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_ssl_certificate_generated_test.go b/google-beta/resource_compute_ssl_certificate_generated_test.go index 7b5ade1376..fb1e0b8799 100644 --- a/google-beta/resource_compute_ssl_certificate_generated_test.go +++ b/google-beta/resource_compute_ssl_certificate_generated_test.go @@ -221,7 +221,7 @@ func testAccCheckComputeSslCertificateDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslCertificates/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/sslCertificates/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_ssl_policy.go b/google-beta/resource_compute_ssl_policy.go index 87e2db0a4d..84cb18055f 100644 --- a/google-beta/resource_compute_ssl_policy.go +++ b/google-beta/resource_compute_ssl_policy.go @@ -161,7 +161,7 @@ func resourceComputeSslPolicyCreate(d *schema.ResourceData, meta interface{}) er obj["customFeatures"] = customFeaturesProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslPolicies") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslPolicies") if err != nil { return err } @@ -207,7 +207,7 @@ func resourceComputeSslPolicyCreate(d *schema.ResourceData, meta interface{}) er func resourceComputeSslPolicyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslPolicies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslPolicies/{{name}}") if err != nil { return err } @@ -284,7 +284,7 @@ func resourceComputeSslPolicyUpdate(d *schema.ResourceData, meta interface{}) er return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslPolicies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslPolicies/{{name}}") if err != nil { return err } @@ -320,7 +320,7 @@ func resourceComputeSslPolicyUpdate(d *schema.ResourceData, meta interface{}) er func resourceComputeSslPolicyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslPolicies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/sslPolicies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_ssl_policy_generated_test.go b/google-beta/resource_compute_ssl_policy_generated_test.go index 53849c79a3..b20afceeea 100644 --- a/google-beta/resource_compute_ssl_policy_generated_test.go +++ b/google-beta/resource_compute_ssl_policy_generated_test.go @@ -81,7 +81,7 @@ func testAccCheckComputeSslPolicyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/sslPolicies/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/sslPolicies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_subnetwork.go b/google-beta/resource_compute_subnetwork.go index 1b1dc1b574..3e82c2433b 100644 --- a/google-beta/resource_compute_subnetwork.go +++ b/google-beta/resource_compute_subnetwork.go @@ -300,7 +300,7 @@ func resourceComputeSubnetworkCreate(d *schema.ResourceData, meta interface{}) e obj["logConfig"] = logConfigProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks") if err != nil { return err } @@ -346,7 +346,7 @@ func resourceComputeSubnetworkCreate(d *schema.ResourceData, meta interface{}) e func resourceComputeSubnetworkRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") if err != nil { return err } @@ -421,7 +421,7 @@ func resourceComputeSubnetworkUpdate(d *schema.ResourceData, meta interface{}) e obj["ipCidrRange"] = ipCidrRangeProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}/expandIpCidrRange") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}/expandIpCidrRange") if err != nil { return err } @@ -471,7 +471,7 @@ func resourceComputeSubnetworkUpdate(d *schema.ResourceData, meta interface{}) e obj["secondaryIpRanges"] = secondaryIpRangesProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") if err != nil { return err } @@ -511,7 +511,7 @@ func resourceComputeSubnetworkUpdate(d *schema.ResourceData, meta interface{}) e obj["privateIpGoogleAccess"] = privateIpGoogleAccessProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}/setPrivateIpGoogleAccess") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}/setPrivateIpGoogleAccess") if err != nil { return err } @@ -549,7 +549,7 @@ func resourceComputeSubnetworkUpdate(d *schema.ResourceData, meta interface{}) e func resourceComputeSubnetworkDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_subnetwork_generated_test.go b/google-beta/resource_compute_subnetwork_generated_test.go index 2a55883b79..05efad54bb 100644 --- a/google-beta/resource_compute_subnetwork_generated_test.go +++ b/google-beta/resource_compute_subnetwork_generated_test.go @@ -128,7 +128,7 @@ func testAccCheckComputeSubnetworkDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_http_proxy.go b/google-beta/resource_compute_target_http_proxy.go index 91b7e09275..c5f6469bcd 100644 --- a/google-beta/resource_compute_target_http_proxy.go +++ b/google-beta/resource_compute_target_http_proxy.go @@ -103,7 +103,7 @@ func resourceComputeTargetHttpProxyCreate(d *schema.ResourceData, meta interface obj["urlMap"] = urlMapProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpProxies") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpProxies") if err != nil { return err } @@ -149,7 +149,7 @@ func resourceComputeTargetHttpProxyCreate(d *schema.ResourceData, meta interface func resourceComputeTargetHttpProxyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpProxies/{{name}}") if err != nil { return err } @@ -203,7 +203,7 @@ func resourceComputeTargetHttpProxyUpdate(d *schema.ResourceData, meta interface obj["urlMap"] = urlMapProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/targetHttpProxies/{{name}}/setUrlMap") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/targetHttpProxies/{{name}}/setUrlMap") if err != nil { return err } @@ -241,7 +241,7 @@ func resourceComputeTargetHttpProxyUpdate(d *schema.ResourceData, meta interface func resourceComputeTargetHttpProxyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_http_proxy_generated_test.go b/google-beta/resource_compute_target_http_proxy_generated_test.go index c8f440fe76..5f8db3c2c4 100644 --- a/google-beta/resource_compute_target_http_proxy_generated_test.go +++ b/google-beta/resource_compute_target_http_proxy_generated_test.go @@ -104,7 +104,7 @@ func testAccCheckComputeTargetHttpProxyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpProxies/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_https_proxy.go b/google-beta/resource_compute_target_https_proxy.go index 22c5252205..80d03606f0 100644 --- a/google-beta/resource_compute_target_https_proxy.go +++ b/google-beta/resource_compute_target_https_proxy.go @@ -140,7 +140,7 @@ func resourceComputeTargetHttpsProxyCreate(d *schema.ResourceData, meta interfac obj["urlMap"] = urlMapProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpsProxies") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies") if err != nil { return err } @@ -186,7 +186,7 @@ func resourceComputeTargetHttpsProxyCreate(d *schema.ResourceData, meta interfac func resourceComputeTargetHttpsProxyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpsProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}") if err != nil { return err } @@ -249,7 +249,7 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac obj["quicOverride"] = quicOverrideProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpsProxies/{{name}}/setQuicOverride") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}/setQuicOverride") if err != nil { return err } @@ -287,7 +287,7 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac obj["sslCertificates"] = sslCertificatesProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/targetHttpsProxies/{{name}}/setSslCertificates") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/targetHttpsProxies/{{name}}/setSslCertificates") if err != nil { return err } @@ -325,7 +325,7 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac obj["sslPolicy"] = sslPolicyProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpsProxies/{{name}}/setSslPolicy") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}/setSslPolicy") if err != nil { return err } @@ -363,7 +363,7 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac obj["urlMap"] = urlMapProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/targetHttpsProxies/{{name}}/setUrlMap") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/targetHttpsProxies/{{name}}/setUrlMap") if err != nil { return err } @@ -401,7 +401,7 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac func resourceComputeTargetHttpsProxyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpsProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_https_proxy_generated_test.go b/google-beta/resource_compute_target_https_proxy_generated_test.go index 735eed53a3..a4f6ec4594 100644 --- a/google-beta/resource_compute_target_https_proxy_generated_test.go +++ b/google-beta/resource_compute_target_https_proxy_generated_test.go @@ -113,7 +113,7 @@ func testAccCheckComputeTargetHttpsProxyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetHttpsProxies/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/targetHttpsProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_instance.go b/google-beta/resource_compute_target_instance.go index c46c06512e..0a3efb5935 100644 --- a/google-beta/resource_compute_target_instance.go +++ b/google-beta/resource_compute_target_instance.go @@ -125,7 +125,7 @@ func resourceComputeTargetInstanceCreate(d *schema.ResourceData, meta interface{ obj["zone"] = zoneProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/targetInstances") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/targetInstances") if err != nil { return err } @@ -171,7 +171,7 @@ func resourceComputeTargetInstanceCreate(d *schema.ResourceData, meta interface{ func resourceComputeTargetInstanceRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}") if err != nil { return err } @@ -217,7 +217,7 @@ func resourceComputeTargetInstanceRead(d *schema.ResourceData, meta interface{}) func resourceComputeTargetInstanceDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}") if err != nil { return err } @@ -318,7 +318,7 @@ func expandComputeTargetInstanceInstance(v interface{}, d TerraformResourceData, return "https://www.googleapis.com/compute/v1/" + v.(string), nil } else if strings.HasPrefix(v.(string), "regions/") || strings.HasPrefix(v.(string), "zones/") { // For regional or zonal resources which include their region or zone, just put the project in front. - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/") if err != nil { return nil, err } @@ -327,7 +327,7 @@ func expandComputeTargetInstanceInstance(v interface{}, d TerraformResourceData, // Anything else is assumed to be a regional resource, with a partial link that begins with the resource name. // This isn't very likely - it's a last-ditch effort to extract something useful here. We can do a better job // as soon as MultiResourceRefs are working since we'll know the types that this field is supposed to point to. - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/regions/{{region}}/") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/") if err != nil { return nil, err } diff --git a/google-beta/resource_compute_target_instance_generated_test.go b/google-beta/resource_compute_target_instance_generated_test.go index 281c832120..255d02cee2 100644 --- a/google-beta/resource_compute_target_instance_generated_test.go +++ b/google-beta/resource_compute_target_instance_generated_test.go @@ -89,7 +89,7 @@ func testAccCheckComputeTargetInstanceDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_ssl_proxy.go b/google-beta/resource_compute_target_ssl_proxy.go index 2311ca8a41..09c4ce7a8b 100644 --- a/google-beta/resource_compute_target_ssl_proxy.go +++ b/google-beta/resource_compute_target_ssl_proxy.go @@ -142,7 +142,7 @@ func resourceComputeTargetSslProxyCreate(d *schema.ResourceData, meta interface{ obj["sslPolicy"] = sslPolicyProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies") if err != nil { return err } @@ -188,7 +188,7 @@ func resourceComputeTargetSslProxyCreate(d *schema.ResourceData, meta interface{ func resourceComputeTargetSslProxyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies/{{name}}") if err != nil { return err } @@ -251,7 +251,7 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{ obj["proxyHeader"] = proxyHeaderProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies/{{name}}/setProxyHeader") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies/{{name}}/setProxyHeader") if err != nil { return err } @@ -289,7 +289,7 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{ obj["service"] = serviceProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies/{{name}}/setBackendService") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies/{{name}}/setBackendService") if err != nil { return err } @@ -327,7 +327,7 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{ obj["sslCertificates"] = sslCertificatesProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies/{{name}}/setSslCertificates") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies/{{name}}/setSslCertificates") if err != nil { return err } @@ -365,7 +365,7 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{ obj["sslPolicy"] = sslPolicyProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies/{{name}}/setSslPolicy") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies/{{name}}/setSslPolicy") if err != nil { return err } @@ -403,7 +403,7 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{ func resourceComputeTargetSslProxyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_ssl_proxy_generated_test.go b/google-beta/resource_compute_target_ssl_proxy_generated_test.go index ccd44d5e26..eb3b3d9a4e 100644 --- a/google-beta/resource_compute_target_ssl_proxy_generated_test.go +++ b/google-beta/resource_compute_target_ssl_proxy_generated_test.go @@ -90,7 +90,7 @@ func testAccCheckComputeTargetSslProxyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetSslProxies/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/targetSslProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_tcp_proxy.go b/google-beta/resource_compute_target_tcp_proxy.go index c3265dba30..90fb5527af 100644 --- a/google-beta/resource_compute_target_tcp_proxy.go +++ b/google-beta/resource_compute_target_tcp_proxy.go @@ -116,7 +116,7 @@ func resourceComputeTargetTcpProxyCreate(d *schema.ResourceData, meta interface{ obj["service"] = serviceProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetTcpProxies") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetTcpProxies") if err != nil { return err } @@ -162,7 +162,7 @@ func resourceComputeTargetTcpProxyCreate(d *schema.ResourceData, meta interface{ func resourceComputeTargetTcpProxyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetTcpProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetTcpProxies/{{name}}") if err != nil { return err } @@ -219,7 +219,7 @@ func resourceComputeTargetTcpProxyUpdate(d *schema.ResourceData, meta interface{ obj["proxyHeader"] = proxyHeaderProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetTcpProxies/{{name}}/setProxyHeader") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetTcpProxies/{{name}}/setProxyHeader") if err != nil { return err } @@ -257,7 +257,7 @@ func resourceComputeTargetTcpProxyUpdate(d *schema.ResourceData, meta interface{ obj["service"] = serviceProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetTcpProxies/{{name}}/setBackendService") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetTcpProxies/{{name}}/setBackendService") if err != nil { return err } @@ -295,7 +295,7 @@ func resourceComputeTargetTcpProxyUpdate(d *schema.ResourceData, meta interface{ func resourceComputeTargetTcpProxyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetTcpProxies/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/targetTcpProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_target_tcp_proxy_generated_test.go b/google-beta/resource_compute_target_tcp_proxy_generated_test.go index 69807b0ea0..901c01e283 100644 --- a/google-beta/resource_compute_target_tcp_proxy_generated_test.go +++ b/google-beta/resource_compute_target_tcp_proxy_generated_test.go @@ -86,7 +86,7 @@ func testAccCheckComputeTargetTcpProxyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/targetTcpProxies/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/targetTcpProxies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_url_map.go b/google-beta/resource_compute_url_map.go index e277453202..50838babbe 100644 --- a/google-beta/resource_compute_url_map.go +++ b/google-beta/resource_compute_url_map.go @@ -226,7 +226,7 @@ func resourceComputeUrlMapCreate(d *schema.ResourceData, meta interface{}) error obj["tests"] = testsProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/urlMaps") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/urlMaps") if err != nil { return err } @@ -272,7 +272,7 @@ func resourceComputeUrlMapCreate(d *schema.ResourceData, meta interface{}) error func resourceComputeUrlMapRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/urlMaps/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/urlMaps/{{name}}") if err != nil { return err } @@ -371,7 +371,7 @@ func resourceComputeUrlMapUpdate(d *schema.ResourceData, meta interface{}) error obj["tests"] = testsProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/urlMaps/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/urlMaps/{{name}}") if err != nil { return err } @@ -407,7 +407,7 @@ func resourceComputeUrlMapUpdate(d *schema.ResourceData, meta interface{}) error func resourceComputeUrlMapDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/urlMaps/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/urlMaps/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_url_map_generated_test.go b/google-beta/resource_compute_url_map_generated_test.go index f83a61b37d..47ddaa7b50 100644 --- a/google-beta/resource_compute_url_map_generated_test.go +++ b/google-beta/resource_compute_url_map_generated_test.go @@ -137,7 +137,7 @@ func testAccCheckComputeUrlMapDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/global/urlMaps/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/global/urlMaps/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_vpn_gateway.go b/google-beta/resource_compute_vpn_gateway.go index ba6ed6ede9..d1f1a6b8b0 100644 --- a/google-beta/resource_compute_vpn_gateway.go +++ b/google-beta/resource_compute_vpn_gateway.go @@ -110,7 +110,7 @@ func resourceComputeVpnGatewayCreate(d *schema.ResourceData, meta interface{}) e obj["region"] = regionProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/targetVpnGateways") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/targetVpnGateways") if err != nil { return err } @@ -156,7 +156,7 @@ func resourceComputeVpnGatewayCreate(d *schema.ResourceData, meta interface{}) e func resourceComputeVpnGatewayRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}") if err != nil { return err } @@ -199,7 +199,7 @@ func resourceComputeVpnGatewayRead(d *schema.ResourceData, meta interface{}) err func resourceComputeVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_vpn_gateway_generated_test.go b/google-beta/resource_compute_vpn_gateway_generated_test.go index eb705e833b..3252892543 100644 --- a/google-beta/resource_compute_vpn_gateway_generated_test.go +++ b/google-beta/resource_compute_vpn_gateway_generated_test.go @@ -122,7 +122,7 @@ func testAccCheckComputeVpnGatewayDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/targetVpnGateways/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_vpn_tunnel.go b/google-beta/resource_compute_vpn_tunnel.go index e58c151f7e..d0a2bc0829 100644 --- a/google-beta/resource_compute_vpn_tunnel.go +++ b/google-beta/resource_compute_vpn_tunnel.go @@ -389,7 +389,7 @@ func resourceComputeVpnTunnelCreate(d *schema.ResourceData, meta interface{}) er return err } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnTunnels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnTunnels") if err != nil { return err } @@ -446,7 +446,7 @@ func resourceComputeVpnTunnelCreate(d *schema.ResourceData, meta interface{}) er labelFingerprintProp := d.Get("label_fingerprint") obj["labelFingerprint"] = labelFingerprintProp - url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}/setLabels") + url, err = replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}/setLabels") if err != nil { return err } @@ -476,7 +476,7 @@ func resourceComputeVpnTunnelCreate(d *schema.ResourceData, meta interface{}) er func resourceComputeVpnTunnelRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}") if err != nil { return err } @@ -578,7 +578,7 @@ func resourceComputeVpnTunnelUpdate(d *schema.ResourceData, meta interface{}) er obj["labelFingerprint"] = labelFingerprintProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}/setLabels") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}/setLabels") if err != nil { return err } @@ -617,7 +617,7 @@ func resourceComputeVpnTunnelUpdate(d *schema.ResourceData, meta interface{}) er func resourceComputeVpnTunnelDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}") + url, err := replaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_compute_vpn_tunnel_generated_test.go b/google-beta/resource_compute_vpn_tunnel_generated_test.go index af27c741b0..562afce38a 100644 --- a/google-beta/resource_compute_vpn_tunnel_generated_test.go +++ b/google-beta/resource_compute_vpn_tunnel_generated_test.go @@ -222,7 +222,7 @@ func testAccCheckComputeVpnTunnelDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}") + url, err := replaceVarsForTest(rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/vpnTunnels/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_container_analysis_note.go b/google-beta/resource_container_analysis_note.go index 8e7536408c..250f0c683e 100644 --- a/google-beta/resource_container_analysis_note.go +++ b/google-beta/resource_container_analysis_note.go @@ -96,7 +96,7 @@ func resourceContainerAnalysisNoteCreate(d *schema.ResourceData, meta interface{ obj["attestationAuthority"] = attestationAuthorityProp } - url, err := replaceVars(d, config, "https://containeranalysis.googleapis.com/v1beta1/projects/{{project}}/notes?noteId={{name}}") + url, err := replaceVars(d, config, "{{ContainerAnalysisBasePath}}projects/{{project}}/notes?noteId={{name}}") if err != nil { return err } @@ -122,7 +122,7 @@ func resourceContainerAnalysisNoteCreate(d *schema.ResourceData, meta interface{ func resourceContainerAnalysisNoteRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://containeranalysis.googleapis.com/v1beta1/projects/{{project}}/notes/{{name}}") + url, err := replaceVars(d, config, "{{ContainerAnalysisBasePath}}projects/{{project}}/notes/{{name}}") if err != nil { return err } @@ -161,7 +161,7 @@ func resourceContainerAnalysisNoteUpdate(d *schema.ResourceData, meta interface{ obj["attestationAuthority"] = attestationAuthorityProp } - url, err := replaceVars(d, config, "https://containeranalysis.googleapis.com/v1beta1/projects/{{project}}/notes/{{name}}") + url, err := replaceVars(d, config, "{{ContainerAnalysisBasePath}}projects/{{project}}/notes/{{name}}") if err != nil { return err } @@ -189,7 +189,7 @@ func resourceContainerAnalysisNoteUpdate(d *schema.ResourceData, meta interface{ func resourceContainerAnalysisNoteDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://containeranalysis.googleapis.com/v1beta1/projects/{{project}}/notes/{{name}}") + url, err := replaceVars(d, config, "{{ContainerAnalysisBasePath}}projects/{{project}}/notes/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_container_analysis_note_generated_test.go b/google-beta/resource_container_analysis_note_generated_test.go index 42bf05ab34..c9b59032d5 100644 --- a/google-beta/resource_container_analysis_note_generated_test.go +++ b/google-beta/resource_container_analysis_note_generated_test.go @@ -74,7 +74,7 @@ func testAccCheckContainerAnalysisNoteDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://containeranalysis.googleapis.com/v1beta1/projects/{{project}}/notes/{{name}}") + url, err := replaceVarsForTest(rs, "{{ContainerAnalysisBasePath}}projects/{{project}}/notes/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_dns_managed_zone.go b/google-beta/resource_dns_managed_zone.go index f7feb42d9a..e477290cfd 100644 --- a/google-beta/resource_dns_managed_zone.go +++ b/google-beta/resource_dns_managed_zone.go @@ -302,7 +302,7 @@ func resourceDnsManagedZoneCreate(d *schema.ResourceData, meta interface{}) erro obj["peeringConfig"] = peeringConfigProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/managedZones") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones") if err != nil { return err } @@ -328,7 +328,7 @@ func resourceDnsManagedZoneCreate(d *schema.ResourceData, meta interface{}) erro func resourceDnsManagedZoneRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/managedZones/{{name}}") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } @@ -418,7 +418,7 @@ func resourceDnsManagedZoneUpdate(d *schema.ResourceData, meta interface{}) erro obj["peeringConfig"] = peeringConfigProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/managedZones/{{name}}") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } @@ -442,7 +442,7 @@ func resourceDnsManagedZoneUpdate(d *schema.ResourceData, meta interface{}) erro func resourceDnsManagedZoneDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/managedZones/{{name}}") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_dns_managed_zone_generated_test.go b/google-beta/resource_dns_managed_zone_generated_test.go index d4c79e2f2c..a6f5ed5b1a 100644 --- a/google-beta/resource_dns_managed_zone_generated_test.go +++ b/google-beta/resource_dns_managed_zone_generated_test.go @@ -198,7 +198,7 @@ func testAccCheckDnsManagedZoneDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/managedZones/{{name}}") + url, err := replaceVarsForTest(rs, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_dns_policy.go b/google-beta/resource_dns_policy.go index ac3e548c82..1cdbbcacb5 100644 --- a/google-beta/resource_dns_policy.go +++ b/google-beta/resource_dns_policy.go @@ -171,7 +171,7 @@ func resourceDnsPolicyCreate(d *schema.ResourceData, meta interface{}) error { obj["networks"] = networksProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/policies") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/policies") if err != nil { return err } @@ -197,7 +197,7 @@ func resourceDnsPolicyCreate(d *schema.ResourceData, meta interface{}) error { func resourceDnsPolicyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/policies/{{name}}") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/policies/{{name}}") if err != nil { return err } @@ -275,7 +275,7 @@ func resourceDnsPolicyUpdate(d *schema.ResourceData, meta interface{}) error { obj["networks"] = networksProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/policies/{{name}}") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/policies/{{name}}") if err != nil { return err } @@ -299,7 +299,7 @@ func resourceDnsPolicyUpdate(d *schema.ResourceData, meta interface{}) error { func resourceDnsPolicyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/policies/{{name}}") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/policies/{{name}}") if err != nil { return err } @@ -310,7 +310,7 @@ func resourceDnsPolicyDelete(d *schema.ResourceData, meta interface{}) error { patched := make(map[string]interface{}) patched["networks"] = nil - url, err := replaceVars(d, config, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/policies/{{name}}") + url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/policies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_dns_policy_generated_test.go b/google-beta/resource_dns_policy_generated_test.go index 5c8f6d8fe1..08384efed8 100644 --- a/google-beta/resource_dns_policy_generated_test.go +++ b/google-beta/resource_dns_policy_generated_test.go @@ -102,7 +102,7 @@ func testAccCheckDnsPolicyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/dns/v1beta2/projects/{{project}}/policies/{{name}}") + url, err := replaceVarsForTest(rs, "{{DnsBasePath}}projects/{{project}}/policies/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_filestore_instance.go b/google-beta/resource_filestore_instance.go index 1a79963103..ca56dc85e5 100644 --- a/google-beta/resource_filestore_instance.go +++ b/google-beta/resource_filestore_instance.go @@ -174,7 +174,7 @@ func resourceFilestoreInstanceCreate(d *schema.ResourceData, meta interface{}) e obj["networks"] = networksProp } - url, err := replaceVars(d, config, "https://file.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/instances?instanceId={{name}}") + url, err := replaceVars(d, config, "{{FilestoreBasePath}}projects/{{project}}/locations/{{zone}}/instances?instanceId={{name}}") if err != nil { return err } @@ -214,7 +214,7 @@ func resourceFilestoreInstanceCreate(d *schema.ResourceData, meta interface{}) e func resourceFilestoreInstanceRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://file.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{FilestoreBasePath}}projects/{{project}}/locations/{{zone}}/instances/{{name}}") if err != nil { return err } @@ -280,7 +280,7 @@ func resourceFilestoreInstanceUpdate(d *schema.ResourceData, meta interface{}) e obj["fileShares"] = fileSharesProp } - url, err := replaceVars(d, config, "https://file.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{FilestoreBasePath}}projects/{{project}}/locations/{{zone}}/instances/{{name}}") if err != nil { return err } @@ -330,7 +330,7 @@ func resourceFilestoreInstanceUpdate(d *schema.ResourceData, meta interface{}) e func resourceFilestoreInstanceDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://file.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{FilestoreBasePath}}projects/{{project}}/locations/{{zone}}/instances/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_filestore_instance_generated_test.go b/google-beta/resource_filestore_instance_generated_test.go index 57ccae3e11..badf4417f0 100644 --- a/google-beta/resource_filestore_instance_generated_test.go +++ b/google-beta/resource_filestore_instance_generated_test.go @@ -80,7 +80,7 @@ func testAccCheckFilestoreInstanceDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://file.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/instances/{{name}}") + url, err := replaceVarsForTest(rs, "{{FilestoreBasePath}}projects/{{project}}/locations/{{zone}}/instances/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_firestore_index.go b/google-beta/resource_firestore_index.go index 198d0f4dfb..5958828d70 100644 --- a/google-beta/resource_firestore_index.go +++ b/google-beta/resource_firestore_index.go @@ -134,7 +134,7 @@ func resourceFirestoreIndexCreate(d *schema.ResourceData, meta interface{}) erro return err } - url, err := replaceVars(d, config, "https://firestore.googleapis.com/v1/projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes") + url, err := replaceVars(d, config, "{{FirestoreBasePath}}projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes") if err != nil { return err } @@ -182,7 +182,7 @@ func resourceFirestoreIndexCreate(d *schema.ResourceData, meta interface{}) erro func resourceFirestoreIndexRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://firestore.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{FirestoreBasePath}}{{name}}") if err != nil { return err } @@ -216,7 +216,7 @@ func resourceFirestoreIndexRead(d *schema.ResourceData, meta interface{}) error func resourceFirestoreIndexDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://firestore.googleapis.com/v1/{{name}}") + url, err := replaceVars(d, config, "{{FirestoreBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_firestore_index_generated_test.go b/google-beta/resource_firestore_index_generated_test.go index da349fbd67..a8319d19f4 100644 --- a/google-beta/resource_firestore_index_generated_test.go +++ b/google-beta/resource_firestore_index_generated_test.go @@ -86,7 +86,7 @@ func testAccCheckFirestoreIndexDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://firestore.googleapis.com/v1/{{name}}") + url, err := replaceVarsForTest(rs, "{{FirestoreBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_kms_key_ring.go b/google-beta/resource_kms_key_ring.go index 2d791b76b5..3c2355c9f0 100644 --- a/google-beta/resource_kms_key_ring.go +++ b/google-beta/resource_kms_key_ring.go @@ -85,7 +85,7 @@ func resourceKmsKeyRingCreate(d *schema.ResourceData, meta interface{}) error { return err } - url, err := replaceVars(d, config, "https://cloudkms.googleapis.com/v1/projects/{{project}}/locations/{{location}}/keyRings?keyRingId={{name}}") + url, err := replaceVars(d, config, "{{KmsBasePath}}projects/{{project}}/locations/{{location}}/keyRings?keyRingId={{name}}") if err != nil { return err } @@ -111,7 +111,7 @@ func resourceKmsKeyRingCreate(d *schema.ResourceData, meta interface{}) error { func resourceKmsKeyRingRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://cloudkms.googleapis.com/v1/projects/{{project}}/locations/{{location}}/keyRings/{{name}}") + url, err := replaceVars(d, config, "{{KmsBasePath}}projects/{{project}}/locations/{{location}}/keyRings/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_logging_metric.go b/google-beta/resource_logging_metric.go index b7968b5037..452a222987 100644 --- a/google-beta/resource_logging_metric.go +++ b/google-beta/resource_logging_metric.go @@ -236,7 +236,7 @@ func resourceLoggingMetricCreate(d *schema.ResourceData, meta interface{}) error mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://logging.googleapis.com/v2/projects/{{project}}/metrics") + url, err := replaceVars(d, config, "{{LoggingBasePath}}projects/{{project}}/metrics") if err != nil { return err } @@ -270,7 +270,7 @@ func resourceLoggingMetricCreate(d *schema.ResourceData, meta interface{}) error func resourceLoggingMetricRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://logging.googleapis.com/v2/projects/{{project}}/metrics/{{%name}}") + url, err := replaceVars(d, config, "{{LoggingBasePath}}projects/{{project}}/metrics/{{%name}}") if err != nil { return err } @@ -367,7 +367,7 @@ func resourceLoggingMetricUpdate(d *schema.ResourceData, meta interface{}) error mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://logging.googleapis.com/v2/projects/{{project}}/metrics/{{%name}}") + url, err := replaceVars(d, config, "{{LoggingBasePath}}projects/{{project}}/metrics/{{%name}}") if err != nil { return err } @@ -392,7 +392,7 @@ func resourceLoggingMetricDelete(d *schema.ResourceData, meta interface{}) error mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://logging.googleapis.com/v2/projects/{{project}}/metrics/{{%name}}") + url, err := replaceVars(d, config, "{{LoggingBasePath}}projects/{{project}}/metrics/{{%name}}") if err != nil { return err } diff --git a/google-beta/resource_logging_metric_generated_test.go b/google-beta/resource_logging_metric_generated_test.go index 8205de9158..fd094df9df 100644 --- a/google-beta/resource_logging_metric_generated_test.go +++ b/google-beta/resource_logging_metric_generated_test.go @@ -86,7 +86,7 @@ func testAccCheckLoggingMetricDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://logging.googleapis.com/v2/projects/{{project}}/metrics/{{%name}}") + url, err := replaceVarsForTest(rs, "{{LoggingBasePath}}projects/{{project}}/metrics/{{%name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_alert_policy.go b/google-beta/resource_monitoring_alert_policy.go index b3eaf25e14..dbb4517f7f 100644 --- a/google-beta/resource_monitoring_alert_policy.go +++ b/google-beta/resource_monitoring_alert_policy.go @@ -365,7 +365,7 @@ func resourceMonitoringAlertPolicyCreate(d *schema.ResourceData, meta interface{ mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/projects/{{project}}/alertPolicies") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}projects/{{project}}/alertPolicies") if err != nil { return err } @@ -399,7 +399,7 @@ func resourceMonitoringAlertPolicyCreate(d *schema.ResourceData, meta interface{ func resourceMonitoringAlertPolicyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -502,7 +502,7 @@ func resourceMonitoringAlertPolicyUpdate(d *schema.ResourceData, meta interface{ mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -562,7 +562,7 @@ func resourceMonitoringAlertPolicyDelete(d *schema.ResourceData, meta interface{ mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_alert_policy_generated_test.go b/google-beta/resource_monitoring_alert_policy_generated_test.go index 5f1fc82c71..bf4834ed47 100644 --- a/google-beta/resource_monitoring_alert_policy_generated_test.go +++ b/google-beta/resource_monitoring_alert_policy_generated_test.go @@ -84,7 +84,7 @@ func testAccCheckMonitoringAlertPolicyDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVarsForTest(rs, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_group.go b/google-beta/resource_monitoring_group.go index 4e81440194..fc470f0033 100644 --- a/google-beta/resource_monitoring_group.go +++ b/google-beta/resource_monitoring_group.go @@ -108,7 +108,7 @@ func resourceMonitoringGroupCreate(d *schema.ResourceData, meta interface{}) err mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/projects/{{project}}/groups") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}projects/{{project}}/groups") if err != nil { return err } @@ -142,7 +142,7 @@ func resourceMonitoringGroupCreate(d *schema.ResourceData, meta interface{}) err func resourceMonitoringGroupRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -215,7 +215,7 @@ func resourceMonitoringGroupUpdate(d *schema.ResourceData, meta interface{}) err mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -240,7 +240,7 @@ func resourceMonitoringGroupDelete(d *schema.ResourceData, meta interface{}) err mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_group_generated_test.go b/google-beta/resource_monitoring_group_generated_test.go index e1c7616385..b9273b6fdc 100644 --- a/google-beta/resource_monitoring_group_generated_test.go +++ b/google-beta/resource_monitoring_group_generated_test.go @@ -108,7 +108,7 @@ func testAccCheckMonitoringGroupDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVarsForTest(rs, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_notification_channel.go b/google-beta/resource_monitoring_notification_channel.go index f806bc02ff..149c3f4c9e 100644 --- a/google-beta/resource_monitoring_notification_channel.go +++ b/google-beta/resource_monitoring_notification_channel.go @@ -134,7 +134,7 @@ func resourceMonitoringNotificationChannelCreate(d *schema.ResourceData, meta in mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/projects/{{project}}/notificationChannels") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}projects/{{project}}/notificationChannels") if err != nil { return err } @@ -168,7 +168,7 @@ func resourceMonitoringNotificationChannelCreate(d *schema.ResourceData, meta in func resourceMonitoringNotificationChannelRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -262,7 +262,7 @@ func resourceMonitoringNotificationChannelUpdate(d *schema.ResourceData, meta in mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -287,7 +287,7 @@ func resourceMonitoringNotificationChannelDelete(d *schema.ResourceData, meta in mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_notification_channel_generated_test.go b/google-beta/resource_monitoring_notification_channel_generated_test.go index a451fc4265..c94658cb1b 100644 --- a/google-beta/resource_monitoring_notification_channel_generated_test.go +++ b/google-beta/resource_monitoring_notification_channel_generated_test.go @@ -71,7 +71,7 @@ func testAccCheckMonitoringNotificationChannelDestroy(s *terraform.State) error config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVarsForTest(rs, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_uptime_check_config.go b/google-beta/resource_monitoring_uptime_check_config.go index 55f0c7e367..38dc0907d8 100644 --- a/google-beta/resource_monitoring_uptime_check_config.go +++ b/google-beta/resource_monitoring_uptime_check_config.go @@ -308,7 +308,7 @@ func resourceMonitoringUptimeCheckConfigCreate(d *schema.ResourceData, meta inte obj["monitoredResource"] = monitoredResourceProp } - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/projects/{{project}}/uptimeCheckConfigs") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}projects/{{project}}/uptimeCheckConfigs") if err != nil { return err } @@ -342,7 +342,7 @@ func resourceMonitoringUptimeCheckConfigCreate(d *schema.ResourceData, meta inte func resourceMonitoringUptimeCheckConfigRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -456,7 +456,7 @@ func resourceMonitoringUptimeCheckConfigUpdate(d *schema.ResourceData, meta inte obj["tcpCheck"] = tcpCheckProp } - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } @@ -513,7 +513,7 @@ func resourceMonitoringUptimeCheckConfigUpdate(d *schema.ResourceData, meta inte func resourceMonitoringUptimeCheckConfigDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVars(d, config, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_monitoring_uptime_check_config_generated_test.go b/google-beta/resource_monitoring_uptime_check_config_generated_test.go index c4e8d15f25..0def170257 100644 --- a/google-beta/resource_monitoring_uptime_check_config_generated_test.go +++ b/google-beta/resource_monitoring_uptime_check_config_generated_test.go @@ -133,7 +133,7 @@ func testAccCheckMonitoringUptimeCheckConfigDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://monitoring.googleapis.com/v3/{{name}}") + url, err := replaceVarsForTest(rs, "{{MonitoringBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_pubsub_subscription.go b/google-beta/resource_pubsub_subscription.go index 7cda889721..e8393adc1c 100644 --- a/google-beta/resource_pubsub_subscription.go +++ b/google-beta/resource_pubsub_subscription.go @@ -192,7 +192,7 @@ func resourcePubsubSubscriptionCreate(d *schema.ResourceData, meta interface{}) return err } - url, err := replaceVars(d, config, "https://pubsub.googleapis.com/v1/projects/{{project}}/subscriptions/{{name}}") + url, err := replaceVars(d, config, "{{PubsubBasePath}}projects/{{project}}/subscriptions/{{name}}") if err != nil { return err } @@ -218,7 +218,7 @@ func resourcePubsubSubscriptionCreate(d *schema.ResourceData, meta interface{}) func resourcePubsubSubscriptionRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://pubsub.googleapis.com/v1/projects/{{project}}/subscriptions/{{name}}") + url, err := replaceVars(d, config, "{{PubsubBasePath}}projects/{{project}}/subscriptions/{{name}}") if err != nil { return err } @@ -315,7 +315,7 @@ func resourcePubsubSubscriptionUpdate(d *schema.ResourceData, meta interface{}) return err } - url, err := replaceVars(d, config, "https://pubsub.googleapis.com/v1/projects/{{project}}/subscriptions/{{name}}") + url, err := replaceVars(d, config, "{{PubsubBasePath}}projects/{{project}}/subscriptions/{{name}}") if err != nil { return err } @@ -364,7 +364,7 @@ func resourcePubsubSubscriptionUpdate(d *schema.ResourceData, meta interface{}) func resourcePubsubSubscriptionDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://pubsub.googleapis.com/v1/projects/{{project}}/subscriptions/{{name}}") + url, err := replaceVars(d, config, "{{PubsubBasePath}}projects/{{project}}/subscriptions/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_pubsub_subscription_generated_test.go b/google-beta/resource_pubsub_subscription_generated_test.go index b64b1ae03b..65bf27d8cb 100644 --- a/google-beta/resource_pubsub_subscription_generated_test.go +++ b/google-beta/resource_pubsub_subscription_generated_test.go @@ -86,7 +86,7 @@ func testAccCheckPubsubSubscriptionDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://pubsub.googleapis.com/v1/projects/{{project}}/subscriptions/{{name}}") + url, err := replaceVarsForTest(rs, "{{PubsubBasePath}}projects/{{project}}/subscriptions/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_pubsub_topic.go b/google-beta/resource_pubsub_topic.go index 4527d320d9..cd0afda93c 100644 --- a/google-beta/resource_pubsub_topic.go +++ b/google-beta/resource_pubsub_topic.go @@ -83,7 +83,7 @@ func resourcePubsubTopicCreate(d *schema.ResourceData, meta interface{}) error { return err } - url, err := replaceVars(d, config, "https://pubsub.googleapis.com/v1/projects/{{project}}/topics/{{name}}") + url, err := replaceVars(d, config, "{{PubsubBasePath}}projects/{{project}}/topics/{{name}}") if err != nil { return err } @@ -109,7 +109,7 @@ func resourcePubsubTopicCreate(d *schema.ResourceData, meta interface{}) error { func resourcePubsubTopicRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://pubsub.googleapis.com/v1/projects/{{project}}/topics/{{name}}") + url, err := replaceVars(d, config, "{{PubsubBasePath}}projects/{{project}}/topics/{{name}}") if err != nil { return err } @@ -140,7 +140,7 @@ func resourcePubsubTopicRead(d *schema.ResourceData, meta interface{}) error { func resourcePubsubTopicDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://pubsub.googleapis.com/v1/projects/{{project}}/topics/{{name}}") + url, err := replaceVars(d, config, "{{PubsubBasePath}}projects/{{project}}/topics/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_pubsub_topic_generated_test.go b/google-beta/resource_pubsub_topic_generated_test.go index 9d41f8b656..173017673f 100644 --- a/google-beta/resource_pubsub_topic_generated_test.go +++ b/google-beta/resource_pubsub_topic_generated_test.go @@ -71,7 +71,7 @@ func testAccCheckPubsubTopicDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://pubsub.googleapis.com/v1/projects/{{project}}/topics/{{name}}") + url, err := replaceVarsForTest(rs, "{{PubsubBasePath}}projects/{{project}}/topics/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_redis_instance.go b/google-beta/resource_redis_instance.go index c7b2eef8b6..9cc17db7a2 100644 --- a/google-beta/resource_redis_instance.go +++ b/google-beta/resource_redis_instance.go @@ -208,7 +208,7 @@ func resourceRedisInstanceCreate(d *schema.ResourceData, meta interface{}) error obj["tier"] = tierProp } - url, err := replaceVars(d, config, "https://redis.googleapis.com/v1beta1/projects/{{project}}/locations/{{region}}/instances?instanceId={{name}}") + url, err := replaceVars(d, config, "{{RedisBasePath}}projects/{{project}}/locations/{{region}}/instances?instanceId={{name}}") if err != nil { return err } @@ -248,7 +248,7 @@ func resourceRedisInstanceCreate(d *schema.ResourceData, meta interface{}) error func resourceRedisInstanceRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://redis.googleapis.com/v1beta1/projects/{{project}}/locations/{{region}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{RedisBasePath}}projects/{{project}}/locations/{{region}}/instances/{{name}}") if err != nil { return err } @@ -352,7 +352,7 @@ func resourceRedisInstanceUpdate(d *schema.ResourceData, meta interface{}) error obj["memorySizeGb"] = memorySizeGbProp } - url, err := replaceVars(d, config, "https://redis.googleapis.com/v1beta1/projects/{{project}}/locations/{{region}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{RedisBasePath}}projects/{{project}}/locations/{{region}}/instances/{{name}}") if err != nil { return err } @@ -406,7 +406,7 @@ func resourceRedisInstanceUpdate(d *schema.ResourceData, meta interface{}) error func resourceRedisInstanceDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://redis.googleapis.com/v1beta1/projects/{{project}}/locations/{{region}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{RedisBasePath}}projects/{{project}}/locations/{{region}}/instances/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_redis_instance_generated_test.go b/google-beta/resource_redis_instance_generated_test.go index f0469202c0..c01b72efd1 100644 --- a/google-beta/resource_redis_instance_generated_test.go +++ b/google-beta/resource_redis_instance_generated_test.go @@ -122,7 +122,7 @@ func testAccCheckRedisInstanceDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://redis.googleapis.com/v1beta1/projects/{{project}}/locations/{{region}}/instances/{{name}}") + url, err := replaceVarsForTest(rs, "{{RedisBasePath}}projects/{{project}}/locations/{{region}}/instances/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_resource_manager_lien.go b/google-beta/resource_resource_manager_lien.go index ba0e473872..baf9acfeb8 100644 --- a/google-beta/resource_resource_manager_lien.go +++ b/google-beta/resource_resource_manager_lien.go @@ -105,7 +105,7 @@ func resourceResourceManagerLienCreate(d *schema.ResourceData, meta interface{}) obj["restrictions"] = restrictionsProp } - url, err := replaceVars(d, config, "https://cloudresourcemanager.googleapis.com/v1/liens") + url, err := replaceVars(d, config, "{{ResourceManagerBasePath}}liens") if err != nil { return err } @@ -141,7 +141,7 @@ func resourceResourceManagerLienCreate(d *schema.ResourceData, meta interface{}) func resourceResourceManagerLienRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://cloudresourcemanager.googleapis.com/v1/liens?parent={{parent}}") + url, err := replaceVars(d, config, "{{ResourceManagerBasePath}}liens?parent={{parent}}") if err != nil { return err } @@ -193,7 +193,7 @@ func resourceResourceManagerLienRead(d *schema.ResourceData, meta interface{}) e func resourceResourceManagerLienDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://cloudresourcemanager.googleapis.com/v1/liens?parent={{parent}}") + url, err := replaceVars(d, config, "{{ResourceManagerBasePath}}liens?parent={{parent}}") if err != nil { return err } @@ -203,7 +203,7 @@ func resourceResourceManagerLienDelete(d *schema.ResourceData, meta interface{}) // in theory, we should find a way to disable the default URL and not construct // both, but that's a problem for another day. Today, we cheat. log.Printf("[DEBUG] replacing URL %q with a custom delete URL", url) - url, err = replaceVars(d, config, "https://cloudresourcemanager.googleapis.com/v1/liens/{{name}}") + url, err = replaceVars(d, config, "{{ResourceManagerBasePath}}liens/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_security_scanner_scan_config.go b/google-beta/resource_security_scanner_scan_config.go index d1e1f00d96..d566cf7a24 100644 --- a/google-beta/resource_security_scanner_scan_config.go +++ b/google-beta/resource_security_scanner_scan_config.go @@ -228,7 +228,7 @@ func resourceSecurityScannerScanConfigCreate(d *schema.ResourceData, meta interf obj["exportToSecurityCommandCenter"] = exportToSecurityCommandCenterProp } - url, err := replaceVars(d, config, "https://websecurityscanner.googleapis.com/v1beta/projects/{{project}}/scanConfigs") + url, err := replaceVars(d, config, "{{SecurityScannerBasePath}}projects/{{project}}/scanConfigs") if err != nil { return err } @@ -262,7 +262,7 @@ func resourceSecurityScannerScanConfigCreate(d *schema.ResourceData, meta interf func resourceSecurityScannerScanConfigRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://websecurityscanner.googleapis.com/v1beta/{{name}}") + url, err := replaceVars(d, config, "{{SecurityScannerBasePath}}{{name}}") if err != nil { return err } @@ -373,7 +373,7 @@ func resourceSecurityScannerScanConfigUpdate(d *schema.ResourceData, meta interf obj["exportToSecurityCommandCenter"] = exportToSecurityCommandCenterProp } - url, err := replaceVars(d, config, "https://websecurityscanner.googleapis.com/v1beta/{{name}}") + url, err := replaceVars(d, config, "{{SecurityScannerBasePath}}{{name}}") if err != nil { return err } @@ -434,7 +434,7 @@ func resourceSecurityScannerScanConfigUpdate(d *schema.ResourceData, meta interf func resourceSecurityScannerScanConfigDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://websecurityscanner.googleapis.com/v1beta/{{name}}") + url, err := replaceVars(d, config, "{{SecurityScannerBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_security_scanner_scan_config_generated_test.go b/google-beta/resource_security_scanner_scan_config_generated_test.go index ea2bc598e2..7ce9dde48f 100644 --- a/google-beta/resource_security_scanner_scan_config_generated_test.go +++ b/google-beta/resource_security_scanner_scan_config_generated_test.go @@ -75,7 +75,7 @@ func testAccCheckSecurityScannerScanConfigDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://websecurityscanner.googleapis.com/v1beta/{{name}}") + url, err := replaceVarsForTest(rs, "{{SecurityScannerBasePath}}{{name}}") if err != nil { return err } diff --git a/google-beta/resource_source_repo_repository.go b/google-beta/resource_source_repo_repository.go index 75282c972f..99464e40fd 100644 --- a/google-beta/resource_source_repo_repository.go +++ b/google-beta/resource_source_repo_repository.go @@ -75,7 +75,7 @@ func resourceSourceRepoRepositoryCreate(d *schema.ResourceData, meta interface{} obj["name"] = nameProp } - url, err := replaceVars(d, config, "https://sourcerepo.googleapis.com/v1/projects/{{project}}/repos") + url, err := replaceVars(d, config, "{{SourceRepoBasePath}}projects/{{project}}/repos") if err != nil { return err } @@ -101,7 +101,7 @@ func resourceSourceRepoRepositoryCreate(d *schema.ResourceData, meta interface{} func resourceSourceRepoRepositoryRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://sourcerepo.googleapis.com/v1/projects/{{project}}/repos/{{name}}") + url, err := replaceVars(d, config, "{{SourceRepoBasePath}}projects/{{project}}/repos/{{name}}") if err != nil { return err } @@ -135,7 +135,7 @@ func resourceSourceRepoRepositoryRead(d *schema.ResourceData, meta interface{}) func resourceSourceRepoRepositoryDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://sourcerepo.googleapis.com/v1/projects/{{project}}/repos/{{name}}") + url, err := replaceVars(d, config, "{{SourceRepoBasePath}}projects/{{project}}/repos/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_source_repo_repository_generated_test.go b/google-beta/resource_source_repo_repository_generated_test.go index 17f923f879..d5e73e3935 100644 --- a/google-beta/resource_source_repo_repository_generated_test.go +++ b/google-beta/resource_source_repo_repository_generated_test.go @@ -67,7 +67,7 @@ func testAccCheckSourceRepoRepositoryDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://sourcerepo.googleapis.com/v1/projects/{{project}}/repos/{{name}}") + url, err := replaceVarsForTest(rs, "{{SourceRepoBasePath}}projects/{{project}}/repos/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_spanner_database.go b/google-beta/resource_spanner_database.go index 61b34e997e..a3c1ba89cd 100644 --- a/google-beta/resource_spanner_database.go +++ b/google-beta/resource_spanner_database.go @@ -101,7 +101,7 @@ func resourceSpannerDatabaseCreate(d *schema.ResourceData, meta interface{}) err return err } - url, err := replaceVars(d, config, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{instance}}/databases") + url, err := replaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{instance}}/databases") if err != nil { return err } @@ -127,7 +127,7 @@ func resourceSpannerDatabaseCreate(d *schema.ResourceData, meta interface{}) err func resourceSpannerDatabaseRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } @@ -166,7 +166,7 @@ func resourceSpannerDatabaseRead(d *schema.ResourceData, meta interface{}) error func resourceSpannerDatabaseDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_spanner_database_generated_test.go b/google-beta/resource_spanner_database_generated_test.go index 420c86166a..bc48a99f99 100644 --- a/google-beta/resource_spanner_database_generated_test.go +++ b/google-beta/resource_spanner_database_generated_test.go @@ -78,7 +78,7 @@ func testAccCheckSpannerDatabaseDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVarsForTest(rs, "{{SpannerBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_spanner_instance.go b/google-beta/resource_spanner_instance.go index 864478def0..f00927566e 100644 --- a/google-beta/resource_spanner_instance.go +++ b/google-beta/resource_spanner_instance.go @@ -125,7 +125,7 @@ func resourceSpannerInstanceCreate(d *schema.ResourceData, meta interface{}) err return err } - url, err := replaceVars(d, config, "https://spanner.googleapis.com/v1/projects/{{project}}/instances") + url, err := replaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances") if err != nil { return err } @@ -170,7 +170,7 @@ func resourceSpannerInstanceCreate(d *schema.ResourceData, meta interface{}) err func resourceSpannerInstanceRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{name}}") if err != nil { return err } @@ -249,7 +249,7 @@ func resourceSpannerInstanceUpdate(d *schema.ResourceData, meta interface{}) err return err } - url, err := replaceVars(d, config, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{name}}") if err != nil { return err } @@ -280,7 +280,7 @@ func resourceSpannerInstanceUpdate(d *schema.ResourceData, meta interface{}) err func resourceSpannerInstanceDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{name}}") + url, err := replaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_spanner_instance_generated_test.go b/google-beta/resource_spanner_instance_generated_test.go index 8da366609a..693fd3d130 100644 --- a/google-beta/resource_spanner_instance_generated_test.go +++ b/google-beta/resource_spanner_instance_generated_test.go @@ -72,7 +72,7 @@ func testAccCheckSpannerInstanceDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://spanner.googleapis.com/v1/projects/{{project}}/instances/{{name}}") + url, err := replaceVarsForTest(rs, "{{SpannerBasePath}}projects/{{project}}/instances/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_sql_database.go b/google-beta/resource_sql_database.go index b7d5f740e6..69bc517fac 100644 --- a/google-beta/resource_sql_database.go +++ b/google-beta/resource_sql_database.go @@ -112,7 +112,7 @@ func resourceSqlDatabaseCreate(d *schema.ResourceData, meta interface{}) error { mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/sql/v1beta4/projects/{{project}}/instances/{{instance}}/databases") + url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases") if err != nil { return err } @@ -158,7 +158,7 @@ func resourceSqlDatabaseCreate(d *schema.ResourceData, meta interface{}) error { func resourceSqlDatabaseRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/sql/v1beta4/projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } @@ -231,7 +231,7 @@ func resourceSqlDatabaseUpdate(d *schema.ResourceData, meta interface{}) error { mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/sql/v1beta4/projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } @@ -274,7 +274,7 @@ func resourceSqlDatabaseDelete(d *schema.ResourceData, meta interface{}) error { mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "https://www.googleapis.com/sql/v1beta4/projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_storage_default_object_access_control.go b/google-beta/resource_storage_default_object_access_control.go index 76810b1232..a5f47699b2 100644 --- a/google-beta/resource_storage_default_object_access_control.go +++ b/google-beta/resource_storage_default_object_access_control.go @@ -128,7 +128,7 @@ func resourceStorageDefaultObjectAccessControlCreate(d *schema.ResourceData, met obj["role"] = roleProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/defaultObjectAcl") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/defaultObjectAcl") if err != nil { return err } @@ -154,7 +154,7 @@ func resourceStorageDefaultObjectAccessControlCreate(d *schema.ResourceData, met func resourceStorageDefaultObjectAccessControlRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/defaultObjectAcl/{{entity}}") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/defaultObjectAcl/{{entity}}") if err != nil { return err } @@ -221,7 +221,7 @@ func resourceStorageDefaultObjectAccessControlUpdate(d *schema.ResourceData, met obj["role"] = roleProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/defaultObjectAcl/{{entity}}") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/defaultObjectAcl/{{entity}}") if err != nil { return err } @@ -239,7 +239,7 @@ func resourceStorageDefaultObjectAccessControlUpdate(d *schema.ResourceData, met func resourceStorageDefaultObjectAccessControlDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/defaultObjectAcl/{{entity}}") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/defaultObjectAcl/{{entity}}") if err != nil { return err } diff --git a/google-beta/resource_storage_default_object_access_control_generated_test.go b/google-beta/resource_storage_default_object_access_control_generated_test.go index af91c9bc42..29b98e0324 100644 --- a/google-beta/resource_storage_default_object_access_control_generated_test.go +++ b/google-beta/resource_storage_default_object_access_control_generated_test.go @@ -74,7 +74,7 @@ func testAccCheckStorageDefaultObjectAccessControlDestroy(s *terraform.State) er config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/storage/v1/b/{{bucket}}/defaultObjectAcl/{{entity}}") + url, err := replaceVarsForTest(rs, "{{StorageBasePath}}b/{{bucket}}/defaultObjectAcl/{{entity}}") if err != nil { return err } diff --git a/google-beta/resource_storage_object_access_control.go b/google-beta/resource_storage_object_access_control.go index a5dfad2478..ab5538aa5b 100644 --- a/google-beta/resource_storage_object_access_control.go +++ b/google-beta/resource_storage_object_access_control.go @@ -128,7 +128,7 @@ func resourceStorageObjectAccessControlCreate(d *schema.ResourceData, meta inter obj["role"] = roleProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/o/{{object}}/acl") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/o/{{object}}/acl") if err != nil { return err } @@ -154,7 +154,7 @@ func resourceStorageObjectAccessControlCreate(d *schema.ResourceData, meta inter func resourceStorageObjectAccessControlRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/o/{{object}}/acl/{{entity}}") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/o/{{object}}/acl/{{entity}}") if err != nil { return err } @@ -224,7 +224,7 @@ func resourceStorageObjectAccessControlUpdate(d *schema.ResourceData, meta inter obj["role"] = roleProp } - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/o/{{object}}/acl/{{entity}}") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/o/{{object}}/acl/{{entity}}") if err != nil { return err } @@ -242,7 +242,7 @@ func resourceStorageObjectAccessControlUpdate(d *schema.ResourceData, meta inter func resourceStorageObjectAccessControlDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://www.googleapis.com/storage/v1/b/{{bucket}}/o/{{object}}/acl/{{entity}}") + url, err := replaceVars(d, config, "{{StorageBasePath}}b/{{bucket}}/o/{{object}}/acl/{{entity}}") if err != nil { return err } diff --git a/google-beta/resource_storage_object_access_control_generated_test.go b/google-beta/resource_storage_object_access_control_generated_test.go index 49350f47ae..dd619937fe 100644 --- a/google-beta/resource_storage_object_access_control_generated_test.go +++ b/google-beta/resource_storage_object_access_control_generated_test.go @@ -80,7 +80,7 @@ func testAccCheckStorageObjectAccessControlDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://www.googleapis.com/storage/v1/b/{{bucket}}/o/{{object}}/acl/{{entity}}") + url, err := replaceVarsForTest(rs, "{{StorageBasePath}}b/{{bucket}}/o/{{object}}/acl/{{entity}}") if err != nil { return err } diff --git a/google-beta/resource_tpu_node.go b/google-beta/resource_tpu_node.go index f4381e753e..52f57b6c04 100644 --- a/google-beta/resource_tpu_node.go +++ b/google-beta/resource_tpu_node.go @@ -219,7 +219,7 @@ func resourceTpuNodeCreate(d *schema.ResourceData, meta interface{}) error { obj["labels"] = labelsProp } - url, err := replaceVars(d, config, "https://tpu.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/nodes?nodeId={{name}}") + url, err := replaceVars(d, config, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes?nodeId={{name}}") if err != nil { return err } @@ -259,7 +259,7 @@ func resourceTpuNodeCreate(d *schema.ResourceData, meta interface{}) error { func resourceTpuNodeRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://tpu.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/nodes/{{name}}") + url, err := replaceVars(d, config, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") if err != nil { return err } @@ -325,7 +325,7 @@ func resourceTpuNodeUpdate(d *schema.ResourceData, meta interface{}) error { obj["tensorflowVersion"] = tensorflowVersionProp } - url, err := replaceVars(d, config, "https://tpu.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/nodes/{{name}}:reimage") + url, err := replaceVars(d, config, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}:reimage") if err != nil { return err } @@ -358,7 +358,7 @@ func resourceTpuNodeUpdate(d *schema.ResourceData, meta interface{}) error { func resourceTpuNodeDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "https://tpu.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/nodes/{{name}}") + url, err := replaceVars(d, config, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") if err != nil { return err } diff --git a/google-beta/resource_tpu_node_generated_test.go b/google-beta/resource_tpu_node_generated_test.go index f2c731d357..2ef7a6e793 100644 --- a/google-beta/resource_tpu_node_generated_test.go +++ b/google-beta/resource_tpu_node_generated_test.go @@ -132,7 +132,7 @@ func testAccCheckTpuNodeDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(rs, "https://tpu.googleapis.com/v1/projects/{{project}}/locations/{{zone}}/nodes/{{name}}") + url, err := replaceVarsForTest(rs, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") if err != nil { return err } diff --git a/google-beta/transport.go b/google-beta/transport.go index 23970c47d9..dd5566d9f4 100644 --- a/google-beta/transport.go +++ b/google-beta/transport.go @@ -179,6 +179,15 @@ func buildReplacementFunc(re *regexp.Regexp, d TerraformResourceData, config *Co return fmt.Sprintf("%v", v) } } + + // terraform-google-conversion doesn't provide a provider config in tests. + if config != nil { + // Attempt to draw values from the provider config if it's present. + if f := reflect.Indirect(reflect.ValueOf(config)).FieldByName(m); f.IsValid() { + return f.String() + } + } + return "" } diff --git a/website/docs/provider_reference.html.markdown b/website/docs/provider_reference.html.markdown index c45b7e47f0..2a978ca992 100644 --- a/website/docs/provider_reference.html.markdown +++ b/website/docs/provider_reference.html.markdown @@ -97,6 +97,13 @@ authenticate HTTP requests to GCP APIs. This is an alternative to `credentials`, and ignores the `scopes` field. If both are specified, `access_token` will be used over the `credentials` field. +* `{{service}}_custom_endpoint` - (Optional) The endpoint for a service's APIs, +such as `compute_custom_endpoint`. Defaults to the production GCP endpoint for +the service. This can be used to configure the Google provider to communicate +with GCP-like APIs such as [the Cloud Functions emulator](https://github.com/googlearchive/cloud-functions-emulator). +Values are expected to include the version of the service, such as +`https://www.googleapis.com/compute/v1/`. + ### Full Reference * `credentials` - (Optional) Either the path to or the contents of a @@ -191,6 +198,74 @@ an access token using the service account key specified in `credentials`. * https://www.googleapis.com/auth/ndev.clouddns.readwrite * https://www.googleapis.com/auth/devstorage.full_control +--- + +* `{{service}}_custom_endpoint` - (Optional) The endpoint for a service's APIs, +such as `compute_custom_endpoint`. Defaults to the production GCP endpoint for +the service. This can be used to configure the Google provider to communicate +with GCP-like APIs such as [the Cloud Functions emulator](https://github.com/googlearchive/cloud-functions-emulator). +Values are expected to include the version of the service, such as +`https://www.googleapis.com/compute/v1/`. + +~> Support for custom endpoints is on a best-effort basis. The underlying +endpoint and default values for a resource can be changed at any time without +being considered a breaking change. + +A full list of configurable keys, their default value (in the `google` provider +followed by `google-beta` if they differ), and an environment variable that can +be used for configuration are below: + +* `access_context_manager_custom_endpoint` (`GOOGLE_ACCESS_CONTEXT_MANAGER_CUSTOM_ENDPOINT`) - `https://accesscontextmanager.googleapis.com/v1/` +* `app_engine_custom_endpoint` (`GOOGLE_APP_ENGINE_CUSTOM_ENDPOINT`) - `https://appengine.googleapis.com/v1/` +* `bigquery_custom_endpoint` (`GOOGLE_BIGQUERY_CUSTOM_ENDPOINT`) - `https://www.googleapis.com/bigquery/v2/` +* `cloud_billing_custom_endpoint` (`GOOGLE_CLOUD_BILLING_CUSTOM_ENDPOINT`) - `https://cloudbilling.googleapis.com/v1/` +* `cloud_build_custom_endpoint` (`GOOGLE_CLOUD_BUILD_CUSTOM_ENDPOINT`) - `https://cloudbuild.googleapis.com/v1/` +* `cloud_functions_custom_endpoint` (`GOOGLE_CLOUD_FUNCTIONS_CUSTOM_ENDPOINT`) - `https://cloudfunctions.googleapis.com/v1/` +* `cloud_iot_custom_endpoint` (`GOOGLE_CLOUD_IOT_CUSTOM_ENDPOINT`) - `https://cloudiot.googleapis.com/v1/` +* `cloud_scheduler_custom_endpoint` (`GOOGLE_CLOUD_SCHEDULER_CUSTOM_ENDPOINT`) - `https://cloudscheduler.googleapis.com/v1/` +* `composer_custom_endpoint` (`GOOGLE_COMPOSER_CUSTOM_ENDPOINT`) - `https://composer.googleapis.com/v1beta1/` +* `compute_custom_endpoint` (`GOOGLE_COMPUTE_CUSTOM_ENDPOINT`) - `https://www.googleapis.com/compute/v1/` | `https://www.googleapis.com/compute/beta/` +* `compute_beta_custom_endpoint` (`GOOGLE_COMPUTE_BETA_CUSTOM_ENDPOINT`) - `https://www.googleapis.com/compute/beta/` +* `container_custom_endpoint` (`GOOGLE_CONTAINER_CUSTOM_ENDPOINT`) - `https://container.googleapis.com/v1/` +* `container_beta_custom_endpoint` (`GOOGLE_CONTAINER_BETA_CUSTOM_ENDPOINT`) - `https://container.googleapis.com/v1beta1/` +* `dataproc_custom_endpoint` (`GOOGLE_DATAPROC_CUSTOM_ENDPOINT`) - `https://dataproc.googleapis.com/v1/` +* `dataflow_custom_endpoint` (`GOOGLE_DATAFLOW_CUSTOM_ENDPOINT`) - `https://dataflow.googleapis.com/v1b3/` +* `dns_custom_endpoint` (`GOOGLE_DNS_CUSTOM_ENDPOINT`) - `https://www.googleapis.com/dns/v1/` | `https://www.googleapis.com/dns/v1beta2/` +* `dns_beta_custom_endpoint` (`GOOGLE_DNS_BETA_CUSTOM_ENDPOINT`) - `https://www.googleapis.com/dns/v1beta2/` +* `filestore_custom_endpoint` (`GOOGLE_FILESTORE_CUSTOM_ENDPOINT`) - `https://file.googleapis.com/v1/` +* `firestore_custom_endpoint` (`GOOGLE_FIRESTORE_CUSTOM_ENDPOINT`) - `https://firestore.googleapis.com/v1/` +* `iam_custom_endpoint` (`GOOGLE_IAM_CUSTOM_ENDPOINT`) - `https://iam.googleapis.com/v1/` +* `iam_credentials_custom_endpoint` (`GOOGLE_IAM_CREDENTIALS_CUSTOM_ENDPOINT`) - `https://iamcredentials.googleapis.com/v1/` +* `kms_custom_endpoint` (`GOOGLE_KMS_CUSTOM_ENDPOINT`) - `https://cloudkms.googleapis.com/v1/` +* `logging_custom_endpoint` (`GOOGLE_LOGGING_CUSTOM_ENDPOINT`) - `https://logging.googleapis.com/v2/` +* `monitoring_custom_endpoint` (`GOOGLE_MONITORING_CUSTOM_ENDPOINT`) - `https://monitoring.googleapis.com/v3/` +* `pubsub_custom_endpoint` (`GOOGLE_PUBSUB_CUSTOM_ENDPOINT`) - `https://pubsub.googleapis.com/v1/` +* `redis_custom_endpoint` (`GOOGLE_REDIS_CUSTOM_ENDPOINT`) - `https://redis.googleapis.com/v1/` | `https://redis.googleapis.com/v1beta1/` +* `resource_manager_custom_endpoint` (`GOOGLE_RESOURCE_MANAGER_CUSTOM_ENDPOINT`) - `https://cloudresourcemanager.googleapis.com/v1/` +* `resource_manager_v2beta1_custom_endpoint` (`GOOGLE_RESOURCE_MANAGER_V2BETA1_CUSTOM_ENDPOINT`) - `https://cloudresourcemanager.googleapis.com/v2beta1/` +* `runtimeconfig_custom_endpoint` (`GOOGLE_RUNTIMECONFIG_CUSTOM_ENDPOINT`) - `https://runtimeconfig.googleapis.com/v1beta1/` +* `service_management_custom_endpoint` (`GOOGLE_SERVICE_MANAGEMENT_CUSTOM_ENDPOINT`) - `https://servicemanagement.googleapis.com/v1/` +* `service_usage_custom_endpoint` (`GOOGLE_SERVICE_USAGE_CUSTOM_ENDPOINT`) - `https://serviceusage.googleapis.com/v1/` +* `source_repo_custom_endpoint` (`GOOGLE_SOURCE_REPO_CUSTOM_ENDPOINT`) - `https://sourcerepo.googleapis.com/v1/` +* `spanner_custom_endpoint` (`GOOGLE_SPANNER_CUSTOM_ENDPOINT`) - `https://spanner.googleapis.com/v1/` +* `sql_custom_endpoint` (`GOOGLE_SQL_CUSTOM_ENDPOINT`) - `https://www.googleapis.com/sql/v1beta4/` +* `storage_custom_endpoint` (`GOOGLE_STORAGE_CUSTOM_ENDPOINT`) - `https://www.googleapis.com/storage/v1/` +* `storage_transfer_custom_endpoint` (`GOOGLE_STORAGE_TRANSFER_CUSTOM_ENDPOINT`) - `https://storagetransfer.googleapis.com/v1/` +* `tpu_custom_endpoint` (`GOOGLE_TPU_CUSTOM_ENDPOINT`) - `https://tpu.googleapis.com/v1/` + +The following keys are available exclusively in the `google-beta` provider: + +* `binary_authorization_custom_endpoint` (`GOOGLE_BINARY_AUTHORIZATION_CUSTOM_ENDPOINT`) - `https://binaryauthorization.googleapis.com/v1beta1/` +* `container_analysis_custom_endpoint` (`GOOGLE_CONTAINER_ANALYSIS_CUSTOM_ENDPOINT`) - `https://containeranalysis.googleapis.com/v1beta1/` +* `iap_custom_endpoint` (`GOOGLE_IAP_CUSTOM_ENDPOINT`) - `https://iap.googleapis.com/v1beta1/` +* `security_scanner_custom_endpoint` (`GOOGLE_SECURITY_SCANNER_CUSTOM_ENDPOINT`) - `https://websecurityscanner.googleapis.com/v1beta/` +* `service_networking_custom_endpoint` (`GOOGLE_SERVICE_NETWORKING_CUSTOM_ENDPOINT`) - `https://servicenetworking.googleapis.com/v1beta/` + +-> Note that some endpoints are a versioned variant of another. These exist in +cases where the `google` provider uses multiple distinct endpoints, and both +need to be set. Additionally, in `google-beta`, they'll often use the same value +as their versioned counterpart but that won't necessarily always be the case. + [OAuth 2.0 access token]: https://developers.google.com/identity/protocols/OAuth2 [service account key file]: https://cloud.google.com/iam/docs/creating-managing-service-account-keys [manage key files using the Cloud Console]: https://console.cloud.google.com/apis/credentials/serviceaccountkey