From fe6bc29bf4e66df2197e2aabd25392cb30d3cffc Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Thu, 29 Aug 2019 19:35:38 +0000 Subject: [PATCH] Fix initialisms in product names Signed-off-by: Modular Magician --- google/config.go | 30 +-- google/data_source_google_kms_crypto_key.go | 4 +- ...ta_source_google_kms_crypto_key_version.go | 6 +- google/data_source_google_kms_key_ring.go | 4 +- google/provider.go | 50 ++--- ...esource_app_engine_standard_app_version.go | 10 +- google/resource_cloud_build_trigger.go | 4 +- google/resource_compute_backend_service.go | 12 +- google/resource_compute_network.go | 12 +- ...resource_compute_region_backend_service.go | 10 +- google/resource_compute_snapshot.go | 4 +- google/resource_compute_ssl_certificate.go | 4 +- google/resource_compute_url_map.go | 100 +++++----- google/resource_dns_managed_zone.go | 182 +++++++++--------- ...esource_dns_managed_zone_generated_test.go | 22 +-- google/resource_kms_crypto_key.go | 110 +++++------ google/resource_kms_crypto_key_test.go | 2 +- google/resource_kms_key_ring.go | 50 ++--- google/resource_spanner_instance.go | 10 +- google/resource_sql_database.go | 76 ++++---- .../resource_sql_database_generated_test.go | 14 +- google/resource_tpu_node.go | 126 ++++++------ google/resource_tpu_node_generated_test.go | 22 +-- google/tpu_operation.go | 6 +- website/docs/r/tpu_node.html.markdown | 4 +- 25 files changed, 437 insertions(+), 437 deletions(-) diff --git a/google/config.go b/google/config.go index a10cdd0d836..c211c9f2b2c 100644 --- a/google/config.go +++ b/google/config.go @@ -78,23 +78,23 @@ type Config struct { CloudBuildBasePath string CloudSchedulerBasePath string ComputeBasePath string + DNSBasePath string DataprocBasePath string - DnsBasePath string FilestoreBasePath string FirestoreBasePath string - KmsBasePath string + KMSBasePath string LoggingBasePath string MLEngineBasePath string MonitoringBasePath string PubsubBasePath string RedisBasePath string ResourceManagerBasePath string + SQLBasePath string SecurityCenterBasePath string SourceRepoBasePath string SpannerBasePath string - SqlBasePath string StorageBasePath string - TpuBasePath string + TPUBasePath string CloudBillingBasePath string clientBilling *cloudbilling.APIService @@ -203,23 +203,23 @@ var BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis var CloudBuildDefaultBasePath = "https://cloudbuild.googleapis.com/v1/" var CloudSchedulerDefaultBasePath = "https://cloudscheduler.googleapis.com/v1/" var ComputeDefaultBasePath = "https://www.googleapis.com/compute/v1/" +var DNSDefaultBasePath = "https://www.googleapis.com/dns/v1/" var DataprocDefaultBasePath = "https://dataproc.googleapis.com/v1/" -var DnsDefaultBasePath = "https://www.googleapis.com/dns/v1/" var FilestoreDefaultBasePath = "https://file.googleapis.com/v1/" var FirestoreDefaultBasePath = "https://firestore.googleapis.com/v1/" -var KmsDefaultBasePath = "https://cloudkms.googleapis.com/v1/" +var KMSDefaultBasePath = "https://cloudkms.googleapis.com/v1/" var LoggingDefaultBasePath = "https://logging.googleapis.com/v2/" var MLEngineDefaultBasePath = "https://ml.googleapis.com/v1/" var MonitoringDefaultBasePath = "https://monitoring.googleapis.com/v3/" var PubsubDefaultBasePath = "https://pubsub.googleapis.com/v1/" var RedisDefaultBasePath = "https://redis.googleapis.com/v1/" var ResourceManagerDefaultBasePath = "https://cloudresourcemanager.googleapis.com/v1/" +var SQLDefaultBasePath = "https://www.googleapis.com/sql/v1beta4/" var SecurityCenterDefaultBasePath = "https://securitycenter.googleapis.com/v1/" var SourceRepoDefaultBasePath = "https://sourcerepo.googleapis.com/v1/" var SpannerDefaultBasePath = "https://spanner.googleapis.com/v1/" -var SqlDefaultBasePath = "https://www.googleapis.com/sql/v1beta4/" var StorageDefaultBasePath = "https://www.googleapis.com/storage/v1/" -var TpuDefaultBasePath = "https://tpu.googleapis.com/v1/" +var TPUDefaultBasePath = "https://tpu.googleapis.com/v1/" var defaultClientScopes = []string{ "https://www.googleapis.com/auth/compute", @@ -297,7 +297,7 @@ func (c *Config) LoadAndValidate() error { c.clientContainerBeta.UserAgent = userAgent c.clientContainerBeta.BasePath = containerBetaClientBasePath - dnsClientBasePath := removeBasePathVersion(c.DnsBasePath) + "v1/projects/" + 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 { @@ -315,7 +315,7 @@ func (c *Config) LoadAndValidate() error { c.clientDnsBeta.UserAgent = userAgent c.clientDnsBeta.BasePath = dnsBetaClientBasePath - kmsClientBasePath := removeBasePathVersion(c.KmsBasePath) + 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 { @@ -342,7 +342,7 @@ func (c *Config) LoadAndValidate() error { c.clientStorage.UserAgent = userAgent c.clientStorage.BasePath = storageClientBasePath - sqlClientBasePath := removeBasePathVersion(c.SqlBasePath) + "v1beta4/" + 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 { @@ -665,23 +665,23 @@ func ConfigureBasePaths(c *Config) { c.CloudBuildBasePath = CloudBuildDefaultBasePath c.CloudSchedulerBasePath = CloudSchedulerDefaultBasePath c.ComputeBasePath = ComputeDefaultBasePath + c.DNSBasePath = DNSDefaultBasePath c.DataprocBasePath = DataprocDefaultBasePath - c.DnsBasePath = DnsDefaultBasePath c.FilestoreBasePath = FilestoreDefaultBasePath c.FirestoreBasePath = FirestoreDefaultBasePath - c.KmsBasePath = KmsDefaultBasePath + c.KMSBasePath = KMSDefaultBasePath c.LoggingBasePath = LoggingDefaultBasePath c.MLEngineBasePath = MLEngineDefaultBasePath c.MonitoringBasePath = MonitoringDefaultBasePath c.PubsubBasePath = PubsubDefaultBasePath c.RedisBasePath = RedisDefaultBasePath c.ResourceManagerBasePath = ResourceManagerDefaultBasePath + c.SQLBasePath = SQLDefaultBasePath c.SecurityCenterBasePath = SecurityCenterDefaultBasePath c.SourceRepoBasePath = SourceRepoDefaultBasePath c.SpannerBasePath = SpannerDefaultBasePath - c.SqlBasePath = SqlDefaultBasePath c.StorageBasePath = StorageDefaultBasePath - c.TpuBasePath = TpuDefaultBasePath + c.TPUBasePath = TPUDefaultBasePath // Handwritten Products / Versioned / Atypical Entries c.CloudBillingBasePath = CloudBillingDefaultBasePath diff --git a/google/data_source_google_kms_crypto_key.go b/google/data_source_google_kms_crypto_key.go index e4f20bf209c..fc18918d882 100644 --- a/google/data_source_google_kms_crypto_key.go +++ b/google/data_source_google_kms_crypto_key.go @@ -5,7 +5,7 @@ import ( ) func dataSourceGoogleKmsCryptoKey() *schema.Resource { - dsSchema := datasourceSchemaFromResourceSchema(resourceKmsCryptoKey().Schema) + dsSchema := datasourceSchemaFromResourceSchema(resourceKMSCryptoKey().Schema) addRequiredFieldsToSchema(dsSchema, "name") addRequiredFieldsToSchema(dsSchema, "key_ring") @@ -31,5 +31,5 @@ func dataSourceGoogleKmsCryptoKeyRead(d *schema.ResourceData, meta interface{}) d.SetId(cryptoKeyId.cryptoKeyId()) - return resourceKmsCryptoKeyRead(d, meta) + return resourceKMSCryptoKeyRead(d, meta) } diff --git a/google/data_source_google_kms_crypto_key_version.go b/google/data_source_google_kms_crypto_key_version.go index 4f9c0d785fe..f931ffe36b9 100644 --- a/google/data_source_google_kms_crypto_key_version.go +++ b/google/data_source_google_kms_crypto_key_version.go @@ -59,7 +59,7 @@ func dataSourceGoogleKmsCryptoKeyVersion() *schema.Resource { func dataSourceGoogleKmsCryptoKeyVersionRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "{{KmsBasePath}}{{crypto_key}}/cryptoKeyVersions/{{version}}") + url, err := replaceVars(d, config, "{{KMSBasePath}}{{crypto_key}}/cryptoKeyVersions/{{version}}") if err != nil { return err } @@ -88,7 +88,7 @@ func dataSourceGoogleKmsCryptoKeyVersionRead(d *schema.ResourceData, meta interf return fmt.Errorf("Error reading CryptoKeyVersion: %s", err) } - url, err = replaceVars(d, config, "{{KmsBasePath}}{{crypto_key}}") + url, err = replaceVars(d, config, "{{KMSBasePath}}{{crypto_key}}") if err != nil { return err } @@ -100,7 +100,7 @@ func dataSourceGoogleKmsCryptoKeyVersionRead(d *schema.ResourceData, meta interf } if res["purpose"] == "ASYMMETRIC_SIGN" || res["purpose"] == "ASYMMETRIC_DECRYPT" { - url, err = replaceVars(d, config, "{{KmsBasePath}}{{crypto_key}}/cryptoKeyVersions/{{version}}/publicKey") + url, err = replaceVars(d, config, "{{KMSBasePath}}{{crypto_key}}/cryptoKeyVersions/{{version}}/publicKey") if err != nil { return err } diff --git a/google/data_source_google_kms_key_ring.go b/google/data_source_google_kms_key_ring.go index 3c9bbb01874..50f71cda76c 100644 --- a/google/data_source_google_kms_key_ring.go +++ b/google/data_source_google_kms_key_ring.go @@ -5,7 +5,7 @@ import ( ) func dataSourceGoogleKmsKeyRing() *schema.Resource { - dsSchema := datasourceSchemaFromResourceSchema(resourceKmsKeyRing().Schema) + dsSchema := datasourceSchemaFromResourceSchema(resourceKMSKeyRing().Schema) addRequiredFieldsToSchema(dsSchema, "name") addRequiredFieldsToSchema(dsSchema, "location") addOptionalFieldsToSchema(dsSchema, "project") @@ -31,5 +31,5 @@ func dataSourceGoogleKmsKeyRingRead(d *schema.ResourceData, meta interface{}) er } d.SetId(keyRingId.terraformId()) - return resourceKmsKeyRingRead(d, meta) + return resourceKMSKeyRingRead(d, meta) } diff --git a/google/provider.go b/google/provider.go index 6082011fe7e..c5275236236 100644 --- a/google/provider.go +++ b/google/provider.go @@ -175,21 +175,21 @@ func Provider() terraform.ResourceProvider { "GOOGLE_COMPUTE_CUSTOM_ENDPOINT", }, ComputeDefaultBasePath), }, - "dataproc_custom_endpoint": { + "dns_custom_endpoint": { Type: schema.TypeString, Optional: true, ValidateFunc: validateCustomEndpoint, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ - "GOOGLE_DATAPROC_CUSTOM_ENDPOINT", - }, DataprocDefaultBasePath), + "GOOGLE_DNS_CUSTOM_ENDPOINT", + }, DNSDefaultBasePath), }, - "dns_custom_endpoint": { + "dataproc_custom_endpoint": { Type: schema.TypeString, Optional: true, ValidateFunc: validateCustomEndpoint, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ - "GOOGLE_DNS_CUSTOM_ENDPOINT", - }, DnsDefaultBasePath), + "GOOGLE_DATAPROC_CUSTOM_ENDPOINT", + }, DataprocDefaultBasePath), }, "filestore_custom_endpoint": { Type: schema.TypeString, @@ -213,7 +213,7 @@ func Provider() terraform.ResourceProvider { ValidateFunc: validateCustomEndpoint, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ "GOOGLE_KMS_CUSTOM_ENDPOINT", - }, KmsDefaultBasePath), + }, KMSDefaultBasePath), }, "logging_custom_endpoint": { Type: schema.TypeString, @@ -263,6 +263,14 @@ func Provider() terraform.ResourceProvider { "GOOGLE_RESOURCE_MANAGER_CUSTOM_ENDPOINT", }, ResourceManagerDefaultBasePath), }, + "sql_custom_endpoint": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateCustomEndpoint, + DefaultFunc: schema.MultiEnvDefaultFunc([]string{ + "GOOGLE_SQL_CUSTOM_ENDPOINT", + }, SQLDefaultBasePath), + }, "security_center_custom_endpoint": { Type: schema.TypeString, Optional: true, @@ -287,14 +295,6 @@ func Provider() terraform.ResourceProvider { "GOOGLE_SPANNER_CUSTOM_ENDPOINT", }, SpannerDefaultBasePath), }, - "sql_custom_endpoint": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validateCustomEndpoint, - DefaultFunc: schema.MultiEnvDefaultFunc([]string{ - "GOOGLE_SQL_CUSTOM_ENDPOINT", - }, SqlDefaultBasePath), - }, "storage_custom_endpoint": { Type: schema.TypeString, Optional: true, @@ -309,7 +309,7 @@ func Provider() terraform.ResourceProvider { ValidateFunc: validateCustomEndpoint, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ "GOOGLE_TPU_CUSTOM_ENDPOINT", - }, TpuDefaultBasePath), + }, TPUDefaultBasePath), }, // Handwritten Products / Versioned / Atypical Entries @@ -457,11 +457,11 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) { "google_compute_vpn_gateway": resourceComputeVpnGateway(), "google_compute_url_map": resourceComputeUrlMap(), "google_compute_vpn_tunnel": resourceComputeVpnTunnel(), - "google_dns_managed_zone": resourceDnsManagedZone(), + "google_dns_managed_zone": resourceDNSManagedZone(), "google_filestore_instance": resourceFilestoreInstance(), "google_firestore_index": resourceFirestoreIndex(), - "google_kms_key_ring": resourceKmsKeyRing(), - "google_kms_crypto_key": resourceKmsCryptoKey(), + "google_kms_key_ring": resourceKMSKeyRing(), + "google_kms_crypto_key": resourceKMSCryptoKey(), "google_logging_metric": resourceLoggingMetric(), "google_ml_engine_model": resourceMLEngineModel(), "google_monitoring_alert_policy": resourceMonitoringAlertPolicy(), @@ -475,6 +475,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) { "google_pubsub_subscription": resourcePubsubSubscription(), "google_redis_instance": resourceRedisInstance(), "google_resource_manager_lien": resourceResourceManagerLien(), + "google_sql_database": resourceSQLDatabase(), "google_scc_source": resourceSecurityCenterSource(), "google_sourcerepo_repository": resourceSourceRepoRepository(), "google_sourcerepo_repository_iam_binding": ResourceIamBinding(SourceRepoRepositoryIamSchema, SourceRepoRepositoryIamUpdaterProducer, SourceRepoRepositoryIdParseFunc), @@ -482,10 +483,9 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) { "google_sourcerepo_repository_iam_policy": ResourceIamPolicy(SourceRepoRepositoryIamSchema, SourceRepoRepositoryIamUpdaterProducer, SourceRepoRepositoryIdParseFunc), "google_spanner_instance": resourceSpannerInstance(), "google_spanner_database": resourceSpannerDatabase(), - "google_sql_database": resourceSqlDatabase(), "google_storage_object_access_control": resourceStorageObjectAccessControl(), "google_storage_default_object_access_control": resourceStorageDefaultObjectAccessControl(), - "google_tpu_node": resourceTpuNode(), + "google_tpu_node": resourceTPUNode(), }, map[string]*schema.Resource{ "google_app_engine_application": resourceAppEngineApplication(), @@ -647,23 +647,23 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { config.CloudBuildBasePath = d.Get("cloud_build_custom_endpoint").(string) config.CloudSchedulerBasePath = d.Get("cloud_scheduler_custom_endpoint").(string) config.ComputeBasePath = d.Get("compute_custom_endpoint").(string) + config.DNSBasePath = d.Get("dns_custom_endpoint").(string) config.DataprocBasePath = d.Get("dataproc_custom_endpoint").(string) - config.DnsBasePath = d.Get("dns_custom_endpoint").(string) config.FilestoreBasePath = d.Get("filestore_custom_endpoint").(string) config.FirestoreBasePath = d.Get("firestore_custom_endpoint").(string) - config.KmsBasePath = d.Get("kms_custom_endpoint").(string) + config.KMSBasePath = d.Get("kms_custom_endpoint").(string) config.LoggingBasePath = d.Get("logging_custom_endpoint").(string) config.MLEngineBasePath = d.Get("ml_engine_custom_endpoint").(string) config.MonitoringBasePath = d.Get("monitoring_custom_endpoint").(string) config.PubsubBasePath = d.Get("pubsub_custom_endpoint").(string) config.RedisBasePath = d.Get("redis_custom_endpoint").(string) config.ResourceManagerBasePath = d.Get("resource_manager_custom_endpoint").(string) + config.SQLBasePath = d.Get("sql_custom_endpoint").(string) config.SecurityCenterBasePath = d.Get("security_center_custom_endpoint").(string) config.SourceRepoBasePath = d.Get("source_repo_custom_endpoint").(string) config.SpannerBasePath = d.Get("spanner_custom_endpoint").(string) - config.SqlBasePath = d.Get("sql_custom_endpoint").(string) config.StorageBasePath = d.Get("storage_custom_endpoint").(string) - config.TpuBasePath = d.Get("tpu_custom_endpoint").(string) + config.TPUBasePath = d.Get("tpu_custom_endpoint").(string) // Handwritten Products / Versioned / Atypical Entries diff --git a/google/resource_app_engine_standard_app_version.go b/google/resource_app_engine_standard_app_version.go index 722f903ad25..9fefaf700ee 100644 --- a/google/resource_app_engine_standard_app_version.go +++ b/google/resource_app_engine_standard_app_version.go @@ -251,7 +251,7 @@ func resourceAppEngineStandardAppVersionCreate(d *schema.ResourceData, meta inte config := meta.(*Config) obj := make(map[string]interface{}) - idProp, err := expandAppEngineStandardAppVersionVersion_id(d.Get("version_id"), d, config) + idProp, err := expandAppEngineStandardAppVersionVersionId(d.Get("version_id"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("version_id"); !isEmptyValue(reflect.ValueOf(idProp)) && (ok || !reflect.DeepEqual(v, idProp)) { @@ -385,7 +385,7 @@ func resourceAppEngineStandardAppVersionRead(d *schema.ResourceData, meta interf if err := d.Set("name", flattenAppEngineStandardAppVersionName(res["name"], d)); err != nil { return fmt.Errorf("Error reading StandardAppVersion: %s", err) } - if err := d.Set("version_id", flattenAppEngineStandardAppVersionVersion_id(res["id"], d)); err != nil { + if err := d.Set("version_id", flattenAppEngineStandardAppVersionVersionId(res["id"], d)); err != nil { return fmt.Errorf("Error reading StandardAppVersion: %s", err) } if err := d.Set("runtime", flattenAppEngineStandardAppVersionRuntime(res["runtime"], d)); err != nil { @@ -413,7 +413,7 @@ func resourceAppEngineStandardAppVersionUpdate(d *schema.ResourceData, meta inte } obj := make(map[string]interface{}) - idProp, err := expandAppEngineStandardAppVersionVersion_id(d.Get("version_id"), d, config) + idProp, err := expandAppEngineStandardAppVersionVersionId(d.Get("version_id"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("version_id"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, idProp)) { @@ -581,7 +581,7 @@ func flattenAppEngineStandardAppVersionName(v interface{}, d *schema.ResourceDat return v } -func flattenAppEngineStandardAppVersionVersion_id(v interface{}, d *schema.ResourceData) interface{} { +func flattenAppEngineStandardAppVersionVersionId(v interface{}, d *schema.ResourceData) interface{} { return v } @@ -734,7 +734,7 @@ func flattenAppEngineStandardAppVersionLibrariesVersion(v interface{}, d *schema return v } -func expandAppEngineStandardAppVersionVersion_id(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandAppEngineStandardAppVersionVersionId(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_cloud_build_trigger.go b/google/resource_cloud_build_trigger.go index 119bafef880..9f2e16fa831 100644 --- a/google/resource_cloud_build_trigger.go +++ b/google/resource_cloud_build_trigger.go @@ -344,7 +344,7 @@ func resourceCloudBuildTriggerRead(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Error reading Trigger: %s", err) } - if err := d.Set("trigger_id", flattenCloudBuildTriggerTrigger_id(res["id"], d)); err != nil { + if err := d.Set("trigger_id", flattenCloudBuildTriggerTriggerId(res["id"], d)); err != nil { return fmt.Errorf("Error reading Trigger: %s", err) } if err := d.Set("description", flattenCloudBuildTriggerDescription(res["description"], d)); err != nil { @@ -497,7 +497,7 @@ func resourceCloudBuildTriggerImport(d *schema.ResourceData, meta interface{}) ( return []*schema.ResourceData{d}, nil } -func flattenCloudBuildTriggerTrigger_id(v interface{}, d *schema.ResourceData) interface{} { +func flattenCloudBuildTriggerTriggerId(v interface{}, d *schema.ResourceData) interface{} { return v } diff --git a/google/resource_compute_backend_service.go b/google/resource_compute_backend_service.go index 18fa20ed818..148af535aef 100644 --- a/google/resource_compute_backend_service.go +++ b/google/resource_compute_backend_service.go @@ -1053,10 +1053,10 @@ func flattenComputeBackendServiceConnectionDraining(v interface{}, d *schema.Res } transformed := make(map[string]interface{}) transformed["connection_draining_timeout_sec"] = - flattenComputeBackendServiceConnectionDrainingConnection_draining_timeout_sec(original["drainingTimeoutSec"], d) + flattenComputeBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(original["drainingTimeoutSec"], d) return []interface{}{transformed} } -func flattenComputeBackendServiceConnectionDrainingConnection_draining_timeout_sec(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { @@ -1394,17 +1394,17 @@ func expandComputeBackendServiceCdnPolicySignedUrlCacheMaxAgeSec(v interface{}, func expandComputeBackendServiceConnectionDraining(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { transformed := make(map[string]interface{}) - transformedConnection_draining_timeout_sec, err := expandComputeBackendServiceConnectionDrainingConnection_draining_timeout_sec(d.Get("connection_draining_timeout_sec"), d, config) + transformedConnectionDrainingTimeoutSec, err := expandComputeBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(d.Get("connection_draining_timeout_sec"), d, config) if err != nil { return nil, err - } else if val := reflect.ValueOf(transformedConnection_draining_timeout_sec); val.IsValid() && !isEmptyValue(val) { - transformed["drainingTimeoutSec"] = transformedConnection_draining_timeout_sec + } else if val := reflect.ValueOf(transformedConnectionDrainingTimeoutSec); val.IsValid() && !isEmptyValue(val) { + transformed["drainingTimeoutSec"] = transformedConnectionDrainingTimeoutSec } return transformed, nil } -func expandComputeBackendServiceConnectionDrainingConnection_draining_timeout_sec(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_compute_network.go b/google/resource_compute_network.go index b1d27c72588..758f7b25c62 100644 --- a/google/resource_compute_network.go +++ b/google/resource_compute_network.go @@ -105,7 +105,7 @@ func resourceComputeNetworkCreate(d *schema.ResourceData, meta interface{}) erro } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - IPv4RangeProp, err := expandComputeNetworkIpv4_range(d.Get("ipv4_range"), d, config) + IPv4RangeProp, err := expandComputeNetworkIpv4Range(d.Get("ipv4_range"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("ipv4_range"); !isEmptyValue(reflect.ValueOf(IPv4RangeProp)) && (ok || !reflect.DeepEqual(v, IPv4RangeProp)) { @@ -236,10 +236,10 @@ func resourceComputeNetworkRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("description", flattenComputeNetworkDescription(res["description"], d)); err != nil { return fmt.Errorf("Error reading Network: %s", err) } - if err := d.Set("gateway_ipv4", flattenComputeNetworkGateway_ipv4(res["gatewayIPv4"], d)); err != nil { + if err := d.Set("gateway_ipv4", flattenComputeNetworkGatewayIpv4(res["gatewayIPv4"], d)); err != nil { return fmt.Errorf("Error reading Network: %s", err) } - if err := d.Set("ipv4_range", flattenComputeNetworkIpv4_range(res["IPv4Range"], d)); err != nil { + if err := d.Set("ipv4_range", flattenComputeNetworkIpv4Range(res["IPv4Range"], d)); err != nil { return fmt.Errorf("Error reading Network: %s", err) } if err := d.Set("name", flattenComputeNetworkName(res["name"], d)); err != nil { @@ -381,11 +381,11 @@ func flattenComputeNetworkDescription(v interface{}, d *schema.ResourceData) int return v } -func flattenComputeNetworkGateway_ipv4(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeNetworkGatewayIpv4(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenComputeNetworkIpv4_range(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeNetworkIpv4Range(v interface{}, d *schema.ResourceData) interface{} { return v } @@ -418,7 +418,7 @@ func expandComputeNetworkDescription(v interface{}, d TerraformResourceData, con return v, nil } -func expandComputeNetworkIpv4_range(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeNetworkIpv4Range(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_compute_region_backend_service.go b/google/resource_compute_region_backend_service.go index 43d393d7a42..45f95ceaceb 100644 --- a/google/resource_compute_region_backend_service.go +++ b/google/resource_compute_region_backend_service.go @@ -578,10 +578,10 @@ func flattenComputeRegionBackendServiceConnectionDraining(v interface{}, d *sche } transformed := make(map[string]interface{}) transformed["connection_draining_timeout_sec"] = - flattenComputeRegionBackendServiceConnectionDrainingConnection_draining_timeout_sec(original["drainingTimeoutSec"], d) + flattenComputeRegionBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(original["drainingTimeoutSec"], d) return []interface{}{transformed} } -func flattenComputeRegionBackendServiceConnectionDrainingConnection_draining_timeout_sec(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeRegionBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { @@ -672,17 +672,17 @@ func expandComputeRegionBackendServiceTimeoutSec(v interface{}, d TerraformResou func expandComputeRegionBackendServiceConnectionDraining(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { transformed := make(map[string]interface{}) - transformedConnection_draining_timeout_sec, err := expandComputeRegionBackendServiceConnectionDrainingConnection_draining_timeout_sec(d.Get("connection_draining_timeout_sec"), d, config) + transformedConnectionDrainingTimeoutSec, err := expandComputeRegionBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(d.Get("connection_draining_timeout_sec"), d, config) if err != nil { return nil, err } else { - transformed["drainingTimeoutSec"] = transformedConnection_draining_timeout_sec + transformed["drainingTimeoutSec"] = transformedConnectionDrainingTimeoutSec } return transformed, nil } -func expandComputeRegionBackendServiceConnectionDrainingConnection_draining_timeout_sec(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeRegionBackendServiceConnectionDrainingConnectionDrainingTimeoutSec(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_compute_snapshot.go b/google/resource_compute_snapshot.go index f38891f053e..2959b703aa0 100644 --- a/google/resource_compute_snapshot.go +++ b/google/resource_compute_snapshot.go @@ -311,7 +311,7 @@ func resourceComputeSnapshotRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("creation_timestamp", flattenComputeSnapshotCreationTimestamp(res["creationTimestamp"], d)); err != nil { return fmt.Errorf("Error reading Snapshot: %s", err) } - if err := d.Set("snapshot_id", flattenComputeSnapshotSnapshot_id(res["id"], d)); err != nil { + if err := d.Set("snapshot_id", flattenComputeSnapshotSnapshotId(res["id"], d)); err != nil { return fmt.Errorf("Error reading Snapshot: %s", err) } if err := d.Set("disk_size_gb", flattenComputeSnapshotDiskSizeGb(res["diskSizeGb"], d)); err != nil { @@ -468,7 +468,7 @@ func flattenComputeSnapshotCreationTimestamp(v interface{}, d *schema.ResourceDa return v } -func flattenComputeSnapshotSnapshot_id(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeSnapshotSnapshotId(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { diff --git a/google/resource_compute_ssl_certificate.go b/google/resource_compute_ssl_certificate.go index 2664c12c19c..02b413d1937 100644 --- a/google/resource_compute_ssl_certificate.go +++ b/google/resource_compute_ssl_certificate.go @@ -208,7 +208,7 @@ func resourceComputeSslCertificateRead(d *schema.ResourceData, meta interface{}) if err := d.Set("description", flattenComputeSslCertificateDescription(res["description"], d)); err != nil { return fmt.Errorf("Error reading SslCertificate: %s", err) } - if err := d.Set("certificate_id", flattenComputeSslCertificateCertificate_id(res["id"], d)); err != nil { + if err := d.Set("certificate_id", flattenComputeSslCertificateCertificateId(res["id"], d)); err != nil { return fmt.Errorf("Error reading SslCertificate: %s", err) } if err := d.Set("name", flattenComputeSslCertificateName(res["name"], d)); err != nil { @@ -292,7 +292,7 @@ func flattenComputeSslCertificateDescription(v interface{}, d *schema.ResourceDa return v } -func flattenComputeSslCertificateCertificate_id(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeSslCertificateCertificateId(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { diff --git a/google/resource_compute_url_map.go b/google/resource_compute_url_map.go index 8cb2f0eecc3..3634fa68486 100644 --- a/google/resource_compute_url_map.go +++ b/google/resource_compute_url_map.go @@ -195,7 +195,7 @@ func resourceComputeUrlMapCreate(d *schema.ResourceData, meta interface{}) error } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - hostRulesProp, err := expandComputeUrlMapHost_rule(d.Get("host_rule"), d, config) + hostRulesProp, err := expandComputeUrlMapHostRule(d.Get("host_rule"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("host_rule"); !isEmptyValue(reflect.ValueOf(hostRulesProp)) && (ok || !reflect.DeepEqual(v, hostRulesProp)) { @@ -213,7 +213,7 @@ func resourceComputeUrlMapCreate(d *schema.ResourceData, meta interface{}) error } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } - pathMatchersProp, err := expandComputeUrlMapPath_matcher(d.Get("path_matcher"), d, config) + pathMatchersProp, err := expandComputeUrlMapPathMatcher(d.Get("path_matcher"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("path_matcher"); !isEmptyValue(reflect.ValueOf(pathMatchersProp)) && (ok || !reflect.DeepEqual(v, pathMatchersProp)) { @@ -299,10 +299,10 @@ func resourceComputeUrlMapRead(d *schema.ResourceData, meta interface{}) error { if err := d.Set("description", flattenComputeUrlMapDescription(res["description"], d)); err != nil { return fmt.Errorf("Error reading UrlMap: %s", err) } - if err := d.Set("host_rule", flattenComputeUrlMapHost_rule(res["hostRules"], d)); err != nil { + if err := d.Set("host_rule", flattenComputeUrlMapHostRule(res["hostRules"], d)); err != nil { return fmt.Errorf("Error reading UrlMap: %s", err) } - if err := d.Set("map_id", flattenComputeUrlMapMap_id(res["id"], d)); err != nil { + if err := d.Set("map_id", flattenComputeUrlMapMapId(res["id"], d)); err != nil { return fmt.Errorf("Error reading UrlMap: %s", err) } if err := d.Set("fingerprint", flattenComputeUrlMapFingerprint(res["fingerprint"], d)); err != nil { @@ -311,7 +311,7 @@ func resourceComputeUrlMapRead(d *schema.ResourceData, meta interface{}) error { if err := d.Set("name", flattenComputeUrlMapName(res["name"], d)); err != nil { return fmt.Errorf("Error reading UrlMap: %s", err) } - if err := d.Set("path_matcher", flattenComputeUrlMapPath_matcher(res["pathMatchers"], d)); err != nil { + if err := d.Set("path_matcher", flattenComputeUrlMapPathMatcher(res["pathMatchers"], d)); err != nil { return fmt.Errorf("Error reading UrlMap: %s", err) } if err := d.Set("test", flattenComputeUrlMapTest(res["tests"], d)); err != nil { @@ -345,7 +345,7 @@ func resourceComputeUrlMapUpdate(d *schema.ResourceData, meta interface{}) error } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - hostRulesProp, err := expandComputeUrlMapHost_rule(d.Get("host_rule"), d, config) + hostRulesProp, err := expandComputeUrlMapHostRule(d.Get("host_rule"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("host_rule"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, hostRulesProp)) { @@ -363,7 +363,7 @@ func resourceComputeUrlMapUpdate(d *schema.ResourceData, meta interface{}) error } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } - pathMatchersProp, err := expandComputeUrlMapPath_matcher(d.Get("path_matcher"), d, config) + pathMatchersProp, err := expandComputeUrlMapPathMatcher(d.Get("path_matcher"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("path_matcher"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, pathMatchersProp)) { @@ -479,7 +479,7 @@ func flattenComputeUrlMapDescription(v interface{}, d *schema.ResourceData) inte return v } -func flattenComputeUrlMapHost_rule(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapHostRule(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } @@ -492,29 +492,29 @@ func flattenComputeUrlMapHost_rule(v interface{}, d *schema.ResourceData) interf continue } transformed.Add(map[string]interface{}{ - "description": flattenComputeUrlMapHost_ruleDescription(original["description"], d), - "hosts": flattenComputeUrlMapHost_ruleHosts(original["hosts"], d), - "path_matcher": flattenComputeUrlMapHost_rulePathMatcher(original["pathMatcher"], d), + "description": flattenComputeUrlMapHostRuleDescription(original["description"], d), + "hosts": flattenComputeUrlMapHostRuleHosts(original["hosts"], d), + "path_matcher": flattenComputeUrlMapHostRulePathMatcher(original["pathMatcher"], d), }) } return transformed } -func flattenComputeUrlMapHost_ruleDescription(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapHostRuleDescription(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenComputeUrlMapHost_ruleHosts(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapHostRuleHosts(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } return schema.NewSet(schema.HashString, v.([]interface{})) } -func flattenComputeUrlMapHost_rulePathMatcher(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapHostRulePathMatcher(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenComputeUrlMapMap_id(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapMapId(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { @@ -532,7 +532,7 @@ func flattenComputeUrlMapName(v interface{}, d *schema.ResourceData) interface{} return v } -func flattenComputeUrlMapPath_matcher(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapPathMatcher(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } @@ -545,30 +545,30 @@ func flattenComputeUrlMapPath_matcher(v interface{}, d *schema.ResourceData) int continue } transformed = append(transformed, map[string]interface{}{ - "default_service": flattenComputeUrlMapPath_matcherDefaultService(original["defaultService"], d), - "description": flattenComputeUrlMapPath_matcherDescription(original["description"], d), - "name": flattenComputeUrlMapPath_matcherName(original["name"], d), - "path_rule": flattenComputeUrlMapPath_matcherPath_rule(original["pathRules"], d), + "default_service": flattenComputeUrlMapPathMatcherDefaultService(original["defaultService"], d), + "description": flattenComputeUrlMapPathMatcherDescription(original["description"], d), + "name": flattenComputeUrlMapPathMatcherName(original["name"], d), + "path_rule": flattenComputeUrlMapPathMatcherPathRule(original["pathRules"], d), }) } return transformed } -func flattenComputeUrlMapPath_matcherDefaultService(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapPathMatcherDefaultService(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } return ConvertSelfLinkToV1(v.(string)) } -func flattenComputeUrlMapPath_matcherDescription(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapPathMatcherDescription(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenComputeUrlMapPath_matcherName(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapPathMatcherName(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenComputeUrlMapPath_matcherPath_rule(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapPathMatcherPathRule(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } @@ -581,20 +581,20 @@ func flattenComputeUrlMapPath_matcherPath_rule(v interface{}, d *schema.Resource continue } transformed = append(transformed, map[string]interface{}{ - "paths": flattenComputeUrlMapPath_matcherPath_rulePaths(original["paths"], d), - "service": flattenComputeUrlMapPath_matcherPath_ruleService(original["service"], d), + "paths": flattenComputeUrlMapPathMatcherPathRulePaths(original["paths"], d), + "service": flattenComputeUrlMapPathMatcherPathRuleService(original["service"], d), }) } return transformed } -func flattenComputeUrlMapPath_matcherPath_rulePaths(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapPathMatcherPathRulePaths(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } return schema.NewSet(schema.HashString, v.([]interface{})) } -func flattenComputeUrlMapPath_matcherPath_ruleService(v interface{}, d *schema.ResourceData) interface{} { +func flattenComputeUrlMapPathMatcherPathRuleService(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } @@ -651,7 +651,7 @@ func expandComputeUrlMapDescription(v interface{}, d TerraformResourceData, conf return v, nil } -func expandComputeUrlMapHost_rule(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapHostRule(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { v = v.(*schema.Set).List() l := v.([]interface{}) req := make([]interface{}, 0, len(l)) @@ -662,21 +662,21 @@ func expandComputeUrlMapHost_rule(v interface{}, d TerraformResourceData, config original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedDescription, err := expandComputeUrlMapHost_ruleDescription(original["description"], d, config) + transformedDescription, err := expandComputeUrlMapHostRuleDescription(original["description"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedDescription); val.IsValid() && !isEmptyValue(val) { transformed["description"] = transformedDescription } - transformedHosts, err := expandComputeUrlMapHost_ruleHosts(original["hosts"], d, config) + transformedHosts, err := expandComputeUrlMapHostRuleHosts(original["hosts"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedHosts); val.IsValid() && !isEmptyValue(val) { transformed["hosts"] = transformedHosts } - transformedPathMatcher, err := expandComputeUrlMapHost_rulePathMatcher(original["path_matcher"], d, config) + transformedPathMatcher, err := expandComputeUrlMapHostRulePathMatcher(original["path_matcher"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedPathMatcher); val.IsValid() && !isEmptyValue(val) { @@ -688,16 +688,16 @@ func expandComputeUrlMapHost_rule(v interface{}, d TerraformResourceData, config return req, nil } -func expandComputeUrlMapHost_ruleDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapHostRuleDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandComputeUrlMapHost_ruleHosts(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapHostRuleHosts(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { v = v.(*schema.Set).List() return v, nil } -func expandComputeUrlMapHost_rulePathMatcher(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapHostRulePathMatcher(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } @@ -709,7 +709,7 @@ func expandComputeUrlMapName(v interface{}, d TerraformResourceData, config *Con return v, nil } -func expandComputeUrlMapPath_matcher(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapPathMatcher(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { l := v.([]interface{}) req := make([]interface{}, 0, len(l)) for _, raw := range l { @@ -719,32 +719,32 @@ func expandComputeUrlMapPath_matcher(v interface{}, d TerraformResourceData, con original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedDefaultService, err := expandComputeUrlMapPath_matcherDefaultService(original["default_service"], d, config) + transformedDefaultService, err := expandComputeUrlMapPathMatcherDefaultService(original["default_service"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedDefaultService); val.IsValid() && !isEmptyValue(val) { transformed["defaultService"] = transformedDefaultService } - transformedDescription, err := expandComputeUrlMapPath_matcherDescription(original["description"], d, config) + transformedDescription, err := expandComputeUrlMapPathMatcherDescription(original["description"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedDescription); val.IsValid() && !isEmptyValue(val) { transformed["description"] = transformedDescription } - transformedName, err := expandComputeUrlMapPath_matcherName(original["name"], d, config) + transformedName, err := expandComputeUrlMapPathMatcherName(original["name"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedName); val.IsValid() && !isEmptyValue(val) { transformed["name"] = transformedName } - transformedPath_rule, err := expandComputeUrlMapPath_matcherPath_rule(original["path_rule"], d, config) + transformedPathRule, err := expandComputeUrlMapPathMatcherPathRule(original["path_rule"], d, config) if err != nil { return nil, err - } else if val := reflect.ValueOf(transformedPath_rule); val.IsValid() && !isEmptyValue(val) { - transformed["pathRules"] = transformedPath_rule + } else if val := reflect.ValueOf(transformedPathRule); val.IsValid() && !isEmptyValue(val) { + transformed["pathRules"] = transformedPathRule } req = append(req, transformed) @@ -754,19 +754,19 @@ func expandComputeUrlMapPath_matcher(v interface{}, d TerraformResourceData, con // ResourceRef only supports 1 type and UrlMap has references to a BackendBucket or BackendService. Just read the self_link string // instead of extracting the name and making a self_link out of it. -func expandComputeUrlMapPath_matcherDefaultService(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapPathMatcherDefaultService(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandComputeUrlMapPath_matcherDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapPathMatcherDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandComputeUrlMapPath_matcherName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapPathMatcherName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandComputeUrlMapPath_matcherPath_rule(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapPathMatcherPathRule(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { l := v.([]interface{}) req := make([]interface{}, 0, len(l)) for _, raw := range l { @@ -776,14 +776,14 @@ func expandComputeUrlMapPath_matcherPath_rule(v interface{}, d TerraformResource original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedPaths, err := expandComputeUrlMapPath_matcherPath_rulePaths(original["paths"], d, config) + transformedPaths, err := expandComputeUrlMapPathMatcherPathRulePaths(original["paths"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedPaths); val.IsValid() && !isEmptyValue(val) { transformed["paths"] = transformedPaths } - transformedService, err := expandComputeUrlMapPath_matcherPath_ruleService(original["service"], d, config) + transformedService, err := expandComputeUrlMapPathMatcherPathRuleService(original["service"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedService); val.IsValid() && !isEmptyValue(val) { @@ -795,14 +795,14 @@ func expandComputeUrlMapPath_matcherPath_rule(v interface{}, d TerraformResource return req, nil } -func expandComputeUrlMapPath_matcherPath_rulePaths(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapPathMatcherPathRulePaths(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { v = v.(*schema.Set).List() return v, nil } // ResourceRef only supports 1 type and UrlMap has references to a BackendBucket or BackendService. Just read the self_link string // instead of extracting the name and making a self_link out of it. -func expandComputeUrlMapPath_matcherPath_ruleService(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandComputeUrlMapPathMatcherPathRuleService(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_dns_managed_zone.go b/google/resource_dns_managed_zone.go index ee83832f4ff..1d40902f0a1 100644 --- a/google/resource_dns_managed_zone.go +++ b/google/resource_dns_managed_zone.go @@ -27,15 +27,15 @@ import ( "github.com/hashicorp/terraform/helper/validation" ) -func resourceDnsManagedZone() *schema.Resource { +func resourceDNSManagedZone() *schema.Resource { return &schema.Resource{ - Create: resourceDnsManagedZoneCreate, - Read: resourceDnsManagedZoneRead, - Update: resourceDnsManagedZoneUpdate, - Delete: resourceDnsManagedZoneDelete, + Create: resourceDNSManagedZoneCreate, + Read: resourceDNSManagedZoneRead, + Update: resourceDNSManagedZoneUpdate, + Delete: resourceDNSManagedZoneDelete, Importer: &schema.ResourceImporter{ - State: resourceDnsManagedZoneImport, + State: resourceDNSManagedZoneImport, }, Timeouts: &schema.ResourceTimeout{ @@ -187,54 +187,54 @@ func dnsManagedZonePrivateVisibilityConfigNetworksSchema() *schema.Resource { } } -func resourceDnsManagedZoneCreate(d *schema.ResourceData, meta interface{}) error { +func resourceDNSManagedZoneCreate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) obj := make(map[string]interface{}) - descriptionProp, err := expandDnsManagedZoneDescription(d.Get("description"), d, config) + descriptionProp, err := expandDNSManagedZoneDescription(d.Get("description"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - dnsNameProp, err := expandDnsManagedZoneDnsName(d.Get("dns_name"), d, config) + dnsNameProp, err := expandDNSManagedZoneDnsName(d.Get("dns_name"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("dns_name"); !isEmptyValue(reflect.ValueOf(dnsNameProp)) && (ok || !reflect.DeepEqual(v, dnsNameProp)) { obj["dnsName"] = dnsNameProp } - dnssecConfigProp, err := expandDnsManagedZoneDnssecConfig(d.Get("dnssec_config"), d, config) + dnssecConfigProp, err := expandDNSManagedZoneDnssecConfig(d.Get("dnssec_config"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("dnssec_config"); !isEmptyValue(reflect.ValueOf(dnssecConfigProp)) && (ok || !reflect.DeepEqual(v, dnssecConfigProp)) { obj["dnssecConfig"] = dnssecConfigProp } - nameProp, err := expandDnsManagedZoneName(d.Get("name"), d, config) + nameProp, err := expandDNSManagedZoneName(d.Get("name"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } - labelsProp, err := expandDnsManagedZoneLabels(d.Get("labels"), d, config) + labelsProp, err := expandDNSManagedZoneLabels(d.Get("labels"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) { obj["labels"] = labelsProp } - visibilityProp, err := expandDnsManagedZoneVisibility(d.Get("visibility"), d, config) + visibilityProp, err := expandDNSManagedZoneVisibility(d.Get("visibility"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("visibility"); !isEmptyValue(reflect.ValueOf(visibilityProp)) && (ok || !reflect.DeepEqual(v, visibilityProp)) { obj["visibility"] = visibilityProp } - privateVisibilityConfigProp, err := expandDnsManagedZonePrivateVisibilityConfig(d.Get("private_visibility_config"), d, config) + privateVisibilityConfigProp, err := expandDNSManagedZonePrivateVisibilityConfig(d.Get("private_visibility_config"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("private_visibility_config"); !isEmptyValue(reflect.ValueOf(privateVisibilityConfigProp)) && (ok || !reflect.DeepEqual(v, privateVisibilityConfigProp)) { obj["privateVisibilityConfig"] = privateVisibilityConfigProp } - url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones") + url, err := replaceVars(d, config, "{{DNSBasePath}}projects/{{project}}/managedZones") if err != nil { return err } @@ -258,13 +258,13 @@ func resourceDnsManagedZoneCreate(d *schema.ResourceData, meta interface{}) erro log.Printf("[DEBUG] Finished creating ManagedZone %q: %#v", d.Id(), res) - return resourceDnsManagedZoneRead(d, meta) + return resourceDNSManagedZoneRead(d, meta) } -func resourceDnsManagedZoneRead(d *schema.ResourceData, meta interface{}) error { +func resourceDNSManagedZoneRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") + url, err := replaceVars(d, config, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } @@ -275,42 +275,42 @@ func resourceDnsManagedZoneRead(d *schema.ResourceData, meta interface{}) error } res, err := sendRequest(config, "GET", project, url, nil) if err != nil { - return handleNotFoundError(err, d, fmt.Sprintf("DnsManagedZone %q", d.Id())) + return handleNotFoundError(err, d, fmt.Sprintf("DNSManagedZone %q", d.Id())) } if err := d.Set("project", project); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("description", flattenDnsManagedZoneDescription(res["description"], d)); err != nil { + if err := d.Set("description", flattenDNSManagedZoneDescription(res["description"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("dns_name", flattenDnsManagedZoneDnsName(res["dnsName"], d)); err != nil { + if err := d.Set("dns_name", flattenDNSManagedZoneDnsName(res["dnsName"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("dnssec_config", flattenDnsManagedZoneDnssecConfig(res["dnssecConfig"], d)); err != nil { + if err := d.Set("dnssec_config", flattenDNSManagedZoneDnssecConfig(res["dnssecConfig"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("name", flattenDnsManagedZoneName(res["name"], d)); err != nil { + if err := d.Set("name", flattenDNSManagedZoneName(res["name"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("name_servers", flattenDnsManagedZoneNameServers(res["nameServers"], d)); err != nil { + if err := d.Set("name_servers", flattenDNSManagedZoneNameServers(res["nameServers"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("labels", flattenDnsManagedZoneLabels(res["labels"], d)); err != nil { + if err := d.Set("labels", flattenDNSManagedZoneLabels(res["labels"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("visibility", flattenDnsManagedZoneVisibility(res["visibility"], d)); err != nil { + if err := d.Set("visibility", flattenDNSManagedZoneVisibility(res["visibility"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } - if err := d.Set("private_visibility_config", flattenDnsManagedZonePrivateVisibilityConfig(res["privateVisibilityConfig"], d)); err != nil { + if err := d.Set("private_visibility_config", flattenDNSManagedZonePrivateVisibilityConfig(res["privateVisibilityConfig"], d)); err != nil { return fmt.Errorf("Error reading ManagedZone: %s", err) } return nil } -func resourceDnsManagedZoneUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceDNSManagedZoneUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) project, err := getProject(d, config) @@ -322,26 +322,26 @@ func resourceDnsManagedZoneUpdate(d *schema.ResourceData, meta interface{}) erro if d.HasChange("description") || d.HasChange("labels") || d.HasChange("private_visibility_config") { obj := make(map[string]interface{}) - descriptionProp, err := expandDnsManagedZoneDescription(d.Get("description"), d, config) + descriptionProp, err := expandDNSManagedZoneDescription(d.Get("description"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - labelsProp, err := expandDnsManagedZoneLabels(d.Get("labels"), d, config) + labelsProp, err := expandDNSManagedZoneLabels(d.Get("labels"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) { obj["labels"] = labelsProp } - privateVisibilityConfigProp, err := expandDnsManagedZonePrivateVisibilityConfig(d.Get("private_visibility_config"), d, config) + privateVisibilityConfigProp, err := expandDNSManagedZonePrivateVisibilityConfig(d.Get("private_visibility_config"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("private_visibility_config"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, privateVisibilityConfigProp)) { obj["privateVisibilityConfig"] = privateVisibilityConfigProp } - url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") + url, err := replaceVars(d, config, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } @@ -357,10 +357,10 @@ func resourceDnsManagedZoneUpdate(d *schema.ResourceData, meta interface{}) erro d.Partial(false) - return resourceDnsManagedZoneRead(d, meta) + return resourceDNSManagedZoneRead(d, meta) } -func resourceDnsManagedZoneDelete(d *schema.ResourceData, meta interface{}) error { +func resourceDNSManagedZoneDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) project, err := getProject(d, config) @@ -368,7 +368,7 @@ func resourceDnsManagedZoneDelete(d *schema.ResourceData, meta interface{}) erro return err } - url, err := replaceVars(d, config, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") + url, err := replaceVars(d, config, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } @@ -385,7 +385,7 @@ func resourceDnsManagedZoneDelete(d *schema.ResourceData, meta interface{}) erro return nil } -func resourceDnsManagedZoneImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func resourceDNSManagedZoneImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) if err := parseImportId([]string{ "projects/(?P[^/]+)/managedZones/(?P[^/]+)", @@ -405,15 +405,15 @@ func resourceDnsManagedZoneImport(d *schema.ResourceData, meta interface{}) ([]* return []*schema.ResourceData{d}, nil } -func flattenDnsManagedZoneDescription(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDescription(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneDnsName(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnsName(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneDnssecConfig(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfig(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return nil } @@ -423,28 +423,28 @@ func flattenDnsManagedZoneDnssecConfig(v interface{}, d *schema.ResourceData) in } transformed := make(map[string]interface{}) transformed["kind"] = - flattenDnsManagedZoneDnssecConfigKind(original["kind"], d) + flattenDNSManagedZoneDnssecConfigKind(original["kind"], d) transformed["non_existence"] = - flattenDnsManagedZoneDnssecConfigNonExistence(original["nonExistence"], d) + flattenDNSManagedZoneDnssecConfigNonExistence(original["nonExistence"], d) transformed["state"] = - flattenDnsManagedZoneDnssecConfigState(original["state"], d) + flattenDNSManagedZoneDnssecConfigState(original["state"], d) transformed["default_key_specs"] = - flattenDnsManagedZoneDnssecConfigDefaultKeySpecs(original["defaultKeySpecs"], d) + flattenDNSManagedZoneDnssecConfigDefaultKeySpecs(original["defaultKeySpecs"], d) return []interface{}{transformed} } -func flattenDnsManagedZoneDnssecConfigKind(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigKind(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneDnssecConfigNonExistence(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigNonExistence(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneDnssecConfigState(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigState(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneDnssecConfigDefaultKeySpecs(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigDefaultKeySpecs(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } @@ -457,19 +457,19 @@ func flattenDnsManagedZoneDnssecConfigDefaultKeySpecs(v interface{}, d *schema.R continue } transformed = append(transformed, map[string]interface{}{ - "algorithm": flattenDnsManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(original["algorithm"], d), - "key_length": flattenDnsManagedZoneDnssecConfigDefaultKeySpecsKeyLength(original["keyLength"], d), - "key_type": flattenDnsManagedZoneDnssecConfigDefaultKeySpecsKeyType(original["keyType"], d), - "kind": flattenDnsManagedZoneDnssecConfigDefaultKeySpecsKind(original["kind"], d), + "algorithm": flattenDNSManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(original["algorithm"], d), + "key_length": flattenDNSManagedZoneDnssecConfigDefaultKeySpecsKeyLength(original["keyLength"], d), + "key_type": flattenDNSManagedZoneDnssecConfigDefaultKeySpecsKeyType(original["keyType"], d), + "kind": flattenDNSManagedZoneDnssecConfigDefaultKeySpecsKind(original["kind"], d), }) } return transformed } -func flattenDnsManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneDnssecConfigDefaultKeySpecsKeyLength(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigDefaultKeySpecsKeyLength(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { @@ -479,34 +479,34 @@ func flattenDnsManagedZoneDnssecConfigDefaultKeySpecsKeyLength(v interface{}, d return v } -func flattenDnsManagedZoneDnssecConfigDefaultKeySpecsKeyType(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigDefaultKeySpecsKeyType(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneDnssecConfigDefaultKeySpecsKind(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneDnssecConfigDefaultKeySpecsKind(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneName(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneName(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneNameServers(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneNameServers(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneLabels(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneLabels(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenDnsManagedZoneVisibility(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZoneVisibility(v interface{}, d *schema.ResourceData) interface{} { if v == nil || v.(string) == "" { return "public" } return v } -func flattenDnsManagedZonePrivateVisibilityConfig(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZonePrivateVisibilityConfig(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return nil } @@ -516,10 +516,10 @@ func flattenDnsManagedZonePrivateVisibilityConfig(v interface{}, d *schema.Resou } transformed := make(map[string]interface{}) transformed["networks"] = - flattenDnsManagedZonePrivateVisibilityConfigNetworks(original["networks"], d) + flattenDNSManagedZonePrivateVisibilityConfigNetworks(original["networks"], d) return []interface{}{transformed} } -func flattenDnsManagedZonePrivateVisibilityConfigNetworks(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZonePrivateVisibilityConfigNetworks(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } @@ -540,24 +540,24 @@ func flattenDnsManagedZonePrivateVisibilityConfigNetworks(v interface{}, d *sche continue } transformed.Add(map[string]interface{}{ - "network_url": flattenDnsManagedZonePrivateVisibilityConfigNetworksNetworkUrl(original["networkUrl"], d), + "network_url": flattenDNSManagedZonePrivateVisibilityConfigNetworksNetworkUrl(original["networkUrl"], d), }) } return transformed } -func flattenDnsManagedZonePrivateVisibilityConfigNetworksNetworkUrl(v interface{}, d *schema.ResourceData) interface{} { +func flattenDNSManagedZonePrivateVisibilityConfigNetworksNetworkUrl(v interface{}, d *schema.ResourceData) interface{} { return v } -func expandDnsManagedZoneDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnsName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnsName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnssecConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil @@ -566,28 +566,28 @@ func expandDnsManagedZoneDnssecConfig(v interface{}, d TerraformResourceData, co original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedKind, err := expandDnsManagedZoneDnssecConfigKind(original["kind"], d, config) + transformedKind, err := expandDNSManagedZoneDnssecConfigKind(original["kind"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedKind); val.IsValid() && !isEmptyValue(val) { transformed["kind"] = transformedKind } - transformedNonExistence, err := expandDnsManagedZoneDnssecConfigNonExistence(original["non_existence"], d, config) + transformedNonExistence, err := expandDNSManagedZoneDnssecConfigNonExistence(original["non_existence"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedNonExistence); val.IsValid() && !isEmptyValue(val) { transformed["nonExistence"] = transformedNonExistence } - transformedState, err := expandDnsManagedZoneDnssecConfigState(original["state"], d, config) + transformedState, err := expandDNSManagedZoneDnssecConfigState(original["state"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedState); val.IsValid() && !isEmptyValue(val) { transformed["state"] = transformedState } - transformedDefaultKeySpecs, err := expandDnsManagedZoneDnssecConfigDefaultKeySpecs(original["default_key_specs"], d, config) + transformedDefaultKeySpecs, err := expandDNSManagedZoneDnssecConfigDefaultKeySpecs(original["default_key_specs"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedDefaultKeySpecs); val.IsValid() && !isEmptyValue(val) { @@ -597,19 +597,19 @@ func expandDnsManagedZoneDnssecConfig(v interface{}, d TerraformResourceData, co return transformed, nil } -func expandDnsManagedZoneDnssecConfigKind(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigKind(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnssecConfigNonExistence(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigNonExistence(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnssecConfigState(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigState(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnssecConfigDefaultKeySpecs(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigDefaultKeySpecs(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { l := v.([]interface{}) req := make([]interface{}, 0, len(l)) for _, raw := range l { @@ -619,28 +619,28 @@ func expandDnsManagedZoneDnssecConfigDefaultKeySpecs(v interface{}, d TerraformR original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedAlgorithm, err := expandDnsManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(original["algorithm"], d, config) + transformedAlgorithm, err := expandDNSManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(original["algorithm"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedAlgorithm); val.IsValid() && !isEmptyValue(val) { transformed["algorithm"] = transformedAlgorithm } - transformedKeyLength, err := expandDnsManagedZoneDnssecConfigDefaultKeySpecsKeyLength(original["key_length"], d, config) + transformedKeyLength, err := expandDNSManagedZoneDnssecConfigDefaultKeySpecsKeyLength(original["key_length"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedKeyLength); val.IsValid() && !isEmptyValue(val) { transformed["keyLength"] = transformedKeyLength } - transformedKeyType, err := expandDnsManagedZoneDnssecConfigDefaultKeySpecsKeyType(original["key_type"], d, config) + transformedKeyType, err := expandDNSManagedZoneDnssecConfigDefaultKeySpecsKeyType(original["key_type"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedKeyType); val.IsValid() && !isEmptyValue(val) { transformed["keyType"] = transformedKeyType } - transformedKind, err := expandDnsManagedZoneDnssecConfigDefaultKeySpecsKind(original["kind"], d, config) + transformedKind, err := expandDNSManagedZoneDnssecConfigDefaultKeySpecsKind(original["kind"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedKind); val.IsValid() && !isEmptyValue(val) { @@ -652,27 +652,27 @@ func expandDnsManagedZoneDnssecConfigDefaultKeySpecs(v interface{}, d TerraformR return req, nil } -func expandDnsManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigDefaultKeySpecsAlgorithm(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnssecConfigDefaultKeySpecsKeyLength(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigDefaultKeySpecsKeyLength(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnssecConfigDefaultKeySpecsKeyType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigDefaultKeySpecsKeyType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneDnssecConfigDefaultKeySpecsKind(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneDnssecConfigDefaultKeySpecsKind(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZoneLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { +func expandDNSManagedZoneLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { if v == nil { return map[string]string{}, nil } @@ -683,11 +683,11 @@ func expandDnsManagedZoneLabels(v interface{}, d TerraformResourceData, config * return m, nil } -func expandDnsManagedZoneVisibility(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZoneVisibility(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandDnsManagedZonePrivateVisibilityConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZonePrivateVisibilityConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil @@ -696,7 +696,7 @@ func expandDnsManagedZonePrivateVisibilityConfig(v interface{}, d TerraformResou original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedNetworks, err := expandDnsManagedZonePrivateVisibilityConfigNetworks(original["networks"], d, config) + transformedNetworks, err := expandDNSManagedZonePrivateVisibilityConfigNetworks(original["networks"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedNetworks); val.IsValid() && !isEmptyValue(val) { @@ -706,7 +706,7 @@ func expandDnsManagedZonePrivateVisibilityConfig(v interface{}, d TerraformResou return transformed, nil } -func expandDnsManagedZonePrivateVisibilityConfigNetworks(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZonePrivateVisibilityConfigNetworks(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { v = v.(*schema.Set).List() l := v.([]interface{}) req := make([]interface{}, 0, len(l)) @@ -717,7 +717,7 @@ func expandDnsManagedZonePrivateVisibilityConfigNetworks(v interface{}, d Terraf original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedNetworkUrl, err := expandDnsManagedZonePrivateVisibilityConfigNetworksNetworkUrl(original["network_url"], d, config) + transformedNetworkUrl, err := expandDNSManagedZonePrivateVisibilityConfigNetworksNetworkUrl(original["network_url"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedNetworkUrl); val.IsValid() && !isEmptyValue(val) { @@ -729,6 +729,6 @@ func expandDnsManagedZonePrivateVisibilityConfigNetworks(v interface{}, d Terraf return req, nil } -func expandDnsManagedZonePrivateVisibilityConfigNetworksNetworkUrl(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandDNSManagedZonePrivateVisibilityConfigNetworksNetworkUrl(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_dns_managed_zone_generated_test.go b/google/resource_dns_managed_zone_generated_test.go index 80992bc7fa7..6414beb0021 100644 --- a/google/resource_dns_managed_zone_generated_test.go +++ b/google/resource_dns_managed_zone_generated_test.go @@ -24,7 +24,7 @@ import ( "github.com/hashicorp/terraform/terraform" ) -func TestAccDnsManagedZone_dnsManagedZoneBasicExample(t *testing.T) { +func TestAccDNSManagedZone_dnsManagedZoneBasicExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -34,10 +34,10 @@ func TestAccDnsManagedZone_dnsManagedZoneBasicExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckDnsManagedZoneDestroy, + CheckDestroy: testAccCheckDNSManagedZoneDestroy, Steps: []resource.TestStep{ { - Config: testAccDnsManagedZone_dnsManagedZoneBasicExample(context), + Config: testAccDNSManagedZone_dnsManagedZoneBasicExample(context), }, { ResourceName: "google_dns_managed_zone.example-zone", @@ -48,7 +48,7 @@ func TestAccDnsManagedZone_dnsManagedZoneBasicExample(t *testing.T) { }) } -func testAccDnsManagedZone_dnsManagedZoneBasicExample(context map[string]interface{}) string { +func testAccDNSManagedZone_dnsManagedZoneBasicExample(context map[string]interface{}) string { return Nprintf(` resource "google_dns_managed_zone" "example-zone" { name = "example-zone" @@ -65,7 +65,7 @@ resource "random_id" "rnd" { `, context) } -func TestAccDnsManagedZone_dnsManagedZonePrivateExample(t *testing.T) { +func TestAccDNSManagedZone_dnsManagedZonePrivateExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -75,10 +75,10 @@ func TestAccDnsManagedZone_dnsManagedZonePrivateExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckDnsManagedZoneDestroy, + CheckDestroy: testAccCheckDNSManagedZoneDestroy, Steps: []resource.TestStep{ { - Config: testAccDnsManagedZone_dnsManagedZonePrivateExample(context), + Config: testAccDNSManagedZone_dnsManagedZonePrivateExample(context), }, { ResourceName: "google_dns_managed_zone.private-zone", @@ -89,7 +89,7 @@ func TestAccDnsManagedZone_dnsManagedZonePrivateExample(t *testing.T) { }) } -func testAccDnsManagedZone_dnsManagedZonePrivateExample(context map[string]interface{}) string { +func testAccDNSManagedZone_dnsManagedZonePrivateExample(context map[string]interface{}) string { return Nprintf(` resource "google_dns_managed_zone" "private-zone" { name = "private-zone%{random_suffix}" @@ -123,7 +123,7 @@ resource "google_compute_network" "network-2" { `, context) } -func testAccCheckDnsManagedZoneDestroy(s *terraform.State) error { +func testAccCheckDNSManagedZoneDestroy(s *terraform.State) error { for name, rs := range s.RootModule().Resources { if rs.Type != "google_dns_managed_zone" { continue @@ -134,14 +134,14 @@ func testAccCheckDnsManagedZoneDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(config, rs, "{{DnsBasePath}}projects/{{project}}/managedZones/{{name}}") + url, err := replaceVarsForTest(config, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } _, err = sendRequest(config, "GET", "", url, nil) if err == nil { - return fmt.Errorf("DnsManagedZone still exists at %s", url) + return fmt.Errorf("DNSManagedZone still exists at %s", url) } } diff --git a/google/resource_kms_crypto_key.go b/google/resource_kms_crypto_key.go index a5de5795730..2041b7754ff 100644 --- a/google/resource_kms_crypto_key.go +++ b/google/resource_kms_crypto_key.go @@ -25,15 +25,15 @@ import ( "github.com/hashicorp/terraform/helper/validation" ) -func resourceKmsCryptoKey() *schema.Resource { +func resourceKMSCryptoKey() *schema.Resource { return &schema.Resource{ - Create: resourceKmsCryptoKeyCreate, - Read: resourceKmsCryptoKeyRead, - Update: resourceKmsCryptoKeyUpdate, - Delete: resourceKmsCryptoKeyDelete, + Create: resourceKMSCryptoKeyCreate, + Read: resourceKMSCryptoKeyRead, + Update: resourceKMSCryptoKeyUpdate, + Delete: resourceKMSCryptoKeyDelete, Importer: &schema.ResourceImporter{ - State: resourceKmsCryptoKeyImport, + State: resourceKMSCryptoKeyImport, }, Timeouts: &schema.ResourceTimeout{ @@ -45,8 +45,8 @@ func resourceKmsCryptoKey() *schema.Resource { SchemaVersion: 1, StateUpgraders: []schema.StateUpgrader{ { - Type: resourceKmsCryptoKeyResourceV0().CoreConfigSchema().ImpliedType(), - Upgrade: resourceKmsCryptoKeyUpgradeV0, + Type: resourceKMSCryptoKeyResourceV0().CoreConfigSchema().ImpliedType(), + Upgrade: resourceKMSCryptoKeyUpgradeV0, Version: 0, }, }, @@ -109,41 +109,41 @@ func resourceKmsCryptoKey() *schema.Resource { } } -func resourceKmsCryptoKeyCreate(d *schema.ResourceData, meta interface{}) error { +func resourceKMSCryptoKeyCreate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) obj := make(map[string]interface{}) - labelsProp, err := expandKmsCryptoKeyLabels(d.Get("labels"), d, config) + labelsProp, err := expandKMSCryptoKeyLabels(d.Get("labels"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) { obj["labels"] = labelsProp } - purposeProp, err := expandKmsCryptoKeyPurpose(d.Get("purpose"), d, config) + purposeProp, err := expandKMSCryptoKeyPurpose(d.Get("purpose"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("purpose"); !isEmptyValue(reflect.ValueOf(purposeProp)) && (ok || !reflect.DeepEqual(v, purposeProp)) { obj["purpose"] = purposeProp } - rotationPeriodProp, err := expandKmsCryptoKeyRotationPeriod(d.Get("rotation_period"), d, config) + rotationPeriodProp, err := expandKMSCryptoKeyRotationPeriod(d.Get("rotation_period"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("rotation_period"); !isEmptyValue(reflect.ValueOf(rotationPeriodProp)) && (ok || !reflect.DeepEqual(v, rotationPeriodProp)) { obj["rotationPeriod"] = rotationPeriodProp } - versionTemplateProp, err := expandKmsCryptoKeyVersionTemplate(d.Get("version_template"), d, config) + versionTemplateProp, err := expandKMSCryptoKeyVersionTemplate(d.Get("version_template"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("version_template"); !isEmptyValue(reflect.ValueOf(versionTemplateProp)) && (ok || !reflect.DeepEqual(v, versionTemplateProp)) { obj["versionTemplate"] = versionTemplateProp } - obj, err = resourceKmsCryptoKeyEncoder(d, meta, obj) + obj, err = resourceKMSCryptoKeyEncoder(d, meta, obj) if err != nil { return err } - url, err := replaceVars(d, config, "{{KmsBasePath}}{{key_ring}}/cryptoKeys?cryptoKeyId={{name}}") + url, err := replaceVars(d, config, "{{KMSBasePath}}{{key_ring}}/cryptoKeys?cryptoKeyId={{name}}") if err != nil { return err } @@ -163,79 +163,79 @@ func resourceKmsCryptoKeyCreate(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] Finished creating CryptoKey %q: %#v", d.Id(), res) - return resourceKmsCryptoKeyRead(d, meta) + return resourceKMSCryptoKeyRead(d, meta) } -func resourceKmsCryptoKeyRead(d *schema.ResourceData, meta interface{}) error { +func resourceKMSCryptoKeyRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "{{KmsBasePath}}{{key_ring}}/cryptoKeys/{{name}}") + url, err := replaceVars(d, config, "{{KMSBasePath}}{{key_ring}}/cryptoKeys/{{name}}") if err != nil { return err } res, err := sendRequest(config, "GET", "", url, nil) if err != nil { - return handleNotFoundError(err, d, fmt.Sprintf("KmsCryptoKey %q", d.Id())) + return handleNotFoundError(err, d, fmt.Sprintf("KMSCryptoKey %q", d.Id())) } - res, err = resourceKmsCryptoKeyDecoder(d, meta, res) + res, err = resourceKMSCryptoKeyDecoder(d, meta, res) if err != nil { return err } if res == nil { // Decoding the object has resulted in it being gone. It may be marked deleted - log.Printf("[DEBUG] Removing KmsCryptoKey because it no longer exists.") + log.Printf("[DEBUG] Removing KMSCryptoKey because it no longer exists.") d.SetId("") return nil } - if err := d.Set("labels", flattenKmsCryptoKeyLabels(res["labels"], d)); err != nil { + if err := d.Set("labels", flattenKMSCryptoKeyLabels(res["labels"], d)); err != nil { return fmt.Errorf("Error reading CryptoKey: %s", err) } - if err := d.Set("purpose", flattenKmsCryptoKeyPurpose(res["purpose"], d)); err != nil { + if err := d.Set("purpose", flattenKMSCryptoKeyPurpose(res["purpose"], d)); err != nil { return fmt.Errorf("Error reading CryptoKey: %s", err) } - if err := d.Set("rotation_period", flattenKmsCryptoKeyRotationPeriod(res["rotationPeriod"], d)); err != nil { + if err := d.Set("rotation_period", flattenKMSCryptoKeyRotationPeriod(res["rotationPeriod"], d)); err != nil { return fmt.Errorf("Error reading CryptoKey: %s", err) } - if err := d.Set("version_template", flattenKmsCryptoKeyVersionTemplate(res["versionTemplate"], d)); err != nil { + if err := d.Set("version_template", flattenKMSCryptoKeyVersionTemplate(res["versionTemplate"], d)); err != nil { return fmt.Errorf("Error reading CryptoKey: %s", err) } return nil } -func resourceKmsCryptoKeyUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceKMSCryptoKeyUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) obj := make(map[string]interface{}) - labelsProp, err := expandKmsCryptoKeyLabels(d.Get("labels"), d, config) + labelsProp, err := expandKMSCryptoKeyLabels(d.Get("labels"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) { obj["labels"] = labelsProp } - rotationPeriodProp, err := expandKmsCryptoKeyRotationPeriod(d.Get("rotation_period"), d, config) + rotationPeriodProp, err := expandKMSCryptoKeyRotationPeriod(d.Get("rotation_period"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("rotation_period"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, rotationPeriodProp)) { obj["rotationPeriod"] = rotationPeriodProp } - versionTemplateProp, err := expandKmsCryptoKeyVersionTemplate(d.Get("version_template"), d, config) + versionTemplateProp, err := expandKMSCryptoKeyVersionTemplate(d.Get("version_template"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("version_template"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, versionTemplateProp)) { obj["versionTemplate"] = versionTemplateProp } - obj, err = resourceKmsCryptoKeyUpdateEncoder(d, meta, obj) + obj, err = resourceKMSCryptoKeyUpdateEncoder(d, meta, obj) if err != nil { return err } - url, err := replaceVars(d, config, "{{KmsBasePath}}{{key_ring}}/cryptoKeys/{{name}}") + url, err := replaceVars(d, config, "{{KMSBasePath}}{{key_ring}}/cryptoKeys/{{name}}") if err != nil { return err } @@ -266,10 +266,10 @@ func resourceKmsCryptoKeyUpdate(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error updating CryptoKey %q: %s", d.Id(), err) } - return resourceKmsCryptoKeyRead(d, meta) + return resourceKMSCryptoKeyRead(d, meta) } -func resourceKmsCryptoKeyDelete(d *schema.ResourceData, meta interface{}) error { +func resourceKMSCryptoKeyDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) cryptoKeyId, err := parseKmsCryptoKeyId(d.Id(), config) @@ -299,7 +299,7 @@ and all its CryptoKeyVersions will be destroyed, but it will still be present on return nil } -func resourceKmsCryptoKeyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func resourceKMSCryptoKeyImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) @@ -314,19 +314,19 @@ func resourceKmsCryptoKeyImport(d *schema.ResourceData, meta interface{}) ([]*sc return []*schema.ResourceData{d}, nil } -func flattenKmsCryptoKeyLabels(v interface{}, d *schema.ResourceData) interface{} { +func flattenKMSCryptoKeyLabels(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenKmsCryptoKeyPurpose(v interface{}, d *schema.ResourceData) interface{} { +func flattenKMSCryptoKeyPurpose(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenKmsCryptoKeyRotationPeriod(v interface{}, d *schema.ResourceData) interface{} { +func flattenKMSCryptoKeyRotationPeriod(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenKmsCryptoKeyVersionTemplate(v interface{}, d *schema.ResourceData) interface{} { +func flattenKMSCryptoKeyVersionTemplate(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return nil } @@ -336,20 +336,20 @@ func flattenKmsCryptoKeyVersionTemplate(v interface{}, d *schema.ResourceData) i } transformed := make(map[string]interface{}) transformed["algorithm"] = - flattenKmsCryptoKeyVersionTemplateAlgorithm(original["algorithm"], d) + flattenKMSCryptoKeyVersionTemplateAlgorithm(original["algorithm"], d) transformed["protection_level"] = - flattenKmsCryptoKeyVersionTemplateProtectionLevel(original["protectionLevel"], d) + flattenKMSCryptoKeyVersionTemplateProtectionLevel(original["protectionLevel"], d) return []interface{}{transformed} } -func flattenKmsCryptoKeyVersionTemplateAlgorithm(v interface{}, d *schema.ResourceData) interface{} { +func flattenKMSCryptoKeyVersionTemplateAlgorithm(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenKmsCryptoKeyVersionTemplateProtectionLevel(v interface{}, d *schema.ResourceData) interface{} { +func flattenKMSCryptoKeyVersionTemplateProtectionLevel(v interface{}, d *schema.ResourceData) interface{} { return v } -func expandKmsCryptoKeyLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { +func expandKMSCryptoKeyLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { if v == nil { return map[string]string{}, nil } @@ -360,15 +360,15 @@ func expandKmsCryptoKeyLabels(v interface{}, d TerraformResourceData, config *Co return m, nil } -func expandKmsCryptoKeyPurpose(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandKMSCryptoKeyPurpose(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandKmsCryptoKeyRotationPeriod(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandKMSCryptoKeyRotationPeriod(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandKmsCryptoKeyVersionTemplate(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandKMSCryptoKeyVersionTemplate(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil @@ -377,14 +377,14 @@ func expandKmsCryptoKeyVersionTemplate(v interface{}, d TerraformResourceData, c original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedAlgorithm, err := expandKmsCryptoKeyVersionTemplateAlgorithm(original["algorithm"], d, config) + transformedAlgorithm, err := expandKMSCryptoKeyVersionTemplateAlgorithm(original["algorithm"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedAlgorithm); val.IsValid() && !isEmptyValue(val) { transformed["algorithm"] = transformedAlgorithm } - transformedProtectionLevel, err := expandKmsCryptoKeyVersionTemplateProtectionLevel(original["protection_level"], d, config) + transformedProtectionLevel, err := expandKMSCryptoKeyVersionTemplateProtectionLevel(original["protection_level"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedProtectionLevel); val.IsValid() && !isEmptyValue(val) { @@ -394,15 +394,15 @@ func expandKmsCryptoKeyVersionTemplate(v interface{}, d TerraformResourceData, c return transformed, nil } -func expandKmsCryptoKeyVersionTemplateAlgorithm(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandKMSCryptoKeyVersionTemplateAlgorithm(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandKmsCryptoKeyVersionTemplateProtectionLevel(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandKMSCryptoKeyVersionTemplateProtectionLevel(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func resourceKmsCryptoKeyEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { +func resourceKMSCryptoKeyEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { // if rotationPeriod is set, nextRotationTime must also be set. if d.Get("rotation_period") != "" { rotationPeriod := d.Get("rotation_period").(string) @@ -418,7 +418,7 @@ func resourceKmsCryptoKeyEncoder(d *schema.ResourceData, meta interface{}, obj m return obj, nil } -func resourceKmsCryptoKeyUpdateEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { +func resourceKMSCryptoKeyUpdateEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { // if rotationPeriod is changed, nextRotationTime must also be set. if d.HasChange("rotation_period") && d.Get("rotation_period") != "" { rotationPeriod := d.Get("rotation_period").(string) @@ -434,7 +434,7 @@ func resourceKmsCryptoKeyUpdateEncoder(d *schema.ResourceData, meta interface{}, return obj, nil } -func resourceKmsCryptoKeyDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) { +func resourceKMSCryptoKeyDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) { // Take the returned long form of the name and use it as `self_link`. // Then modify the name to be the user specified form. // We can't just ignore_read on `name` as the linter will @@ -445,7 +445,7 @@ func resourceKmsCryptoKeyDecoder(d *schema.ResourceData, meta interface{}, res m return res, nil } -func resourceKmsCryptoKeyResourceV0() *schema.Resource { +func resourceKMSCryptoKeyResourceV0() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -471,7 +471,7 @@ func resourceKmsCryptoKeyResourceV0() *schema.Resource { } } -func resourceKmsCryptoKeyUpgradeV0(rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { +func resourceKMSCryptoKeyUpgradeV0(rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { log.Printf("[DEBUG] Attributes before migration: %#v", rawState) config := meta.(*Config) diff --git a/google/resource_kms_crypto_key_test.go b/google/resource_kms_crypto_key_test.go index 3ba4ebef818..f56eeda296c 100644 --- a/google/resource_kms_crypto_key_test.go +++ b/google/resource_kms_crypto_key_test.go @@ -149,7 +149,7 @@ func TestCryptoKeyStateUpgradeV0(t *testing.T) { } for tn, tc := range cases { t.Run(tn, func(t *testing.T) { - actual, err := resourceKmsCryptoKeyUpgradeV0(tc.Attributes, tc.Meta) + actual, err := resourceKMSCryptoKeyUpgradeV0(tc.Attributes, tc.Meta) if err != nil { t.Error(err) diff --git a/google/resource_kms_key_ring.go b/google/resource_kms_key_ring.go index 194cb461a12..8a5e73ba374 100644 --- a/google/resource_kms_key_ring.go +++ b/google/resource_kms_key_ring.go @@ -23,14 +23,14 @@ import ( "github.com/hashicorp/terraform/helper/schema" ) -func resourceKmsKeyRing() *schema.Resource { +func resourceKMSKeyRing() *schema.Resource { return &schema.Resource{ - Create: resourceKmsKeyRingCreate, - Read: resourceKmsKeyRingRead, - Delete: resourceKmsKeyRingDelete, + Create: resourceKMSKeyRingCreate, + Read: resourceKMSKeyRingRead, + Delete: resourceKMSKeyRingDelete, Importer: &schema.ResourceImporter{ - State: resourceKmsKeyRingImport, + State: resourceKMSKeyRingImport, }, Timeouts: &schema.ResourceTimeout{ @@ -63,29 +63,29 @@ func resourceKmsKeyRing() *schema.Resource { } } -func resourceKmsKeyRingCreate(d *schema.ResourceData, meta interface{}) error { +func resourceKMSKeyRingCreate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) obj := make(map[string]interface{}) - nameProp, err := expandKmsKeyRingName(d.Get("name"), d, config) + nameProp, err := expandKMSKeyRingName(d.Get("name"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } - locationProp, err := expandKmsKeyRingLocation(d.Get("location"), d, config) + locationProp, err := expandKMSKeyRingLocation(d.Get("location"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("location"); !isEmptyValue(reflect.ValueOf(locationProp)) && (ok || !reflect.DeepEqual(v, locationProp)) { obj["location"] = locationProp } - obj, err = resourceKmsKeyRingEncoder(d, meta, obj) + obj, err = resourceKMSKeyRingEncoder(d, meta, obj) if err != nil { return err } - url, err := replaceVars(d, config, "{{KmsBasePath}}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 } @@ -109,13 +109,13 @@ func resourceKmsKeyRingCreate(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Finished creating KeyRing %q: %#v", d.Id(), res) - return resourceKmsKeyRingRead(d, meta) + return resourceKMSKeyRingRead(d, meta) } -func resourceKmsKeyRingRead(d *schema.ResourceData, meta interface{}) error { +func resourceKMSKeyRingRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "{{KmsBasePath}}projects/{{project}}/locations/{{location}}/keyRings/{{name}}") + url, err := replaceVars(d, config, "{{KMSBasePath}}projects/{{project}}/locations/{{location}}/keyRings/{{name}}") if err != nil { return err } @@ -126,17 +126,17 @@ func resourceKmsKeyRingRead(d *schema.ResourceData, meta interface{}) error { } res, err := sendRequest(config, "GET", project, url, nil) if err != nil { - return handleNotFoundError(err, d, fmt.Sprintf("KmsKeyRing %q", d.Id())) + return handleNotFoundError(err, d, fmt.Sprintf("KMSKeyRing %q", d.Id())) } - res, err = resourceKmsKeyRingDecoder(d, meta, res) + res, err = resourceKMSKeyRingDecoder(d, meta, res) if err != nil { return err } if res == nil { // Decoding the object has resulted in it being gone. It may be marked deleted - log.Printf("[DEBUG] Removing KmsKeyRing because it no longer exists.") + log.Printf("[DEBUG] Removing KMSKeyRing because it no longer exists.") d.SetId("") return nil } @@ -145,15 +145,15 @@ func resourceKmsKeyRingRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error reading KeyRing: %s", err) } - if err := d.Set("name", flattenKmsKeyRingName(res["name"], d)); err != nil { + if err := d.Set("name", flattenKMSKeyRingName(res["name"], d)); err != nil { return fmt.Errorf("Error reading KeyRing: %s", err) } return nil } -func resourceKmsKeyRingDelete(d *schema.ResourceData, meta interface{}) error { - log.Printf("[WARNING] Kms KeyRing resources"+ +func resourceKMSKeyRingDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARNING] KMS KeyRing resources"+ " cannot be deleted from GCP. The resource %s will be removed from Terraform"+ " state, but will still be present on the server.", d.Id()) d.SetId("") @@ -161,7 +161,7 @@ func resourceKmsKeyRingDelete(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceKmsKeyRingImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func resourceKMSKeyRingImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) if err := parseImportId([]string{ "projects/(?P[^/]+)/locations/(?P[^/]+)/keyRings/(?P[^/]+)", @@ -181,23 +181,23 @@ func resourceKmsKeyRingImport(d *schema.ResourceData, meta interface{}) ([]*sche return []*schema.ResourceData{d}, nil } -func flattenKmsKeyRingName(v interface{}, d *schema.ResourceData) interface{} { +func flattenKMSKeyRingName(v interface{}, d *schema.ResourceData) interface{} { return v } -func expandKmsKeyRingName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandKMSKeyRingName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandKmsKeyRingLocation(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandKMSKeyRingLocation(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func resourceKmsKeyRingEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { +func resourceKMSKeyRingEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { return nil, nil } -func resourceKmsKeyRingDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) { +func resourceKMSKeyRingDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) { // Take the returned long form of the name and use it as `self_link`. // Then modify the name to be the user specified form. // We can't just ignore_read on `name` as the linter will diff --git a/google/resource_spanner_instance.go b/google/resource_spanner_instance.go index 10766318347..de97ceb50b8 100644 --- a/google/resource_spanner_instance.go +++ b/google/resource_spanner_instance.go @@ -107,7 +107,7 @@ func resourceSpannerInstanceCreate(d *schema.ResourceData, meta interface{}) err } else if v, ok := d.GetOkExists("display_name"); !isEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) { obj["displayName"] = displayNameProp } - nodeCountProp, err := expandSpannerInstanceNum_nodes(d.Get("num_nodes"), d, config) + nodeCountProp, err := expandSpannerInstanceNumNodes(d.Get("num_nodes"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("num_nodes"); !isEmptyValue(reflect.ValueOf(nodeCountProp)) && (ok || !reflect.DeepEqual(v, nodeCountProp)) { @@ -209,7 +209,7 @@ func resourceSpannerInstanceRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("display_name", flattenSpannerInstanceDisplayName(res["displayName"], d)); err != nil { return fmt.Errorf("Error reading Instance: %s", err) } - if err := d.Set("num_nodes", flattenSpannerInstanceNum_nodes(res["nodeCount"], d)); err != nil { + if err := d.Set("num_nodes", flattenSpannerInstanceNumNodes(res["nodeCount"], d)); err != nil { return fmt.Errorf("Error reading Instance: %s", err) } if err := d.Set("labels", flattenSpannerInstanceLabels(res["labels"], d)); err != nil { @@ -243,7 +243,7 @@ func resourceSpannerInstanceUpdate(d *schema.ResourceData, meta interface{}) err } else if v, ok := d.GetOkExists("display_name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, displayNameProp)) { obj["displayName"] = displayNameProp } - nodeCountProp, err := expandSpannerInstanceNum_nodes(d.Get("num_nodes"), d, config) + nodeCountProp, err := expandSpannerInstanceNumNodes(d.Get("num_nodes"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("num_nodes"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nodeCountProp)) { @@ -344,7 +344,7 @@ func flattenSpannerInstanceDisplayName(v interface{}, d *schema.ResourceData) in return v } -func flattenSpannerInstanceNum_nodes(v interface{}, d *schema.ResourceData) interface{} { +func flattenSpannerInstanceNumNodes(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { @@ -384,7 +384,7 @@ func expandSpannerInstanceDisplayName(v interface{}, d TerraformResourceData, co return v, nil } -func expandSpannerInstanceNum_nodes(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandSpannerInstanceNumNodes(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_sql_database.go b/google/resource_sql_database.go index 98b91b106b8..5476f0379ea 100644 --- a/google/resource_sql_database.go +++ b/google/resource_sql_database.go @@ -24,15 +24,15 @@ import ( sqladmin "google.golang.org/api/sqladmin/v1beta4" ) -func resourceSqlDatabase() *schema.Resource { +func resourceSQLDatabase() *schema.Resource { return &schema.Resource{ - Create: resourceSqlDatabaseCreate, - Read: resourceSqlDatabaseRead, - Update: resourceSqlDatabaseUpdate, - Delete: resourceSqlDatabaseDelete, + Create: resourceSQLDatabaseCreate, + Read: resourceSQLDatabaseRead, + Update: resourceSQLDatabaseUpdate, + Delete: resourceSQLDatabaseDelete, Importer: &schema.ResourceImporter{ - State: resourceSqlDatabaseImport, + State: resourceSQLDatabaseImport, }, Timeouts: &schema.ResourceTimeout{ @@ -76,29 +76,29 @@ func resourceSqlDatabase() *schema.Resource { } } -func resourceSqlDatabaseCreate(d *schema.ResourceData, meta interface{}) error { +func resourceSQLDatabaseCreate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) obj := make(map[string]interface{}) - charsetProp, err := expandSqlDatabaseCharset(d.Get("charset"), d, config) + charsetProp, err := expandSQLDatabaseCharset(d.Get("charset"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("charset"); !isEmptyValue(reflect.ValueOf(charsetProp)) && (ok || !reflect.DeepEqual(v, charsetProp)) { obj["charset"] = charsetProp } - collationProp, err := expandSqlDatabaseCollation(d.Get("collation"), d, config) + collationProp, err := expandSQLDatabaseCollation(d.Get("collation"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("collation"); !isEmptyValue(reflect.ValueOf(collationProp)) && (ok || !reflect.DeepEqual(v, collationProp)) { obj["collation"] = collationProp } - nameProp, err := expandSqlDatabaseName(d.Get("name"), d, config) + nameProp, err := expandSQLDatabaseName(d.Get("name"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } - instanceProp, err := expandSqlDatabaseInstance(d.Get("instance"), d, config) + instanceProp, err := expandSQLDatabaseInstance(d.Get("instance"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("instance"); !isEmptyValue(reflect.ValueOf(instanceProp)) && (ok || !reflect.DeepEqual(v, instanceProp)) { @@ -112,7 +112,7 @@ func resourceSqlDatabaseCreate(d *schema.ResourceData, meta interface{}) error { mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases") + url, err := replaceVars(d, config, "{{SQLBasePath}}projects/{{project}}/instances/{{instance}}/databases") if err != nil { return err } @@ -152,13 +152,13 @@ func resourceSqlDatabaseCreate(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Finished creating Database %q: %#v", d.Id(), res) - return resourceSqlDatabaseRead(d, meta) + return resourceSQLDatabaseRead(d, meta) } -func resourceSqlDatabaseRead(d *schema.ResourceData, meta interface{}) error { +func resourceSQLDatabaseRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SQLBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } @@ -169,23 +169,23 @@ func resourceSqlDatabaseRead(d *schema.ResourceData, meta interface{}) error { } res, err := sendRequest(config, "GET", project, url, nil) if err != nil { - return handleNotFoundError(err, d, fmt.Sprintf("SqlDatabase %q", d.Id())) + return handleNotFoundError(err, d, fmt.Sprintf("SQLDatabase %q", d.Id())) } if err := d.Set("project", project); err != nil { return fmt.Errorf("Error reading Database: %s", err) } - if err := d.Set("charset", flattenSqlDatabaseCharset(res["charset"], d)); err != nil { + if err := d.Set("charset", flattenSQLDatabaseCharset(res["charset"], d)); err != nil { return fmt.Errorf("Error reading Database: %s", err) } - if err := d.Set("collation", flattenSqlDatabaseCollation(res["collation"], d)); err != nil { + if err := d.Set("collation", flattenSQLDatabaseCollation(res["collation"], d)); err != nil { return fmt.Errorf("Error reading Database: %s", err) } - if err := d.Set("name", flattenSqlDatabaseName(res["name"], d)); err != nil { + if err := d.Set("name", flattenSQLDatabaseName(res["name"], d)); err != nil { return fmt.Errorf("Error reading Database: %s", err) } - if err := d.Set("instance", flattenSqlDatabaseInstance(res["instance"], d)); err != nil { + if err := d.Set("instance", flattenSQLDatabaseInstance(res["instance"], d)); err != nil { return fmt.Errorf("Error reading Database: %s", err) } if err := d.Set("self_link", ConvertSelfLinkToV1(res["selfLink"].(string))); err != nil { @@ -195,7 +195,7 @@ func resourceSqlDatabaseRead(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceSqlDatabaseUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceSQLDatabaseUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) project, err := getProject(d, config) @@ -204,25 +204,25 @@ func resourceSqlDatabaseUpdate(d *schema.ResourceData, meta interface{}) error { } obj := make(map[string]interface{}) - charsetProp, err := expandSqlDatabaseCharset(d.Get("charset"), d, config) + charsetProp, err := expandSQLDatabaseCharset(d.Get("charset"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("charset"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, charsetProp)) { obj["charset"] = charsetProp } - collationProp, err := expandSqlDatabaseCollation(d.Get("collation"), d, config) + collationProp, err := expandSQLDatabaseCollation(d.Get("collation"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("collation"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, collationProp)) { obj["collation"] = collationProp } - nameProp, err := expandSqlDatabaseName(d.Get("name"), d, config) + nameProp, err := expandSQLDatabaseName(d.Get("name"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } - instanceProp, err := expandSqlDatabaseInstance(d.Get("instance"), d, config) + instanceProp, err := expandSQLDatabaseInstance(d.Get("instance"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("instance"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, instanceProp)) { @@ -236,7 +236,7 @@ func resourceSqlDatabaseUpdate(d *schema.ResourceData, meta interface{}) error { mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SQLBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } @@ -262,10 +262,10 @@ func resourceSqlDatabaseUpdate(d *schema.ResourceData, meta interface{}) error { return err } - return resourceSqlDatabaseRead(d, meta) + return resourceSQLDatabaseRead(d, meta) } -func resourceSqlDatabaseDelete(d *schema.ResourceData, meta interface{}) error { +func resourceSQLDatabaseDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) project, err := getProject(d, config) @@ -280,7 +280,7 @@ func resourceSqlDatabaseDelete(d *schema.ResourceData, meta interface{}) error { mutexKV.Lock(lockName) defer mutexKV.Unlock(lockName) - url, err := replaceVars(d, config, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVars(d, config, "{{SQLBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } @@ -311,7 +311,7 @@ func resourceSqlDatabaseDelete(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceSqlDatabaseImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func resourceSQLDatabaseImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) if err := parseImportId([]string{ "projects/(?P[^/]+)/instances/(?P[^/]+)/databases/(?P[^/]+)", @@ -334,34 +334,34 @@ func resourceSqlDatabaseImport(d *schema.ResourceData, meta interface{}) ([]*sch return []*schema.ResourceData{d}, nil } -func flattenSqlDatabaseCharset(v interface{}, d *schema.ResourceData) interface{} { +func flattenSQLDatabaseCharset(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenSqlDatabaseCollation(v interface{}, d *schema.ResourceData) interface{} { +func flattenSQLDatabaseCollation(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenSqlDatabaseName(v interface{}, d *schema.ResourceData) interface{} { +func flattenSQLDatabaseName(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenSqlDatabaseInstance(v interface{}, d *schema.ResourceData) interface{} { +func flattenSQLDatabaseInstance(v interface{}, d *schema.ResourceData) interface{} { return v } -func expandSqlDatabaseCharset(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandSQLDatabaseCharset(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandSqlDatabaseCollation(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandSQLDatabaseCollation(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandSqlDatabaseName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandSQLDatabaseName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandSqlDatabaseInstance(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandSQLDatabaseInstance(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } diff --git a/google/resource_sql_database_generated_test.go b/google/resource_sql_database_generated_test.go index 3c0c25060c0..1a30bbfbc5b 100644 --- a/google/resource_sql_database_generated_test.go +++ b/google/resource_sql_database_generated_test.go @@ -24,7 +24,7 @@ import ( "github.com/hashicorp/terraform/terraform" ) -func TestAccSqlDatabase_sqlDatabaseBasicExample(t *testing.T) { +func TestAccSQLDatabase_sqlDatabaseBasicExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -34,10 +34,10 @@ func TestAccSqlDatabase_sqlDatabaseBasicExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckSqlDatabaseDestroy, + CheckDestroy: testAccCheckSQLDatabaseDestroy, Steps: []resource.TestStep{ { - Config: testAccSqlDatabase_sqlDatabaseBasicExample(context), + Config: testAccSQLDatabase_sqlDatabaseBasicExample(context), }, { ResourceName: "google_sql_database.database", @@ -48,7 +48,7 @@ func TestAccSqlDatabase_sqlDatabaseBasicExample(t *testing.T) { }) } -func testAccSqlDatabase_sqlDatabaseBasicExample(context map[string]interface{}) string { +func testAccSQLDatabase_sqlDatabaseBasicExample(context map[string]interface{}) string { return Nprintf(` resource "google_sql_database" "database" { name = "my-database%{random_suffix}" @@ -65,7 +65,7 @@ resource "google_sql_database_instance" "instance" { `, context) } -func testAccCheckSqlDatabaseDestroy(s *terraform.State) error { +func testAccCheckSQLDatabaseDestroy(s *terraform.State) error { for name, rs := range s.RootModule().Resources { if rs.Type != "google_sql_database" { continue @@ -76,14 +76,14 @@ func testAccCheckSqlDatabaseDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(config, rs, "{{SqlBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := replaceVarsForTest(config, rs, "{{SQLBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") if err != nil { return err } _, err = sendRequest(config, "GET", "", url, nil) if err == nil { - return fmt.Errorf("SqlDatabase still exists at %s", url) + return fmt.Errorf("SQLDatabase still exists at %s", url) } } diff --git a/google/resource_tpu_node.go b/google/resource_tpu_node.go index 3b3d55c07c7..76b001d10ee 100644 --- a/google/resource_tpu_node.go +++ b/google/resource_tpu_node.go @@ -58,15 +58,15 @@ func validateHttpHeaders() schema.SchemaValidateFunc { } } -func resourceTpuNode() *schema.Resource { +func resourceTPUNode() *schema.Resource { return &schema.Resource{ - Create: resourceTpuNodeCreate, - Read: resourceTpuNodeRead, - Update: resourceTpuNodeUpdate, - Delete: resourceTpuNodeDelete, + Create: resourceTPUNodeCreate, + Read: resourceTPUNodeRead, + Update: resourceTPUNodeUpdate, + Delete: resourceTPUNodeDelete, Importer: &schema.ResourceImporter{ - State: resourceTpuNodeImport, + State: resourceTPUNodeImport, }, Timeouts: &schema.ResourceTimeout{ @@ -166,60 +166,60 @@ func resourceTpuNode() *schema.Resource { } } -func resourceTpuNodeCreate(d *schema.ResourceData, meta interface{}) error { +func resourceTPUNodeCreate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) obj := make(map[string]interface{}) - nameProp, err := expandTpuNodeName(d.Get("name"), d, config) + nameProp, err := expandTPUNodeName(d.Get("name"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } - descriptionProp, err := expandTpuNodeDescription(d.Get("description"), d, config) + descriptionProp, err := expandTPUNodeDescription(d.Get("description"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - acceleratorTypeProp, err := expandTpuNodeAcceleratorType(d.Get("accelerator_type"), d, config) + acceleratorTypeProp, err := expandTPUNodeAcceleratorType(d.Get("accelerator_type"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("accelerator_type"); !isEmptyValue(reflect.ValueOf(acceleratorTypeProp)) && (ok || !reflect.DeepEqual(v, acceleratorTypeProp)) { obj["acceleratorType"] = acceleratorTypeProp } - tensorflowVersionProp, err := expandTpuNodeTensorflowVersion(d.Get("tensorflow_version"), d, config) + tensorflowVersionProp, err := expandTPUNodeTensorflowVersion(d.Get("tensorflow_version"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("tensorflow_version"); !isEmptyValue(reflect.ValueOf(tensorflowVersionProp)) && (ok || !reflect.DeepEqual(v, tensorflowVersionProp)) { obj["tensorflowVersion"] = tensorflowVersionProp } - networkProp, err := expandTpuNodeNetwork(d.Get("network"), d, config) + networkProp, err := expandTPUNodeNetwork(d.Get("network"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("network"); !isEmptyValue(reflect.ValueOf(networkProp)) && (ok || !reflect.DeepEqual(v, networkProp)) { obj["network"] = networkProp } - cidrBlockProp, err := expandTpuNodeCidrBlock(d.Get("cidr_block"), d, config) + cidrBlockProp, err := expandTPUNodeCidrBlock(d.Get("cidr_block"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("cidr_block"); !isEmptyValue(reflect.ValueOf(cidrBlockProp)) && (ok || !reflect.DeepEqual(v, cidrBlockProp)) { obj["cidrBlock"] = cidrBlockProp } - schedulingConfigProp, err := expandTpuNodeSchedulingConfig(d.Get("scheduling_config"), d, config) + schedulingConfigProp, err := expandTPUNodeSchedulingConfig(d.Get("scheduling_config"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("scheduling_config"); !isEmptyValue(reflect.ValueOf(schedulingConfigProp)) && (ok || !reflect.DeepEqual(v, schedulingConfigProp)) { obj["schedulingConfig"] = schedulingConfigProp } - labelsProp, err := expandTpuNodeLabels(d.Get("labels"), d, config) + labelsProp, err := expandTPUNodeLabels(d.Get("labels"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) { obj["labels"] = labelsProp } - url, err := replaceVars(d, config, "{{TpuBasePath}}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 } @@ -253,13 +253,13 @@ func resourceTpuNodeCreate(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Finished creating Node %q: %#v", d.Id(), res) - return resourceTpuNodeRead(d, meta) + return resourceTPUNodeRead(d, meta) } -func resourceTpuNodeRead(d *schema.ResourceData, meta interface{}) error { +func resourceTPUNodeRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) - url, err := replaceVars(d, config, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") + url, err := replaceVars(d, config, "{{TPUBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") if err != nil { return err } @@ -270,48 +270,48 @@ func resourceTpuNodeRead(d *schema.ResourceData, meta interface{}) error { } res, err := sendRequest(config, "GET", project, url, nil) if err != nil { - return handleNotFoundError(err, d, fmt.Sprintf("TpuNode %q", d.Id())) + return handleNotFoundError(err, d, fmt.Sprintf("TPUNode %q", d.Id())) } if err := d.Set("project", project); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("name", flattenTpuNodeName(res["name"], d)); err != nil { + if err := d.Set("name", flattenTPUNodeName(res["name"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("description", flattenTpuNodeDescription(res["description"], d)); err != nil { + if err := d.Set("description", flattenTPUNodeDescription(res["description"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("accelerator_type", flattenTpuNodeAcceleratorType(res["acceleratorType"], d)); err != nil { + if err := d.Set("accelerator_type", flattenTPUNodeAcceleratorType(res["acceleratorType"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("tensorflow_version", flattenTpuNodeTensorflowVersion(res["tensorflowVersion"], d)); err != nil { + if err := d.Set("tensorflow_version", flattenTPUNodeTensorflowVersion(res["tensorflowVersion"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("network", flattenTpuNodeNetwork(res["network"], d)); err != nil { + if err := d.Set("network", flattenTPUNodeNetwork(res["network"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("cidr_block", flattenTpuNodeCidrBlock(res["cidrBlock"], d)); err != nil { + if err := d.Set("cidr_block", flattenTPUNodeCidrBlock(res["cidrBlock"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("service_account", flattenTpuNodeServiceAccount(res["serviceAccount"], d)); err != nil { + if err := d.Set("service_account", flattenTPUNodeServiceAccount(res["serviceAccount"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("scheduling_config", flattenTpuNodeSchedulingConfig(res["schedulingConfig"], d)); err != nil { + if err := d.Set("scheduling_config", flattenTPUNodeSchedulingConfig(res["schedulingConfig"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("network_endpoints", flattenTpuNodeNetworkEndpoints(res["networkEndpoints"], d)); err != nil { + if err := d.Set("network_endpoints", flattenTPUNodeNetworkEndpoints(res["networkEndpoints"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } - if err := d.Set("labels", flattenTpuNodeLabels(res["labels"], d)); err != nil { + if err := d.Set("labels", flattenTPUNodeLabels(res["labels"], d)); err != nil { return fmt.Errorf("Error reading Node: %s", err) } return nil } -func resourceTpuNodeUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceTPUNodeUpdate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) project, err := getProject(d, config) @@ -323,14 +323,14 @@ func resourceTpuNodeUpdate(d *schema.ResourceData, meta interface{}) error { if d.HasChange("tensorflow_version") { obj := make(map[string]interface{}) - tensorflowVersionProp, err := expandTpuNodeTensorflowVersion(d.Get("tensorflow_version"), d, config) + tensorflowVersionProp, err := expandTPUNodeTensorflowVersion(d.Get("tensorflow_version"), d, config) if err != nil { return err } else if v, ok := d.GetOkExists("tensorflow_version"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, tensorflowVersionProp)) { obj["tensorflowVersion"] = tensorflowVersionProp } - url, err := replaceVars(d, config, "{{TpuBasePath}}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 } @@ -352,10 +352,10 @@ func resourceTpuNodeUpdate(d *schema.ResourceData, meta interface{}) error { d.Partial(false) - return resourceTpuNodeRead(d, meta) + return resourceTPUNodeRead(d, meta) } -func resourceTpuNodeDelete(d *schema.ResourceData, meta interface{}) error { +func resourceTPUNodeDelete(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) project, err := getProject(d, config) @@ -363,7 +363,7 @@ func resourceTpuNodeDelete(d *schema.ResourceData, meta interface{}) error { return err } - url, err := replaceVars(d, config, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") + url, err := replaceVars(d, config, "{{TPUBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") if err != nil { return err } @@ -388,7 +388,7 @@ func resourceTpuNodeDelete(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceTpuNodeImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func resourceTPUNodeImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) if err := parseImportId([]string{ "projects/(?P[^/]+)/locations/(?P[^/]+)/nodes/(?P[^/]+)", @@ -409,38 +409,38 @@ func resourceTpuNodeImport(d *schema.ResourceData, meta interface{}) ([]*schema. return []*schema.ResourceData{d}, nil } -func flattenTpuNodeName(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeName(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } return NameFromSelfLinkStateFunc(v) } -func flattenTpuNodeDescription(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeDescription(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeAcceleratorType(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeAcceleratorType(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeTensorflowVersion(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeTensorflowVersion(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeNetwork(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeNetwork(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeCidrBlock(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeCidrBlock(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeServiceAccount(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeServiceAccount(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeSchedulingConfig(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeSchedulingConfig(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return nil } @@ -450,14 +450,14 @@ func flattenTpuNodeSchedulingConfig(v interface{}, d *schema.ResourceData) inter } transformed := make(map[string]interface{}) transformed["preemptible"] = - flattenTpuNodeSchedulingConfigPreemptible(original["preemptible"], d) + flattenTPUNodeSchedulingConfigPreemptible(original["preemptible"], d) return []interface{}{transformed} } -func flattenTpuNodeSchedulingConfigPreemptible(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeSchedulingConfigPreemptible(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeNetworkEndpoints(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeNetworkEndpoints(v interface{}, d *schema.ResourceData) interface{} { if v == nil { return v } @@ -470,17 +470,17 @@ func flattenTpuNodeNetworkEndpoints(v interface{}, d *schema.ResourceData) inter continue } transformed = append(transformed, map[string]interface{}{ - "ip_address": flattenTpuNodeNetworkEndpointsIpAddress(original["ipAddress"], d), - "port": flattenTpuNodeNetworkEndpointsPort(original["port"], d), + "ip_address": flattenTPUNodeNetworkEndpointsIpAddress(original["ipAddress"], d), + "port": flattenTPUNodeNetworkEndpointsPort(original["port"], d), }) } return transformed } -func flattenTpuNodeNetworkEndpointsIpAddress(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeNetworkEndpointsIpAddress(v interface{}, d *schema.ResourceData) interface{} { return v } -func flattenTpuNodeNetworkEndpointsPort(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeNetworkEndpointsPort(v interface{}, d *schema.ResourceData) interface{} { // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { @@ -490,35 +490,35 @@ func flattenTpuNodeNetworkEndpointsPort(v interface{}, d *schema.ResourceData) i return v } -func flattenTpuNodeLabels(v interface{}, d *schema.ResourceData) interface{} { +func flattenTPUNodeLabels(v interface{}, d *schema.ResourceData) interface{} { return v } -func expandTpuNodeName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandTpuNodeDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandTpuNodeAcceleratorType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeAcceleratorType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandTpuNodeTensorflowVersion(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeTensorflowVersion(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandTpuNodeNetwork(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeNetwork(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandTpuNodeCidrBlock(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeCidrBlock(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandTpuNodeSchedulingConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeSchedulingConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil @@ -527,7 +527,7 @@ func expandTpuNodeSchedulingConfig(v interface{}, d TerraformResourceData, confi original := raw.(map[string]interface{}) transformed := make(map[string]interface{}) - transformedPreemptible, err := expandTpuNodeSchedulingConfigPreemptible(original["preemptible"], d, config) + transformedPreemptible, err := expandTPUNodeSchedulingConfigPreemptible(original["preemptible"], d, config) if err != nil { return nil, err } else if val := reflect.ValueOf(transformedPreemptible); val.IsValid() && !isEmptyValue(val) { @@ -537,11 +537,11 @@ func expandTpuNodeSchedulingConfig(v interface{}, d TerraformResourceData, confi return transformed, nil } -func expandTpuNodeSchedulingConfigPreemptible(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { +func expandTPUNodeSchedulingConfigPreemptible(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } -func expandTpuNodeLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { +func expandTPUNodeLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { if v == nil { return map[string]string{}, nil } diff --git a/google/resource_tpu_node_generated_test.go b/google/resource_tpu_node_generated_test.go index 965256b365f..aae1404c840 100644 --- a/google/resource_tpu_node_generated_test.go +++ b/google/resource_tpu_node_generated_test.go @@ -24,7 +24,7 @@ import ( "github.com/hashicorp/terraform/terraform" ) -func TestAccTpuNode_tpuNodeBasicExample(t *testing.T) { +func TestAccTPUNode_tpuNodeBasicExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -34,10 +34,10 @@ func TestAccTpuNode_tpuNodeBasicExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckTpuNodeDestroy, + CheckDestroy: testAccCheckTPUNodeDestroy, Steps: []resource.TestStep{ { - Config: testAccTpuNode_tpuNodeBasicExample(context), + Config: testAccTPUNode_tpuNodeBasicExample(context), }, { ResourceName: "google_tpu_node.tpu", @@ -49,7 +49,7 @@ func TestAccTpuNode_tpuNodeBasicExample(t *testing.T) { }) } -func testAccTpuNode_tpuNodeBasicExample(context map[string]interface{}) string { +func testAccTPUNode_tpuNodeBasicExample(context map[string]interface{}) string { return Nprintf(` data "google_tpu_tensorflow_versions" "available" { } @@ -64,7 +64,7 @@ resource "google_tpu_node" "tpu" { `, context) } -func TestAccTpuNode_tpuNodeFullExample(t *testing.T) { +func TestAccTPUNode_tpuNodeFullExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -74,10 +74,10 @@ func TestAccTpuNode_tpuNodeFullExample(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckTpuNodeDestroy, + CheckDestroy: testAccCheckTPUNodeDestroy, Steps: []resource.TestStep{ { - Config: testAccTpuNode_tpuNodeFullExample(context), + Config: testAccTPUNode_tpuNodeFullExample(context), }, { ResourceName: "google_tpu_node.tpu", @@ -89,7 +89,7 @@ func TestAccTpuNode_tpuNodeFullExample(t *testing.T) { }) } -func testAccTpuNode_tpuNodeFullExample(context map[string]interface{}) string { +func testAccTPUNode_tpuNodeFullExample(context map[string]interface{}) string { return Nprintf(` data "google_tpu_tensorflow_versions" "available" { } @@ -116,7 +116,7 @@ resource "google_tpu_node" "tpu" { `, context) } -func testAccCheckTpuNodeDestroy(s *terraform.State) error { +func testAccCheckTPUNodeDestroy(s *terraform.State) error { for name, rs := range s.RootModule().Resources { if rs.Type != "google_tpu_node" { continue @@ -127,14 +127,14 @@ func testAccCheckTpuNodeDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - url, err := replaceVarsForTest(config, rs, "{{TpuBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") + url, err := replaceVarsForTest(config, rs, "{{TPUBasePath}}projects/{{project}}/locations/{{zone}}/nodes/{{name}}") if err != nil { return err } _, err = sendRequest(config, "GET", "", url, nil) if err == nil { - return fmt.Errorf("TpuNode still exists at %s", url) + return fmt.Errorf("TPUNode still exists at %s", url) } } diff --git a/google/tpu_operation.go b/google/tpu_operation.go index fb3c9c356e5..8962afb7cbe 100644 --- a/google/tpu_operation.go +++ b/google/tpu_operation.go @@ -17,13 +17,13 @@ import ( "fmt" ) -type TpuOperationWaiter struct { +type TPUOperationWaiter struct { Config *Config Project string CommonOperationWaiter } -func (w *TpuOperationWaiter) QueryOp() (interface{}, error) { +func (w *TPUOperationWaiter) QueryOp() (interface{}, error) { if w == nil { return nil, fmt.Errorf("Cannot query operation, it's unset or nil.") } @@ -37,7 +37,7 @@ func tpuOperationWaitTime(config *Config, op map[string]interface{}, project, ac // This was a synchronous call - there is no operation to wait for. return nil } - w := &TpuOperationWaiter{ + w := &TPUOperationWaiter{ Config: config, Project: project, } diff --git a/website/docs/r/tpu_node.html.markdown b/website/docs/r/tpu_node.html.markdown index 0c7b26be3f0..8e38b32a2bb 100644 --- a/website/docs/r/tpu_node.html.markdown +++ b/website/docs/r/tpu_node.html.markdown @@ -35,7 +35,7 @@ To get more information about Node, see: Open in Cloud Shell -## Example Usage - Tpu Node Basic +## Example Usage - TPU Node Basic ```hcl @@ -55,7 +55,7 @@ resource "google_tpu_node" "tpu" { Open in Cloud Shell -## Example Usage - Tpu Node Full +## Example Usage - TPU Node Full ```hcl