From c605b0bc4ba2291d86b1038ce4b45b5ea50c1bb9 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 14 Dec 2018 12:51:11 -0800 Subject: [PATCH] [Terraform]: Apply gofmt -s to all files managed by MM (#2676) /cc @rileykarson --- .../data_source_compute_lb_ip_ranges_test.go | 2 +- google/data_source_dns_managed_zone.go | 10 +- google/data_source_dns_managed_zone_test.go | 2 +- google/data_source_google_active_folder.go | 6 +- .../data_source_google_active_folder_test.go | 4 +- google/data_source_google_compute_address.go | 12 +- ...data_source_google_compute_address_test.go | 2 +- ...rce_google_compute_backend_service_test.go | 2 +- ...a_source_google_compute_forwarding_rule.go | 28 ++-- ...rce_google_compute_forwarding_rule_test.go | 2 +- ...ta_source_google_compute_global_address.go | 10 +- ...urce_google_compute_global_address_test.go | 2 +- ...ata_source_google_compute_instance_test.go | 2 +- google/data_source_google_compute_network.go | 10 +- ...data_source_google_compute_network_test.go | 2 +- google/data_source_google_compute_regions.go | 2 +- ...a_source_google_compute_ssl_policy_test.go | 2 +- .../data_source_google_compute_subnetwork.go | 24 +-- ...a_source_google_compute_subnetwork_test.go | 2 +- .../data_source_google_compute_vpn_gateway.go | 12 +- ..._source_google_compute_vpn_gateway_test.go | 2 +- google/data_source_google_compute_zones.go | 2 +- google/data_source_google_iam_role.go | 2 +- google/data_source_google_kms_secret.go | 6 +- google/data_source_google_kms_secret_test.go | 4 +- .../data_source_google_netblock_ip_ranges.go | 2 +- ...a_source_google_netblock_ip_ranges_test.go | 2 +- google/data_source_google_service_account.go | 12 +- .../data_source_storage_object_signed_url.go | 20 +-- ...a_source_storage_object_signed_url_test.go | 4 +- google/iam_pubsub_subscription.go | 4 +- google/iam_pubsub_topic.go | 4 +- google/iam_service_account.go | 2 +- google/iam_storage_bucket.go | 2 +- google/node_config.go | 6 +- google/provider.go | 8 +- google/resource_app_engine_application.go | 30 ++-- google/resource_bigquery_dataset.go | 16 +- google/resource_bigquery_table.go | 6 +- google/resource_cloudbuild_build_trigger.go | 36 ++--- .../resource_cloudbuild_build_trigger_test.go | 14 +- google/resource_cloudiot_registry.go | 30 ++-- google/resource_cloudiot_registry_test.go | 10 +- google/resource_compute_address_test.go | 16 +- google/resource_compute_attached_disk_test.go | 16 +- google/resource_compute_autoscaler_test.go | 12 +- .../resource_compute_backend_bucket_test.go | 10 +- google/resource_compute_backend_service.go | 70 ++++----- .../resource_compute_backend_service_test.go | 58 +++---- google/resource_compute_disk.go | 4 +- google/resource_compute_disk_test.go | 24 +-- google/resource_compute_firewall_migrate.go | 2 +- google/resource_compute_firewall_test.go | 34 ++-- .../resource_compute_forwarding_rule_test.go | 26 ++-- .../resource_compute_global_address_test.go | 8 +- ...resource_compute_global_forwarding_rule.go | 24 +-- ...rce_compute_global_forwarding_rule_test.go | 12 +- google/resource_compute_health_check_test.go | 32 ++-- ...resource_compute_http_health_check_test.go | 8 +- ...esource_compute_https_health_check_test.go | 8 +- google/resource_compute_image.go | 28 ++-- google/resource_compute_image_test.go | 14 +- google/resource_compute_instance.go | 146 +++++++++--------- ...rce_compute_instance_from_template_test.go | 2 +- ...resource_compute_instance_group_manager.go | 66 ++++---- .../resource_compute_instance_group_test.go | 2 +- google/resource_compute_instance_migrate.go | 2 +- google/resource_compute_instance_template.go | 106 ++++++------- ...resource_compute_instance_template_test.go | 70 ++++----- google/resource_compute_instance_test.go | 96 ++++++------ google/resource_compute_network.go | 16 +- google/resource_compute_network_peering.go | 12 +- .../resource_compute_network_peering_test.go | 2 +- google/resource_compute_network_test.go | 18 +-- google/resource_compute_project_metadata.go | 4 +- .../resource_compute_project_metadata_test.go | 20 +-- ...resource_compute_region_autoscaler_test.go | 8 +- ...resource_compute_region_backend_service.go | 28 ++-- ...rce_compute_region_backend_service_test.go | 18 +-- google/resource_compute_region_disk_test.go | 26 ++-- ...e_compute_region_instance_group_manager.go | 68 ++++---- ...pute_region_instance_group_manager_test.go | 2 +- google/resource_compute_route.go | 2 +- google/resource_compute_route_test.go | 12 +- google/resource_compute_router_interface.go | 12 +- .../resource_compute_router_interface_test.go | 6 +- google/resource_compute_router_nat.go | 32 ++-- google/resource_compute_router_nat_test.go | 10 +- google/resource_compute_router_peer.go | 18 +-- google/resource_compute_router_peer_test.go | 6 +- google/resource_compute_router_test.go | 24 +-- google/resource_compute_security_policy.go | 28 ++-- .../resource_compute_security_policy_test.go | 20 +-- ...esource_compute_shared_vpc_host_project.go | 2 +- ...urce_compute_shared_vpc_service_project.go | 4 +- google/resource_compute_shared_vpc_test.go | 8 +- .../resource_compute_ssl_certificate_test.go | 12 +- google/resource_compute_ssl_policy_test.go | 40 ++--- google/resource_compute_subnetwork_test.go | 18 +-- ...resource_compute_target_http_proxy_test.go | 8 +- ...esource_compute_target_https_proxy_test.go | 8 +- google/resource_compute_target_pool_test.go | 14 +- .../resource_compute_target_ssl_proxy_test.go | 8 +- .../resource_compute_target_tcp_proxy_test.go | 8 +- google/resource_compute_url_map_test.go | 16 +- google/resource_compute_vpn_gateway_test.go | 2 +- google/resource_compute_vpn_tunnel_test.go | 16 +- google/resource_container_cluster_test.go | 6 +- google/resource_container_node_pool.go | 24 +-- google/resource_container_node_pool_test.go | 60 +++---- google/resource_dataflow_job.go | 18 +-- google/resource_dataflow_job_test.go | 4 +- google/resource_dataproc_cluster.go | 2 +- google/resource_dns_managed_zone_test.go | 12 +- google/resource_dns_record_set.go | 20 +-- google/resource_dns_record_set_test.go | 24 +-- google/resource_endpoints_service.go | 40 ++--- google/resource_endpoints_service_test.go | 4 +- google/resource_google_folder.go | 10 +- .../resource_google_folder_iam_policy_test.go | 6 +- google/resource_google_folder_test.go | 10 +- google/resource_google_project.go | 52 +++---- google/resource_google_project_iam_policy.go | 12 +- ...resource_google_project_iam_policy_test.go | 10 +- google/resource_google_project_service.go | 4 +- .../resource_google_project_service_test.go | 16 +- google/resource_google_project_services.go | 8 +- .../resource_google_project_services_test.go | 20 +-- google/resource_google_project_test.go | 12 +- google/resource_google_service_account.go | 18 +-- google/resource_google_service_account_key.go | 16 +- ...esource_google_service_account_key_test.go | 6 +- .../resource_google_service_account_test.go | 16 +- google/resource_kms_crypto_key.go | 8 +- google/resource_kms_crypto_key_test.go | 20 +-- google/resource_kms_key_ring.go | 8 +- google/resource_kms_key_ring_test.go | 6 +- .../resource_monitoring_alert_policy_test.go | 16 +- google/resource_pubsub_subscription.go | 16 +- google/resource_pubsub_subscription_test.go | 6 +- google/resource_pubsub_topic.go | 4 +- google/resource_pubsub_topic_test.go | 6 +- google/resource_redis_instance_test.go | 16 +- google/resource_resourcemanager_lien_test.go | 4 +- google/resource_runtimeconfig_config_test.go | 2 +- .../resource_runtimeconfig_variable_test.go | 4 +- google/resource_source_repos_repository.go | 8 +- .../resource_source_repos_repository_test.go | 4 +- google/resource_spanner_database.go | 6 +- google/resource_spanner_database_iam_test.go | 8 +- google/resource_spanner_instance.go | 8 +- google/resource_spanner_instance_iam_test.go | 8 +- google/resource_sql_database.go | 12 +- google/resource_sql_database_instance.go | 132 ++++++++-------- google/resource_sql_database_instance_test.go | 92 +++++------ google/resource_sql_database_test.go | 16 +- google/resource_sql_ssl_cert.go | 18 +-- google/resource_sql_ssl_cert_test.go | 4 +- google/resource_sql_user.go | 10 +- google/resource_sql_user_test.go | 12 +- google/resource_storage_bucket.go | 48 +++--- google/resource_storage_bucket_acl.go | 10 +- google/resource_storage_bucket_acl_test.go | 18 +-- google/resource_storage_bucket_object.go | 28 ++-- google/resource_storage_bucket_object_test.go | 16 +- google/resource_storage_bucket_test.go | 68 ++++---- ...esource_storage_default_object_acl_test.go | 18 +-- google/resource_storage_notification.go | 14 +- google/resource_storage_notification_test.go | 10 +- google/resource_storage_object_acl_test.go | 26 ++-- google/resource_usage_export_bucket.go | 6 +- google/resource_usage_export_bucket_test.go | 4 +- 172 files changed, 1482 insertions(+), 1482 deletions(-) diff --git a/google/data_source_compute_lb_ip_ranges_test.go b/google/data_source_compute_lb_ip_ranges_test.go index d70580bc..063fda2e 100644 --- a/google/data_source_compute_lb_ip_ranges_test.go +++ b/google/data_source_compute_lb_ip_ranges_test.go @@ -12,7 +12,7 @@ func TestAccDataSourceComputeLbIpRanges_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeLbIpRangesConfig, Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr("data.google_compute_lb_ip_ranges.some", diff --git a/google/data_source_dns_managed_zone.go b/google/data_source_dns_managed_zone.go index 05f96458..f67f3bd3 100644 --- a/google/data_source_dns_managed_zone.go +++ b/google/data_source_dns_managed_zone.go @@ -7,22 +7,22 @@ func dataSourceDnsManagedZone() *schema.Resource { Read: dataSourceDnsManagedZoneRead, Schema: map[string]*schema.Schema{ - "dns_name": &schema.Schema{ + "dns_name": { Type: schema.TypeString, Computed: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Computed: true, }, - "name_servers": &schema.Schema{ + "name_servers": { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{ @@ -32,7 +32,7 @@ func dataSourceDnsManagedZone() *schema.Resource { // Google Cloud DNS ManagedZone resources do not have a SelfLink attribute. - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, }, diff --git a/google/data_source_dns_managed_zone_test.go b/google/data_source_dns_managed_zone_test.go index a794c56c..fe5c5da1 100644 --- a/google/data_source_dns_managed_zone_test.go +++ b/google/data_source_dns_managed_zone_test.go @@ -17,7 +17,7 @@ func TestAccDataSourceDnsManagedZone_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsManagedZoneDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceDnsManagedZone_basic(), Check: testAccDataSourceDnsManagedZoneCheck("data.google_dns_managed_zone.qa", "google_dns_managed_zone.foo"), }, diff --git a/google/data_source_google_active_folder.go b/google/data_source_google_active_folder.go index 3d64ea2c..76c91dcf 100644 --- a/google/data_source_google_active_folder.go +++ b/google/data_source_google_active_folder.go @@ -13,15 +13,15 @@ func dataSourceGoogleActiveFolder() *schema.Resource { Read: dataSourceGoogleActiveFolderRead, Schema: map[string]*schema.Schema{ - "parent": &schema.Schema{ + "parent": { Type: schema.TypeString, Required: true, }, - "display_name": &schema.Schema{ + "display_name": { Type: schema.TypeString, Required: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, diff --git a/google/data_source_google_active_folder_test.go b/google/data_source_google_active_folder_test.go index d083c77e..3c069e3c 100644 --- a/google/data_source_google_active_folder_test.go +++ b/google/data_source_google_active_folder_test.go @@ -19,7 +19,7 @@ func TestAccDataSourceGoogleActiveFolder_default(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceGoogleActiveFolderConfig(parent, displayName), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleActiveFolderCheck("data.google_active_folder.my_folder", "google_folder.foobar"), @@ -39,7 +39,7 @@ func TestAccDataSourceGoogleActiveFolder_space(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceGoogleActiveFolderConfig(parent, displayName), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleActiveFolderCheck("data.google_active_folder.my_folder", "google_folder.foobar"), diff --git a/google/data_source_google_compute_address.go b/google/data_source_google_compute_address.go index 137c4157..01cdd0a4 100644 --- a/google/data_source_google_compute_address.go +++ b/google/data_source_google_compute_address.go @@ -19,33 +19,33 @@ func dataSourceGoogleComputeAddress() *schema.Resource { Read: dataSourceGoogleComputeAddressRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Computed: true, }, - "status": &schema.Schema{ + "status": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Computed: true, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Computed: true, Optional: true, diff --git a/google/data_source_google_compute_address_test.go b/google/data_source_google_compute_address_test.go index 9f1e9798..4f784035 100644 --- a/google/data_source_google_compute_address_test.go +++ b/google/data_source_google_compute_address_test.go @@ -81,7 +81,7 @@ func TestAccDataSourceComputeAddress(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDataSourceComputeAddressDestroy(rsFullName), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceComputeAddressConfig(rsName, dsName), Check: resource.ComposeTestCheckFunc( testAccDataSourceComputeAddressCheck(dsFullName, rsFullName), diff --git a/google/data_source_google_compute_backend_service_test.go b/google/data_source_google_compute_backend_service_test.go index c6b4212e..56dd2ded 100644 --- a/google/data_source_google_compute_backend_service_test.go +++ b/google/data_source_google_compute_backend_service_test.go @@ -20,7 +20,7 @@ func TestAccDataSourceComputeBackendService_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceComputeBackendService_basic(serviceName, checkName), Check: testAccDataSourceComputeBackendServiceCheck("data.google_compute_backend_service.baz", "google_compute_backend_service.foobar"), }, diff --git a/google/data_source_google_compute_forwarding_rule.go b/google/data_source_google_compute_forwarding_rule.go index 9fb8f305..c6ae4f9c 100644 --- a/google/data_source_google_compute_forwarding_rule.go +++ b/google/data_source_google_compute_forwarding_rule.go @@ -11,75 +11,75 @@ func dataSourceGoogleComputeForwardingRule() *schema.Resource { Read: dataSourceGoogleComputeForwardingRuleRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, }, - "target": &schema.Schema{ + "target": { Type: schema.TypeString, Computed: true, }, - "backend_service": &schema.Schema{ + "backend_service": { Type: schema.TypeString, Computed: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Computed: true, }, - "ip_address": &schema.Schema{ + "ip_address": { Type: schema.TypeString, Computed: true, }, - "ip_protocol": &schema.Schema{ + "ip_protocol": { Type: schema.TypeString, Computed: true, }, - "load_balancing_scheme": &schema.Schema{ + "load_balancing_scheme": { Type: schema.TypeString, Computed: true, }, - "network": &schema.Schema{ + "network": { Type: schema.TypeString, Computed: true, }, - "port_range": &schema.Schema{ + "port_range": { Type: schema.TypeString, Computed: true, }, - "ports": &schema.Schema{ + "ports": { Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "subnetwork": &schema.Schema{ + "subnetwork": { Type: schema.TypeString, Computed: true, }, diff --git a/google/data_source_google_compute_forwarding_rule_test.go b/google/data_source_google_compute_forwarding_rule_test.go index abb321a6..900edcc2 100644 --- a/google/data_source_google_compute_forwarding_rule_test.go +++ b/google/data_source_google_compute_forwarding_rule_test.go @@ -19,7 +19,7 @@ func TestAccDataSourceGoogleForwardingRule(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceGoogleForwardingRuleConfig(poolName, ruleName), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleForwardingRuleCheck("data.google_compute_forwarding_rule.my_forwarding_rule", "google_compute_forwarding_rule.foobar-fr"), diff --git a/google/data_source_google_compute_global_address.go b/google/data_source_google_compute_global_address.go index d0ac1728..17fa29ea 100644 --- a/google/data_source_google_compute_global_address.go +++ b/google/data_source_google_compute_global_address.go @@ -12,27 +12,27 @@ func dataSourceGoogleComputeGlobalAddress() *schema.Resource { Read: dataSourceGoogleComputeGlobalAddressRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Computed: true, }, - "status": &schema.Schema{ + "status": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Computed: true, Optional: true, diff --git a/google/data_source_google_compute_global_address_test.go b/google/data_source_google_compute_global_address_test.go index 9cf0ef52..91451f6e 100644 --- a/google/data_source_google_compute_global_address_test.go +++ b/google/data_source_google_compute_global_address_test.go @@ -21,7 +21,7 @@ func TestAccDataSourceComputeGlobalAddress(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeGlobalAddressDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceComputeGlobalAddressConfig(rsName, dsName), Check: resource.ComposeTestCheckFunc( testAccDataSourceComputeGlobalAddressCheck(dsFullName, rsFullName), diff --git a/google/data_source_google_compute_instance_test.go b/google/data_source_google_compute_instance_test.go index af8fb2ee..dbd86ac3 100644 --- a/google/data_source_google_compute_instance_test.go +++ b/google/data_source_google_compute_instance_test.go @@ -19,7 +19,7 @@ func TestAccDataSourceComputeInstance_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceComputeInstanceConfig(instanceName), Check: resource.ComposeTestCheckFunc( testAccDataSourceComputeInstanceCheck("data.google_compute_instance.bar", "google_compute_instance.foo"), diff --git a/google/data_source_google_compute_network.go b/google/data_source_google_compute_network.go index 17f5b915..bbbcf908 100644 --- a/google/data_source_google_compute_network.go +++ b/google/data_source_google_compute_network.go @@ -11,27 +11,27 @@ func dataSourceGoogleComputeNetwork() *schema.Resource { Read: dataSourceGoogleComputeNetworkRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Computed: true, }, - "gateway_ipv4": &schema.Schema{ + "gateway_ipv4": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, }, diff --git a/google/data_source_google_compute_network_test.go b/google/data_source_google_compute_network_test.go index cd80228f..6d21f934 100644 --- a/google/data_source_google_compute_network_test.go +++ b/google/data_source_google_compute_network_test.go @@ -17,7 +17,7 @@ func TestAccDataSourceGoogleNetwork(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceGoogleNetworkConfig(networkName), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleNetworkCheck("data.google_compute_network.my_network", "google_compute_network.foobar"), diff --git a/google/data_source_google_compute_regions.go b/google/data_source_google_compute_regions.go index 683bbc4c..655a8bdd 100644 --- a/google/data_source_google_compute_regions.go +++ b/google/data_source_google_compute_regions.go @@ -15,7 +15,7 @@ func dataSourceGoogleComputeRegions() *schema.Resource { return &schema.Resource{ Read: dataSourceGoogleComputeRegionsRead, Schema: map[string]*schema.Schema{ - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/data_source_google_compute_ssl_policy_test.go b/google/data_source_google_compute_ssl_policy_test.go index 8b7462db..47a51495 100644 --- a/google/data_source_google_compute_ssl_policy_test.go +++ b/google/data_source_google_compute_ssl_policy_test.go @@ -16,7 +16,7 @@ func TestAccDataSourceGoogleSslPolicy(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceGoogleSslPolicy(), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleSslPolicyCheck("data.google_compute_ssl_policy.ssl_policy", "google_compute_ssl_policy.foobar"), diff --git a/google/data_source_google_compute_subnetwork.go b/google/data_source_google_compute_subnetwork.go index b490a27d..5956b259 100644 --- a/google/data_source_google_compute_subnetwork.go +++ b/google/data_source_google_compute_subnetwork.go @@ -13,58 +13,58 @@ func dataSourceGoogleComputeSubnetwork() *schema.Resource { Read: dataSourceGoogleComputeSubnetworkRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "ip_cidr_range": &schema.Schema{ + "ip_cidr_range": { Type: schema.TypeString, Computed: true, }, - "private_ip_google_access": &schema.Schema{ + "private_ip_google_access": { Type: schema.TypeBool, Computed: true, }, - "secondary_ip_range": &schema.Schema{ + "secondary_ip_range": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "range_name": &schema.Schema{ + "range_name": { Type: schema.TypeString, Computed: true, }, - "ip_cidr_range": &schema.Schema{ + "ip_cidr_range": { Type: schema.TypeString, Computed: true, }, }, }, }, - "network": &schema.Schema{ + "network": { Type: schema.TypeString, Computed: true, }, - "gateway_address": &schema.Schema{ + "gateway_address": { Type: schema.TypeString, Computed: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Computed: true, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Computed: true, Optional: true, diff --git a/google/data_source_google_compute_subnetwork_test.go b/google/data_source_google_compute_subnetwork_test.go index 7c44f89c..19b8c885 100644 --- a/google/data_source_google_compute_subnetwork_test.go +++ b/google/data_source_google_compute_subnetwork_test.go @@ -16,7 +16,7 @@ func TestAccDataSourceGoogleSubnetwork(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceGoogleSubnetwork(), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleSubnetworkCheck("data.google_compute_subnetwork.my_subnetwork", "google_compute_subnetwork.foobar"), diff --git a/google/data_source_google_compute_vpn_gateway.go b/google/data_source_google_compute_vpn_gateway.go index e7ddf921..ba0a5ab3 100644 --- a/google/data_source_google_compute_vpn_gateway.go +++ b/google/data_source_google_compute_vpn_gateway.go @@ -12,34 +12,34 @@ func dataSourceGoogleComputeVpnGateway() *schema.Resource { Read: dataSourceGoogleComputeVpnGatewayRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "network": &schema.Schema{ + "network": { Type: schema.TypeString, Computed: true, }, diff --git a/google/data_source_google_compute_vpn_gateway_test.go b/google/data_source_google_compute_vpn_gateway_test.go index cec78918..26a363e1 100644 --- a/google/data_source_google_compute_vpn_gateway_test.go +++ b/google/data_source_google_compute_vpn_gateway_test.go @@ -17,7 +17,7 @@ func TestAccDataSourceGoogleVpnGateway(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataSourceGoogleVpnGatewayConfig(vpnGatewayName), Check: resource.ComposeTestCheckFunc( testAccDataSourceGoogleVpnGatewayCheck("data.google_compute_vpn_gateway.my_vpn_gateway", "google_compute_vpn_gateway.foobar"), diff --git a/google/data_source_google_compute_zones.go b/google/data_source_google_compute_zones.go index a6a48273..bfc76012 100644 --- a/google/data_source_google_compute_zones.go +++ b/google/data_source_google_compute_zones.go @@ -19,7 +19,7 @@ func dataSourceGoogleComputeZones() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/data_source_google_iam_role.go b/google/data_source_google_iam_role.go index e96ae5fd..92cf4701 100644 --- a/google/data_source_google_iam_role.go +++ b/google/data_source_google_iam_role.go @@ -10,7 +10,7 @@ func dataSourceGoogleIamRole() *schema.Resource { return &schema.Resource{ Read: dataSourceGoogleIamRoleRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, diff --git a/google/data_source_google_kms_secret.go b/google/data_source_google_kms_secret.go index 2dbdfcde..06ead694 100644 --- a/google/data_source_google_kms_secret.go +++ b/google/data_source_google_kms_secret.go @@ -14,15 +14,15 @@ func dataSourceGoogleKmsSecret() *schema.Resource { return &schema.Resource{ Read: dataSourceGoogleKmsSecretRead, Schema: map[string]*schema.Schema{ - "crypto_key": &schema.Schema{ + "crypto_key": { Type: schema.TypeString, Required: true, }, - "ciphertext": &schema.Schema{ + "ciphertext": { Type: schema.TypeString, Required: true, }, - "plaintext": &schema.Schema{ + "plaintext": { Type: schema.TypeString, Computed: true, Sensitive: true, diff --git a/google/data_source_google_kms_secret_test.go b/google/data_source_google_kms_secret_test.go index e0d58f63..29df5d41 100644 --- a/google/data_source_google_kms_secret_test.go +++ b/google/data_source_google_kms_secret_test.go @@ -29,7 +29,7 @@ func TestAccKmsSecret_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleKmsCryptoKey_basic(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), Check: func(s *terraform.State) error { ciphertext, cryptoKeyId, err := testAccEncryptSecretDataWithCryptoKey(s, "google_kms_crypto_key.crypto_key", plaintext) @@ -43,7 +43,7 @@ func TestAccKmsSecret_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleKmsSecret_datasource(cryptoKeyId.terraformId(), ciphertext), Check: resource.TestCheckResourceAttr("data.google_kms_secret.acceptance", "plaintext", plaintext), }, diff --git a/google/data_source_google_netblock_ip_ranges.go b/google/data_source_google_netblock_ip_ranges.go index 15a286e1..0b746874 100644 --- a/google/data_source_google_netblock_ip_ranges.go +++ b/google/data_source_google_netblock_ip_ranges.go @@ -93,7 +93,7 @@ func getCidrBlocks() (map[string][]string, error) { dnsNetblock := dnsNetblockList[0] dnsNetblockList[0] = "" - dnsNetblockList = dnsNetblockList[1:len(dnsNetblockList)] + dnsNetblockList = dnsNetblockList[1:] response, err = netblock_request(dnsNetblock) diff --git a/google/data_source_google_netblock_ip_ranges_test.go b/google/data_source_google_netblock_ip_ranges_test.go index b18f2c39..eb048cca 100644 --- a/google/data_source_google_netblock_ip_ranges_test.go +++ b/google/data_source_google_netblock_ip_ranges_test.go @@ -12,7 +12,7 @@ func TestAccDataSourceGoogleNetblockIpRanges_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccNetblockIpRangesConfig, Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr("data.google_netblock_ip_ranges.some", diff --git a/google/data_source_google_service_account.go b/google/data_source_google_service_account.go index e2a1f3cd..bb453d7a 100644 --- a/google/data_source_google_service_account.go +++ b/google/data_source_google_service_account.go @@ -11,28 +11,28 @@ func dataSourceGoogleServiceAccount() *schema.Resource { return &schema.Resource{ Read: dataSourceGoogleServiceAccountRead, Schema: map[string]*schema.Schema{ - "account_id": &schema.Schema{ + "account_id": { Type: schema.TypeString, Required: true, ValidateFunc: validateRFC1035Name(6, 30), }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, }, - "email": &schema.Schema{ + "email": { Type: schema.TypeString, Computed: true, }, - "unique_id": &schema.Schema{ + "unique_id": { Type: schema.TypeString, Computed: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "display_name": &schema.Schema{ + "display_name": { Type: schema.TypeString, Computed: true, }, diff --git a/google/data_source_storage_object_signed_url.go b/google/data_source_storage_object_signed_url.go index 0b2b78d9..c74c2555 100644 --- a/google/data_source_storage_object_signed_url.go +++ b/google/data_source_storage_object_signed_url.go @@ -36,46 +36,46 @@ func dataSourceGoogleSignedUrl() *schema.Resource { Read: dataSourceGoogleSignedUrlRead, Schema: map[string]*schema.Schema{ - "bucket": &schema.Schema{ + "bucket": { Type: schema.TypeString, Required: true, }, - "content_md5": &schema.Schema{ + "content_md5": { Type: schema.TypeString, Optional: true, Default: "", }, - "content_type": &schema.Schema{ + "content_type": { Type: schema.TypeString, Optional: true, Default: "", }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Optional: true, }, - "duration": &schema.Schema{ + "duration": { Type: schema.TypeString, Optional: true, Default: "1h", }, - "extension_headers": &schema.Schema{ + "extension_headers": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, ValidateFunc: validateExtensionHeaders, }, - "http_method": &schema.Schema{ + "http_method": { Type: schema.TypeString, Optional: true, Default: "GET", ValidateFunc: validation.StringInSlice([]string{"GET", "HEAD", "PUT", "DELETE"}, true), }, - "path": &schema.Schema{ + "path": { Type: schema.TypeString, Required: true, }, - "signed_url": &schema.Schema{ + "signed_url": { Type: schema.TypeString, Computed: true, }, @@ -85,7 +85,7 @@ func dataSourceGoogleSignedUrl() *schema.Resource { func validateExtensionHeaders(v interface{}, k string) (ws []string, errors []error) { hdrMap := v.(map[string]interface{}) - for k, _ := range hdrMap { + for k := range hdrMap { if !strings.HasPrefix(strings.ToLower(k), "x-goog-") { errors = append(errors, fmt.Errorf( "extension_header (%s) not valid, header name must begin with 'x-goog-'", k)) diff --git a/google/data_source_storage_object_signed_url_test.go b/google/data_source_storage_object_signed_url_test.go index 1cb54fb4..46a888ea 100644 --- a/google/data_source_storage_object_signed_url_test.go +++ b/google/data_source_storage_object_signed_url_test.go @@ -106,7 +106,7 @@ func TestAccStorageSignedUrl_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleSignedUrlConfig, Check: resource.ComposeTestCheckFunc( testAccSignedUrlExists("data.google_storage_object_signed_url.blerg"), @@ -130,7 +130,7 @@ func TestAccStorageSignedUrl_accTest(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccTestGoogleStorageObjectSignedURL(bucketName), Check: resource.ComposeTestCheckFunc( testAccSignedUrlRetrieval("data.google_storage_object_signed_url.story_url", nil), diff --git a/google/iam_pubsub_subscription.go b/google/iam_pubsub_subscription.go index ff6d616e..04dc1459 100644 --- a/google/iam_pubsub_subscription.go +++ b/google/iam_pubsub_subscription.go @@ -9,13 +9,13 @@ import ( ) var IamPubsubSubscriptionSchema = map[string]*schema.Schema{ - "subscription": &schema.Schema{ + "subscription": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/iam_pubsub_topic.go b/google/iam_pubsub_topic.go index ed3f3f00..5e432d70 100644 --- a/google/iam_pubsub_topic.go +++ b/google/iam_pubsub_topic.go @@ -10,13 +10,13 @@ import ( ) var IamPubsubTopicSchema = map[string]*schema.Schema{ - "topic": &schema.Schema{ + "topic": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/iam_service_account.go b/google/iam_service_account.go index 267893af..7af784a3 100644 --- a/google/iam_service_account.go +++ b/google/iam_service_account.go @@ -9,7 +9,7 @@ import ( ) var IamServiceAccountSchema = map[string]*schema.Schema{ - "service_account_id": &schema.Schema{ + "service_account_id": { Type: schema.TypeString, Required: true, ForceNew: true, diff --git a/google/iam_storage_bucket.go b/google/iam_storage_bucket.go index be438e75..71a21f7e 100644 --- a/google/iam_storage_bucket.go +++ b/google/iam_storage_bucket.go @@ -9,7 +9,7 @@ import ( ) var IamStorageBucketSchema = map[string]*schema.Schema{ - "bucket": &schema.Schema{ + "bucket": { Type: schema.TypeString, Required: true, ForceNew: true, diff --git a/google/node_config.go b/google/node_config.go index 02416abe..89befe9b 100644 --- a/google/node_config.go +++ b/google/node_config.go @@ -43,19 +43,19 @@ var schemaNodeConfig = &schema.Schema{ ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd"}, false), }, - "guest_accelerator": &schema.Schema{ + "guest_accelerator": { Type: schema.TypeList, Optional: true, Computed: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "count": &schema.Schema{ + "count": { Type: schema.TypeInt, Required: true, ForceNew: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, ForceNew: true, diff --git a/google/provider.go b/google/provider.go index 1ab735e8..adba6f4b 100644 --- a/google/provider.go +++ b/google/provider.go @@ -17,7 +17,7 @@ var mutexKV = mutexkv.NewMutexKV() func Provider() terraform.ResourceProvider { return &schema.Provider{ Schema: map[string]*schema.Schema{ - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ @@ -28,7 +28,7 @@ func Provider() terraform.ResourceProvider { ValidateFunc: validateCredentials, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ @@ -39,7 +39,7 @@ func Provider() terraform.ResourceProvider { }, nil), }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ @@ -49,7 +49,7 @@ func Provider() terraform.ResourceProvider { }, nil), }, - "zone": &schema.Schema{ + "zone": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.MultiEnvDefaultFunc([]string{ diff --git a/google/resource_app_engine_application.go b/google/resource_app_engine_application.go index 68cc3810..5bb58b7c 100644 --- a/google/resource_app_engine_application.go +++ b/google/resource_app_engine_application.go @@ -26,19 +26,19 @@ func resourceAppEngineApplication() *schema.Resource { ), Schema: map[string]*schema.Schema{ - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, ValidateFunc: validateProjectID(), }, - "auth_domain": &schema.Schema{ + "auth_domain": { Type: schema.TypeString, Optional: true, Computed: true, }, - "location_id": &schema.Schema{ + "location_id": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ @@ -56,7 +56,7 @@ func resourceAppEngineApplication() *schema.Resource { "australia-southeast1", }, false), }, - "serving_status": &schema.Schema{ + "serving_status": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ @@ -67,35 +67,35 @@ func resourceAppEngineApplication() *schema.Resource { }, false), Computed: true, }, - "feature_settings": &schema.Schema{ + "feature_settings": { Type: schema.TypeList, Optional: true, Computed: true, MaxItems: 1, Elem: appEngineApplicationFeatureSettingsResource(), }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "url_dispatch_rule": &schema.Schema{ + "url_dispatch_rule": { Type: schema.TypeList, Computed: true, Elem: appEngineApplicationURLDispatchRuleResource(), }, - "code_bucket": &schema.Schema{ + "code_bucket": { Type: schema.TypeString, Computed: true, }, - "default_hostname": &schema.Schema{ + "default_hostname": { Type: schema.TypeString, Computed: true, }, - "default_bucket": &schema.Schema{ + "default_bucket": { Type: schema.TypeString, Computed: true, }, - "gcr_domain": &schema.Schema{ + "gcr_domain": { Type: schema.TypeString, Computed: true, }, @@ -106,15 +106,15 @@ func resourceAppEngineApplication() *schema.Resource { func appEngineApplicationURLDispatchRuleResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "domain": &schema.Schema{ + "domain": { Type: schema.TypeString, Computed: true, }, - "path": &schema.Schema{ + "path": { Type: schema.TypeString, Computed: true, }, - "service": &schema.Schema{ + "service": { Type: schema.TypeString, Computed: true, }, @@ -125,7 +125,7 @@ func appEngineApplicationURLDispatchRuleResource() *schema.Resource { func appEngineApplicationFeatureSettingsResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "split_health_checks": &schema.Schema{ + "split_health_checks": { Type: schema.TypeBool, Optional: true, }, diff --git a/google/resource_bigquery_dataset.go b/google/resource_bigquery_dataset.go index 16a0d2eb..e17f0dee 100644 --- a/google/resource_bigquery_dataset.go +++ b/google/resource_bigquery_dataset.go @@ -121,7 +121,7 @@ func resourceBigQueryDataset() *schema.Resource { // Labels: [Experimental] The labels associated with this dataset. You // can use these to organize and group your datasets. You can set this // property when inserting or updating a dataset. - "labels": &schema.Schema{ + "labels": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -131,35 +131,35 @@ func resourceBigQueryDataset() *schema.Resource { // for one or more entities. You can set this property when inserting // or updating a dataset in order to control who is allowed to access // the data. - "access": &schema.Schema{ + "access": { Type: schema.TypeSet, Optional: true, // Computed because if unset, BQ adds 4 entries automatically Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "role": &schema.Schema{ + "role": { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{"OWNER", "WRITER", "READER"}, false), }, - "domain": &schema.Schema{ + "domain": { Type: schema.TypeString, Optional: true, }, - "group_by_email": &schema.Schema{ + "group_by_email": { Type: schema.TypeString, Optional: true, }, - "special_group": &schema.Schema{ + "special_group": { Type: schema.TypeString, Optional: true, }, - "user_by_email": &schema.Schema{ + "user_by_email": { Type: schema.TypeString, Optional: true, }, - "view": &schema.Schema{ + "view": { Type: schema.TypeList, Optional: true, MaxItems: 1, diff --git a/google/resource_bigquery_table.go b/google/resource_bigquery_table.go index 19dfc7c9..0ea8e95e 100644 --- a/google/resource_bigquery_table.go +++ b/google/resource_bigquery_table.go @@ -75,7 +75,7 @@ func resourceBigQueryTable() *schema.Resource { // characters are allowed. Label values are optional. Label keys must // start with a letter and each label in the list must have a different // key. - "labels": &schema.Schema{ + "labels": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -94,7 +94,7 @@ func resourceBigQueryTable() *schema.Resource { }, // View: [Optional] If specified, configures this table as a view. - "view": &schema.Schema{ + "view": { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -121,7 +121,7 @@ func resourceBigQueryTable() *schema.Resource { // TimePartitioning: [Experimental] If specified, configures time-based // partitioning for this table. - "time_partitioning": &schema.Schema{ + "time_partitioning": { Type: schema.TypeList, Optional: true, MaxItems: 1, diff --git a/google/resource_cloudbuild_build_trigger.go b/google/resource_cloudbuild_build_trigger.go index a680b630..2d4fcbc0 100644 --- a/google/resource_cloudbuild_build_trigger.go +++ b/google/resource_cloudbuild_build_trigger.go @@ -31,13 +31,13 @@ func resourceCloudBuildTrigger() *schema.Resource { SchemaVersion: 1, Schema: map[string]*schema.Schema{ - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "filename": &schema.Schema{ + "filename": { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"build"}, @@ -49,28 +49,28 @@ func resourceCloudBuildTrigger() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "images": &schema.Schema{ + "images": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "step": &schema.Schema{ + "step": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, }, - "args": &schema.Schema{ + "args": { Type: schema.TypeString, Optional: true, }, }, }, }, - "tags": &schema.Schema{ + "tags": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -78,56 +78,56 @@ func resourceCloudBuildTrigger() *schema.Resource { }, }, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "substitutions": &schema.Schema{ + "substitutions": { Optional: true, Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}, }, - "included_files": &schema.Schema{ + "included_files": { Optional: true, Type: schema.TypeList, MaxItems: 50, ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "ignored_files": &schema.Schema{ + "ignored_files": { Optional: true, Type: schema.TypeList, MaxItems: 50, ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "trigger_template": &schema.Schema{ + "trigger_template": { Optional: true, Type: schema.TypeList, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "branch_name": &schema.Schema{ + "branch_name": { Type: schema.TypeString, Optional: true, }, - "commit_sha": &schema.Schema{ + "commit_sha": { Type: schema.TypeString, Optional: true, }, - "dir": &schema.Schema{ + "dir": { Type: schema.TypeString, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, }, - "repo_name": &schema.Schema{ + "repo_name": { Type: schema.TypeString, Optional: true, }, - "tag_name": &schema.Schema{ + "tag_name": { Type: schema.TypeString, Optional: true, }, diff --git a/google/resource_cloudbuild_build_trigger_test.go b/google/resource_cloudbuild_build_trigger_test.go index 2489a8d4..1167ba7c 100644 --- a/google/resource_cloudbuild_build_trigger_test.go +++ b/google/resource_cloudbuild_build_trigger_test.go @@ -22,28 +22,28 @@ func TestAccCloudBuildTrigger_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckGoogleCloudBuildTriggerVersionsDestroyed, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleCloudBuildTrigger_basic(projectID, projectOrg, projectBillingAccount), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleCloudBuildTriggerExists("google_cloudbuild_trigger.build_trigger"), ), }, - resource.TestStep{ + { ResourceName: "google_cloudbuild_trigger.build_trigger", ImportState: true, ImportStateVerify: true, ImportStateIdPrefix: fmt.Sprintf("%s/", projectID), }, - resource.TestStep{ + { Config: testGoogleCloudBuildTrigger_updated(projectID, projectOrg, projectBillingAccount), }, - resource.TestStep{ + { ResourceName: "google_cloudbuild_trigger.build_trigger", ImportState: true, ImportStateVerify: true, ImportStateIdPrefix: fmt.Sprintf("%s/", projectID), }, - resource.TestStep{ + { Config: testGoogleCloudBuildTrigger_removed(projectID, projectOrg, projectBillingAccount), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleCloudBuildTriggerWasRemovedFromState("google_cloudbuild_trigger.build_trigger"), @@ -65,13 +65,13 @@ func TestAccCloudBuildTrigger_filename(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckGoogleCloudBuildTriggerVersionsDestroyed, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleCloudBuildTrigger_filename(projectID, projectOrg, projectBillingAccount), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleCloudFilenameConfig("google_cloudbuild_trigger.filename_build_trigger"), ), }, - resource.TestStep{ + { Config: testGoogleCloudBuildTrigger_removed(projectID, projectOrg, projectBillingAccount), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleCloudBuildTriggerWasRemovedFromState("google_cloudbuild_trigger.filename_build_trigger"), diff --git a/google/resource_cloudiot_registry.go b/google/resource_cloudiot_registry.go index ae850fcb..0af43cb0 100644 --- a/google/resource_cloudiot_registry.go +++ b/google/resource_cloudiot_registry.go @@ -30,30 +30,30 @@ func resourceCloudIoTRegistry() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateCloudIoTID, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "event_notification_config": &schema.Schema{ + "event_notification_config": { Type: schema.TypeMap, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "pubsub_topic_name": &schema.Schema{ + "pubsub_topic_name": { Type: schema.TypeString, Required: true, DiffSuppressFunc: compareSelfLinkOrResourceName, @@ -61,12 +61,12 @@ func resourceCloudIoTRegistry() *schema.Resource { }, }, }, - "state_notification_config": &schema.Schema{ + "state_notification_config": { Type: schema.TypeMap, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "pubsub_topic_name": &schema.Schema{ + "pubsub_topic_name": { Type: schema.TypeString, Required: true, DiffSuppressFunc: compareSelfLinkOrResourceName, @@ -74,13 +74,13 @@ func resourceCloudIoTRegistry() *schema.Resource { }, }, }, - "mqtt_config": &schema.Schema{ + "mqtt_config": { Type: schema.TypeMap, Computed: true, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "mqtt_enabled_state": &schema.Schema{ + "mqtt_enabled_state": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice( @@ -89,13 +89,13 @@ func resourceCloudIoTRegistry() *schema.Resource { }, }, }, - "http_config": &schema.Schema{ + "http_config": { Type: schema.TypeMap, Computed: true, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "http_enabled_state": &schema.Schema{ + "http_enabled_state": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice( @@ -104,24 +104,24 @@ func resourceCloudIoTRegistry() *schema.Resource { }, }, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeList, Optional: true, MaxItems: 10, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "public_key_certificate": &schema.Schema{ + "public_key_certificate": { Type: schema.TypeMap, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "format": &schema.Schema{ + "format": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice( []string{x509CertificatePEM}, false), }, - "certificate": &schema.Schema{ + "certificate": { Type: schema.TypeString, Required: true, }, diff --git a/google/resource_cloudiot_registry_test.go b/google/resource_cloudiot_registry_test.go index 03d81c56..680fd484 100644 --- a/google/resource_cloudiot_registry_test.go +++ b/google/resource_cloudiot_registry_test.go @@ -19,7 +19,7 @@ func TestAccCloudIoTRegistry_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckCloudIoTRegistryDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccCloudIoTRegistry_basic(registryName), Check: resource.ComposeTestCheckFunc( testAccCloudIoTRegistryExists( @@ -45,7 +45,7 @@ func TestAccCloudIoTRegistry_extended(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckCloudIoTRegistryDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccCloudIoTRegistry_extended(registryName), Check: resource.ComposeTestCheckFunc( testAccCloudIoTRegistryExists( @@ -71,17 +71,17 @@ func TestAccCloudIoTRegistry_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckCloudIoTRegistryDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccCloudIoTRegistry_basic(registryName), Check: resource.ComposeTestCheckFunc( testAccCloudIoTRegistryExists( "google_cloudiot_registry.foobar"), ), }, - resource.TestStep{ + { Config: testAccCloudIoTRegistry_extended(registryName), }, - resource.TestStep{ + { Config: testAccCloudIoTRegistry_basic(registryName), }, { diff --git a/google/resource_compute_address_test.go b/google/resource_compute_address_test.go index 30794d28..6e14c493 100644 --- a/google/resource_compute_address_test.go +++ b/google/resource_compute_address_test.go @@ -16,10 +16,10 @@ func TestAccComputeAddress_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeAddressDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeAddress_basic(acctest.RandString(10)), }, - resource.TestStep{ + { ResourceName: "google_compute_address.foobar", ImportState: true, ImportStateVerify: true, @@ -36,10 +36,10 @@ func TestAccComputeAddress_networkTier(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeAddressDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeAddress_networkTier(acctest.RandString(10)), }, - resource.TestStep{ + { ResourceName: "google_compute_address.foobar", ImportState: true, ImportStateVerify: true, @@ -54,22 +54,22 @@ func TestAccComputeAddress_internal(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeAddressDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeAddress_internal(acctest.RandString(10)), }, - resource.TestStep{ + { ResourceName: "google_compute_address.internal", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_compute_address.internal_with_subnet", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_compute_address.internal_with_subnet_and_address", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_attached_disk_test.go b/google/resource_compute_attached_disk_test.go index 089b9d84..ad4b3c97 100644 --- a/google/resource_compute_attached_disk_test.go +++ b/google/resource_compute_attached_disk_test.go @@ -22,16 +22,16 @@ func TestAccComputeAttachedDisk_basic(t *testing.T) { // Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached CheckDestroy: nil, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAttachedDiskResource(diskName, instanceName) + testAttachedDiskResourceAttachment(), }, - resource.TestStep{ + { ResourceName: "google_compute_attached_disk.test", ImportStateId: importID, ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAttachedDiskResource(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testCheckAttachedDiskIsNowDetached(instanceName, diskName), @@ -54,10 +54,10 @@ func TestAccComputeAttachedDisk_full(t *testing.T) { // Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached CheckDestroy: nil, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAttachedDiskResource(diskName, instanceName) + testAttachedDiskResourceAttachmentFull(), }, - resource.TestStep{ + { ResourceName: "google_compute_attached_disk.test", ImportStateId: importID, ImportState: true, @@ -81,10 +81,10 @@ func TestAccComputeAttachedDisk_region(t *testing.T) { // Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached CheckDestroy: nil, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAttachedDiskResource_region(diskName, instanceName), }, - resource.TestStep{ + { ResourceName: "google_compute_attached_disk.test", ImportStateId: importID, ImportState: true, @@ -107,7 +107,7 @@ func TestAccComputeAttachedDisk_count(t *testing.T) { Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAttachedDiskResourceCount(diskPrefix, instanceName, count), Check: resource.ComposeTestCheckFunc( testCheckAttachedDiskContainsManyDisks(instanceName, count), diff --git a/google/resource_compute_autoscaler_test.go b/google/resource_compute_autoscaler_test.go index e3434df4..de6b88ae 100644 --- a/google/resource_compute_autoscaler_test.go +++ b/google/resource_compute_autoscaler_test.go @@ -26,7 +26,7 @@ func TestAccComputeAutoscaler_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeAutoscalerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeAutoscalerExists( @@ -34,7 +34,7 @@ func TestAccComputeAutoscaler_basic(t *testing.T) { ), }, - resource.TestStep{ + { ResourceName: "google_compute_autoscaler.foobar", ImportState: true, ImportStateVerify: true, @@ -58,14 +58,14 @@ func TestAccComputeAutoscaler_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeAutoscalerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeAutoscalerExists( "google_compute_autoscaler.foobar", &ascaler), ), }, - resource.TestStep{ + { Config: testAccComputeAutoscaler_update(it_name, tp_name, igm_name, autoscaler_name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeAutoscalerExists( @@ -91,11 +91,11 @@ func TestAccComputeAutoscaler_multicondition(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeAutoscalerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeAutoscaler_multicondition(it_name, tp_name, igm_name, autoscaler_name), Check: testAccCheckComputeAutoscalerMultifunction("google_compute_autoscaler.foobar"), }, - resource.TestStep{ + { ResourceName: "google_compute_autoscaler.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_backend_bucket_test.go b/google/resource_compute_backend_bucket_test.go index ed17495f..7b9c6779 100644 --- a/google/resource_compute_backend_bucket_test.go +++ b/google/resource_compute_backend_bucket_test.go @@ -22,14 +22,14 @@ func TestAccComputeBackendBucket_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendBucket_basic(backendName, storageName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendBucketExists( "google_compute_backend_bucket.foobar", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_bucket.foobar", ImportState: true, ImportStateVerify: true, @@ -55,14 +55,14 @@ func TestAccComputeBackendBucket_basicModified(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendBucket_basic(backendName, storageName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendBucketExists( "google_compute_backend_bucket.foobar", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendBucket_basicModified( backendName, storageName, secondStorageName), Check: resource.ComposeTestCheckFunc( @@ -119,7 +119,7 @@ func TestAccComputeBackendBucket_withCdnEnabled(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendBucket_withCdnEnabled( backendName, storageName), Check: resource.ComposeTestCheckFunc( diff --git a/google/resource_compute_backend_service.go b/google/resource_compute_backend_service.go index b2180acc..726433ae 100644 --- a/google/resource_compute_backend_service.go +++ b/google/resource_compute_backend_service.go @@ -23,14 +23,14 @@ func resourceComputeBackendService() *schema.Resource { SchemaVersion: 1, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateGCPName, }, - "health_checks": &schema.Schema{ + "health_checks": { Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, Set: selfLinkRelativePathHash, @@ -39,17 +39,17 @@ func resourceComputeBackendService() *schema.Resource { MaxItems: 1, }, - "iap": &schema.Schema{ + "iap": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "oauth2_client_id": &schema.Schema{ + "oauth2_client_id": { Type: schema.TypeString, Required: true, }, - "oauth2_client_secret": &schema.Schema{ + "oauth2_client_secret": { Type: schema.TypeString, Required: true, Sensitive: true, @@ -64,48 +64,48 @@ func resourceComputeBackendService() *schema.Resource { }, }, - "backend": &schema.Schema{ + "backend": { Type: schema.TypeSet, Optional: true, Set: resourceGoogleComputeBackendServiceBackendHash, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "group": &schema.Schema{ + "group": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "balancing_mode": &schema.Schema{ + "balancing_mode": { Type: schema.TypeString, Optional: true, Default: "UTILIZATION", }, - "capacity_scaler": &schema.Schema{ + "capacity_scaler": { Type: schema.TypeFloat, Optional: true, Default: 1, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "max_rate": &schema.Schema{ + "max_rate": { Type: schema.TypeInt, Optional: true, }, - "max_rate_per_instance": &schema.Schema{ + "max_rate_per_instance": { Type: schema.TypeFloat, Optional: true, }, - "max_connections": &schema.Schema{ + "max_connections": { Type: schema.TypeInt, Optional: true, }, - "max_connections_per_instance": &schema.Schema{ + "max_connections_per_instance": { Type: schema.TypeInt, Optional: true, }, - "max_utilization": &schema.Schema{ + "max_utilization": { Type: schema.TypeFloat, Optional: true, Default: 0.8, @@ -114,38 +114,38 @@ func resourceComputeBackendService() *schema.Resource { }, }, - "cdn_policy": &schema.Schema{ + "cdn_policy": { Type: schema.TypeList, Optional: true, Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "cache_key_policy": &schema.Schema{ + "cache_key_policy": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "include_host": &schema.Schema{ + "include_host": { Type: schema.TypeBool, Optional: true, }, - "include_protocol": &schema.Schema{ + "include_protocol": { Type: schema.TypeBool, Optional: true, }, - "include_query_string": &schema.Schema{ + "include_query_string": { Type: schema.TypeBool, Optional: true, }, - "query_string_blacklist": &schema.Schema{ + "query_string_blacklist": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, ConflictsWith: []string{"cdn_policy.0.cache_key_policy.query_string_whitelist"}, }, - "query_string_whitelist": &schema.Schema{ + "query_string_whitelist": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -158,7 +158,7 @@ func resourceComputeBackendService() *schema.Resource { }, }, - "custom_request_headers": &schema.Schema{ + "custom_request_headers": { Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Type: schema.TypeSet, Optional: true, @@ -166,72 +166,72 @@ func resourceComputeBackendService() *schema.Resource { Set: schema.HashString, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "enable_cdn": &schema.Schema{ + "enable_cdn": { Type: schema.TypeBool, Optional: true, Default: false, }, - "fingerprint": &schema.Schema{ + "fingerprint": { Type: schema.TypeString, Computed: true, }, - "port_name": &schema.Schema{ + "port_name": { Type: schema.TypeString, Optional: true, Computed: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "protocol": &schema.Schema{ + "protocol": { Type: schema.TypeString, Optional: true, Computed: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, ForceNew: true, Removed: "region has been removed as it was never used. For internal load balancing, use google_compute_region_backend_service", }, - "security_policy": &schema.Schema{ + "security_policy": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "session_affinity": &schema.Schema{ + "session_affinity": { Type: schema.TypeString, Optional: true, Computed: true, }, - "timeout_sec": &schema.Schema{ + "timeout_sec": { Type: schema.TypeInt, Optional: true, Computed: true, }, - "connection_draining_timeout_sec": &schema.Schema{ + "connection_draining_timeout_sec": { Type: schema.TypeInt, Optional: true, Default: 300, diff --git a/google/resource_compute_backend_service_test.go b/google/resource_compute_backend_service_test.go index eca3cd75..cdecc13a 100644 --- a/google/resource_compute_backend_service_test.go +++ b/google/resource_compute_backend_service_test.go @@ -24,14 +24,14 @@ func TestAccComputeBackendService_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_basic(serviceName, checkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendServiceExists( "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendService_basicModified( serviceName, checkName, extraCheckName), Check: resource.ComposeTestCheckFunc( @@ -39,7 +39,7 @@ func TestAccComputeBackendService_basic(t *testing.T) { "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.foobar", ImportState: true, ImportStateVerify: true, @@ -61,7 +61,7 @@ func TestAccComputeBackendService_withBackend(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withBackend( serviceName, igName, itName, checkName, 10), Check: resource.ComposeTestCheckFunc( @@ -69,7 +69,7 @@ func TestAccComputeBackendService_withBackend(t *testing.T) { "google_compute_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendService_withBackend( serviceName, igName, itName, checkName, 20), Check: resource.ComposeTestCheckFunc( @@ -77,7 +77,7 @@ func TestAccComputeBackendService_withBackend(t *testing.T) { "google_compute_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.lipsum", ImportState: true, ImportStateVerify: true, @@ -107,7 +107,7 @@ func TestAccComputeBackendService_withBackendAndIAP(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withBackendAndIAP( serviceName, igName, itName, checkName, 10), Check: resource.ComposeTestCheckFunc( @@ -115,12 +115,12 @@ func TestAccComputeBackendService_withBackendAndIAP(t *testing.T) { "google_compute_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.lipsum", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeBackendService_withBackend( serviceName, igName, itName, checkName, 10), Check: resource.ComposeTestCheckFunc( @@ -155,7 +155,7 @@ func TestAccComputeBackendService_updatePreservesOptionalParameters(t *testing.T Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withSessionAffinity( serviceName, checkName, "initial-description", "GENERATED_COOKIE"), Check: resource.ComposeTestCheckFunc( @@ -163,7 +163,7 @@ func TestAccComputeBackendService_updatePreservesOptionalParameters(t *testing.T "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendService_withSessionAffinity( serviceName, checkName, "updated-description", "GENERATED_COOKIE"), Check: resource.ComposeTestCheckFunc( @@ -191,14 +191,14 @@ func TestAccComputeBackendService_withConnectionDraining(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withConnectionDraining(serviceName, checkName, 10), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendServiceExists( "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.foobar", ImportState: true, ImportStateVerify: true, @@ -223,14 +223,14 @@ func TestAccComputeBackendService_withConnectionDrainingAndUpdate(t *testing.T) Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withConnectionDraining(serviceName, checkName, 10), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendServiceExists( "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendService_basic(serviceName, checkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendServiceExists( @@ -257,14 +257,14 @@ func TestAccComputeBackendService_withHttpsHealthCheck(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withHttpsHealthCheck(serviceName, checkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendServiceExists( "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.foobar", ImportState: true, ImportStateVerify: true, @@ -285,14 +285,14 @@ func TestAccComputeBackendService_withCdnPolicy(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withCdnPolicy(serviceName, checkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendServiceExists( "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.foobar", ImportState: true, ImportStateVerify: true, @@ -314,7 +314,7 @@ func TestAccComputeBackendService_withSecurityPolicy(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withSecurityPolicy(serviceName, checkName, polName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBackendServiceExists( @@ -450,7 +450,7 @@ func TestAccComputeBackendService_withCDNEnabled(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withCDNEnabled( serviceName, checkName), Check: resource.ComposeTestCheckFunc( @@ -478,7 +478,7 @@ func TestAccComputeBackendService_withSessionAffinity(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withSessionAffinity( serviceName, checkName, "description", "CLIENT_IP"), Check: resource.ComposeTestCheckFunc( @@ -486,7 +486,7 @@ func TestAccComputeBackendService_withSessionAffinity(t *testing.T) { "google_compute_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendService_withSessionAffinity( serviceName, checkName, "description", "GENERATED_COOKIE"), Check: resource.ComposeTestCheckFunc( @@ -516,7 +516,7 @@ func TestAccComputeBackendService_withMaxConnections(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withMaxConnections( serviceName, igName, itName, checkName, 10), Check: resource.ComposeTestCheckFunc( @@ -524,7 +524,7 @@ func TestAccComputeBackendService_withMaxConnections(t *testing.T) { "google_compute_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendService_withMaxConnections( serviceName, igName, itName, checkName, 20), Check: resource.ComposeTestCheckFunc( @@ -532,7 +532,7 @@ func TestAccComputeBackendService_withMaxConnections(t *testing.T) { "google_compute_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.lipsum", ImportState: true, ImportStateVerify: true, @@ -559,7 +559,7 @@ func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeBackendService_withMaxConnectionsPerInstance( serviceName, igName, itName, checkName, 10), Check: resource.ComposeTestCheckFunc( @@ -567,7 +567,7 @@ func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) { "google_compute_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeBackendService_withMaxConnectionsPerInstance( serviceName, igName, itName, checkName, 20), Check: resource.ComposeTestCheckFunc( @@ -575,7 +575,7 @@ func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) { "google_compute_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { ResourceName: "google_compute_backend_service.lipsum", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_disk.go b/google/resource_compute_disk.go index c27082a9..f157ea80 100644 --- a/google/resource_compute_disk.go +++ b/google/resource_compute_disk.go @@ -388,7 +388,7 @@ func resourceComputeDisk() *schema.Resource { DiffSuppressFunc: compareSelfLinkOrResourceName, }, }, - "disk_encryption_key_raw": &schema.Schema{ + "disk_encryption_key_raw": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -396,7 +396,7 @@ func resourceComputeDisk() *schema.Resource { Removed: "Use disk_encryption_key.raw_key instead.", }, - "disk_encryption_key_sha256": &schema.Schema{ + "disk_encryption_key_sha256": { Type: schema.TypeString, Computed: true, Removed: "Use disk_encryption_key.sha256 instead.", diff --git a/google/resource_compute_disk_test.go b/google/resource_compute_disk_test.go index 1783e802..7be01f7f 100644 --- a/google/resource_compute_disk_test.go +++ b/google/resource_compute_disk_test.go @@ -216,7 +216,7 @@ func TestAccComputeDisk_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeDisk_basic(diskName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -225,7 +225,7 @@ func TestAccComputeDisk_basic(t *testing.T) { testAccCheckComputeDiskHasLabelFingerprint(&disk, "google_compute_disk.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_disk.foobar", ImportState: true, ImportStateVerify: true, @@ -242,7 +242,7 @@ func TestAccComputeDisk_timeout(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeDisk_timeout(diskName), ExpectError: regexp.MustCompile("timeout"), }, @@ -300,14 +300,14 @@ func TestAccComputeDisk_fromSnapshot(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "self_link"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( "google_compute_disk.seconddisk", getTestProjectFromEnv(), &disk), ), }, - resource.TestStep{ + { Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "name"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -329,7 +329,7 @@ func TestAccComputeDisk_encryption(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeDisk_encryption(diskName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -354,7 +354,7 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeDisk_deleteDetach(instanceName, diskName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -365,7 +365,7 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) { // listed as attached to the disk; the instance is created after the // disk. and the disk's properties aren't refreshed unless there's // another step - resource.TestStep{ + { Config: testAccComputeDisk_deleteDetach(instanceName, diskName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -391,7 +391,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -402,7 +402,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { // listed as attached to the disk; the instance is created after the // disk. and the disk's properties aren't refreshed unless there's // another step - resource.TestStep{ + { Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -412,7 +412,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { ), }, // Change the disk name to recreate the instances - resource.TestStep{ + { Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( @@ -420,7 +420,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { ), }, // Add the extra step like before - resource.TestStep{ + { Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeDiskExists( diff --git a/google/resource_compute_firewall_migrate.go b/google/resource_compute_firewall_migrate.go index 8509075f..d2b71bd7 100644 --- a/google/resource_compute_firewall_migrate.go +++ b/google/resource_compute_firewall_migrate.go @@ -36,7 +36,7 @@ func migrateFirewallStateV0toV1(is *terraform.InstanceState) (*terraform.Instanc portCount := 0 newPorts := make(map[string]string) keys := make([]string, len(is.Attributes)) - for k, _ := range is.Attributes { + for k := range is.Attributes { keys[idx] = k idx++ diff --git a/google/resource_compute_firewall_test.go b/google/resource_compute_firewall_test.go index cf592eef..9266c1e3 100644 --- a/google/resource_compute_firewall_test.go +++ b/google/resource_compute_firewall_test.go @@ -26,7 +26,7 @@ func TestAccComputeFirewall_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeFirewall_basic(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists( @@ -34,7 +34,7 @@ func TestAccComputeFirewall_basic(t *testing.T) { testAccCheckComputeFirewallApiVersion(&firewall), ), }, - resource.TestStep{ + { ResourceName: "google_compute_firewall.foobar", ImportState: true, ImportStateVerify: true, @@ -55,7 +55,7 @@ func TestAccComputeFirewall_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeFirewall_basic(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists( @@ -68,7 +68,7 @@ func TestAccComputeFirewall_update(t *testing.T) { ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeFirewall_update(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists( @@ -83,7 +83,7 @@ func TestAccComputeFirewall_update(t *testing.T) { ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeFirewall_basic(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists( @@ -142,7 +142,7 @@ func TestAccComputeFirewall_noSource(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeFirewall_noSource(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists( @@ -150,7 +150,7 @@ func TestAccComputeFirewall_noSource(t *testing.T) { testAccCheckComputeFirewallApiVersion(&firewall), ), }, - resource.TestStep{ + { ResourceName: "google_compute_firewall.foobar", ImportState: true, ImportStateVerify: true, @@ -171,7 +171,7 @@ func TestAccComputeFirewall_denied(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeFirewall_denied(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists("google_compute_firewall.foobar", &firewall), @@ -179,7 +179,7 @@ func TestAccComputeFirewall_denied(t *testing.T) { testAccCheckComputeFirewallApiVersion(&firewall), ), }, - resource.TestStep{ + { ResourceName: "google_compute_firewall.foobar", ImportState: true, ImportStateVerify: true, @@ -200,7 +200,7 @@ func TestAccComputeFirewall_egress(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeFirewall_egress(networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists("google_compute_firewall.foobar", &firewall), @@ -208,7 +208,7 @@ func TestAccComputeFirewall_egress(t *testing.T) { testAccCheckComputeFirewallApiVersion(&firewall), ), }, - resource.TestStep{ + { ResourceName: "google_compute_firewall.foobar", ImportState: true, ImportStateVerify: true, @@ -235,7 +235,7 @@ func TestAccComputeFirewall_serviceAccounts(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeFirewall_serviceAccounts(sourceSa, targetSa, networkName, firewallName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeFirewallExists("google_compute_firewall.foobar", &firewall), @@ -243,7 +243,7 @@ func TestAccComputeFirewall_serviceAccounts(t *testing.T) { testAccCheckComputeFirewallApiVersion(&firewall), ), }, - resource.TestStep{ + { ResourceName: "google_compute_firewall.foobar", ImportState: true, ImportStateVerify: true, @@ -263,18 +263,18 @@ func TestAccComputeFirewall_disabled(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeFirewallDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeFirewall_disabled(networkName, firewallName), }, - resource.TestStep{ + { ResourceName: "google_compute_firewall.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeFirewall_basic(networkName, firewallName), }, - resource.TestStep{ + { ResourceName: "google_compute_firewall.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_forwarding_rule_test.go b/google/resource_compute_forwarding_rule_test.go index d9c1d48c..de49ed48 100644 --- a/google/resource_compute_forwarding_rule_test.go +++ b/google/resource_compute_forwarding_rule_test.go @@ -19,18 +19,18 @@ func TestAccComputeForwardingRule_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeForwardingRule_basic(poolName, ruleName), }, - resource.TestStep{ + { ResourceName: "google_compute_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeForwardingRule_update(poolName, ruleName), }, - resource.TestStep{ + { ResourceName: "google_compute_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, @@ -50,10 +50,10 @@ func TestAccComputeForwardingRule_singlePort(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeForwardingRule_singlePort(poolName, ruleName), }, - resource.TestStep{ + { ResourceName: "google_compute_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, @@ -74,10 +74,10 @@ func TestAccComputeForwardingRule_ip(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeForwardingRule_ip(addrName, poolName, ruleName), }, - resource.TestStep{ + { ResourceName: "google_compute_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, @@ -100,15 +100,15 @@ func TestAccComputeForwardingRule_internalLoadBalancing(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeForwardingRule_internalLoadBalancing(serviceName, checkName, networkName, ruleName1, ruleName2), }, - resource.TestStep{ + { ResourceName: "google_compute_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_compute_forwarding_rule.foobar2", ImportState: true, ImportStateVerify: true, @@ -128,11 +128,11 @@ func TestAccComputeForwardingRule_networkTier(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeForwardingRule_networkTier(poolName, ruleName), }, - resource.TestStep{ + { ResourceName: "google_compute_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_global_address_test.go b/google/resource_compute_global_address_test.go index 7d23d416..18928bb3 100644 --- a/google/resource_compute_global_address_test.go +++ b/google/resource_compute_global_address_test.go @@ -21,7 +21,7 @@ func TestAccComputeGlobalAddress_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeGlobalAddressDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeGlobalAddress_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeGlobalAddressExists( @@ -31,7 +31,7 @@ func TestAccComputeGlobalAddress_basic(t *testing.T) { testAccCheckComputeGlobalAddressIpVersion("google_compute_global_address.foobar", ""), ), }, - resource.TestStep{ + { ResourceName: "google_compute_global_address.foobar", ImportState: true, ImportStateVerify: true, @@ -50,7 +50,7 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeGlobalAddressDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeGlobalAddress_ipv6(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeGlobalAddressExists( @@ -58,7 +58,7 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) { testAccCheckComputeGlobalAddressIpVersion("google_compute_global_address.foobar", "IPV6"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_global_address.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_global_forwarding_rule.go b/google/resource_compute_global_forwarding_rule.go index fbdac97c..5cc650c9 100644 --- a/google/resource_compute_global_forwarding_rule.go +++ b/google/resource_compute_global_forwarding_rule.go @@ -23,39 +23,39 @@ func resourceComputeGlobalForwardingRule() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "target": &schema.Schema{ + "target": { Type: schema.TypeString, Required: true, DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "ip_address": &schema.Schema{ + "ip_address": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "ip_protocol": &schema.Schema{ + "ip_protocol": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "labels": &schema.Schema{ + "labels": { Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Type: schema.TypeMap, Optional: true, @@ -63,41 +63,41 @@ func resourceComputeGlobalForwardingRule() *schema.Resource { Set: schema.HashString, }, - "label_fingerprint": &schema.Schema{ + "label_fingerprint": { Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Type: schema.TypeString, Computed: true, }, - "port_range": &schema.Schema{ + "port_range": { Type: schema.TypeString, Optional: true, ForceNew: true, DiffSuppressFunc: portRangeDiffSuppress, }, - "ip_version": &schema.Schema{ + "ip_version": { Type: schema.TypeString, Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"IPV4", "IPV6"}, false), }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, ForceNew: true, Removed: "Please remove this attribute (it was never used)", }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_compute_global_forwarding_rule_test.go b/google/resource_compute_global_forwarding_rule_test.go index 99f0ea56..c153054d 100644 --- a/google/resource_compute_global_forwarding_rule_test.go +++ b/google/resource_compute_global_forwarding_rule_test.go @@ -26,7 +26,7 @@ func TestAccComputeGlobalForwardingRule_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeGlobalForwardingRule_basic1(fr, proxy1, proxy2, backend, hc, urlmap), Check: resource.ComposeTestCheckFunc( testAccCheckComputeGlobalForwardingRuleExists( @@ -36,7 +36,7 @@ func TestAccComputeGlobalForwardingRule_basic(t *testing.T) { testAccCheckComputeBetaGlobalForwardingRuleIpVersion("google_compute_global_forwarding_rule.foobar", ""), ), }, - resource.TestStep{ + { ResourceName: "google_compute_global_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, @@ -60,7 +60,7 @@ func TestAccComputeGlobalForwardingRule_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeGlobalForwardingRule_basic1(fr, proxy1, proxy2, backend, hc, urlmap), Check: resource.ComposeTestCheckFunc( testAccCheckComputeGlobalForwardingRuleExists( @@ -68,7 +68,7 @@ func TestAccComputeGlobalForwardingRule_update(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccComputeGlobalForwardingRule_basic2(fr, proxy1, proxy2, backend, hc, urlmap), Check: resource.ComposeTestCheckFunc( testAccCheckComputeGlobalForwardingRuleExists( @@ -96,7 +96,7 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeGlobalForwardingRule_ipv6(fr, proxy1, proxy2, backend, hc, urlmap), Check: resource.ComposeTestCheckFunc( testAccCheckComputeBetaGlobalForwardingRuleExists( @@ -104,7 +104,7 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) { testAccCheckComputeBetaGlobalForwardingRuleIpVersion("google_compute_global_forwarding_rule.foobar", "IPV6"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_global_forwarding_rule.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_health_check_test.go b/google/resource_compute_health_check_test.go index adca744a..d3f68672 100644 --- a/google/resource_compute_health_check_test.go +++ b/google/resource_compute_health_check_test.go @@ -23,7 +23,7 @@ func TestAccComputeHealthCheck_tcp(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHealthCheck_tcp(hckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHealthCheckExists( @@ -33,7 +33,7 @@ func TestAccComputeHealthCheck_tcp(t *testing.T) { testAccCheckComputeHealthCheckTcpPort(80, &healthCheck), ), }, - resource.TestStep{ + { ResourceName: "google_compute_health_check.foobar", ImportState: true, ImportStateVerify: true, @@ -54,7 +54,7 @@ func TestAccComputeHealthCheck_tcp_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHealthCheck_tcp(hckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHealthCheckExists( @@ -64,7 +64,7 @@ func TestAccComputeHealthCheck_tcp_update(t *testing.T) { testAccCheckComputeHealthCheckTcpPort(80, &healthCheck), ), }, - resource.TestStep{ + { Config: testAccComputeHealthCheck_tcp_update(hckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHealthCheckExists( @@ -90,7 +90,7 @@ func TestAccComputeHealthCheck_ssl(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHealthCheck_ssl(hckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHealthCheckExists( @@ -99,7 +99,7 @@ func TestAccComputeHealthCheck_ssl(t *testing.T) { 3, 3, &healthCheck), ), }, - resource.TestStep{ + { ResourceName: "google_compute_health_check.foobar", ImportState: true, ImportStateVerify: true, @@ -120,7 +120,7 @@ func TestAccComputeHealthCheck_http(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHealthCheck_http(hckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHealthCheckExists( @@ -129,7 +129,7 @@ func TestAccComputeHealthCheck_http(t *testing.T) { 3, 3, &healthCheck), ), }, - resource.TestStep{ + { ResourceName: "google_compute_health_check.foobar", ImportState: true, ImportStateVerify: true, @@ -150,7 +150,7 @@ func TestAccComputeHealthCheck_https(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHealthCheck_https(hckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHealthCheckExists( @@ -159,7 +159,7 @@ func TestAccComputeHealthCheck_https(t *testing.T) { 3, 3, &healthCheck), ), }, - resource.TestStep{ + { ResourceName: "google_compute_health_check.foobar", ImportState: true, ImportStateVerify: true, @@ -178,19 +178,19 @@ func TestAccComputeHealthCheck_typeTransition(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHealthCheck_https(hckName), }, - resource.TestStep{ + { Config: testAccComputeHealthCheck_http(hckName), }, - resource.TestStep{ + { Config: testAccComputeHealthCheck_ssl(hckName), }, - resource.TestStep{ + { Config: testAccComputeHealthCheck_tcp(hckName), }, - resource.TestStep{ + { Config: testAccComputeHealthCheck_https(hckName), }, }, @@ -207,7 +207,7 @@ func TestAccComputeHealthCheck_tcpAndSsl_shouldFail(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHealthCheck_tcpAndSsl_shouldFail(hckName), ExpectError: regexp.MustCompile("conflicts with tcp_health_check"), }, diff --git a/google/resource_compute_http_health_check_test.go b/google/resource_compute_http_health_check_test.go index 6586848c..97b7e459 100644 --- a/google/resource_compute_http_health_check_test.go +++ b/google/resource_compute_http_health_check_test.go @@ -22,7 +22,7 @@ func TestAccComputeHttpHealthCheck_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHttpHealthCheck_basic(hhckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHttpHealthCheckExists( @@ -33,7 +33,7 @@ func TestAccComputeHttpHealthCheck_basic(t *testing.T) { 3, 3, &healthCheck), ), }, - resource.TestStep{ + { ResourceName: "google_compute_http_health_check.foobar", ImportState: true, ImportStateVerify: true, @@ -54,7 +54,7 @@ func TestAccComputeHttpHealthCheck_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHttpHealthCheck_update1(hhckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHttpHealthCheckExists( @@ -65,7 +65,7 @@ func TestAccComputeHttpHealthCheck_update(t *testing.T) { 2, 2, &healthCheck), ), }, - resource.TestStep{ + { Config: testAccComputeHttpHealthCheck_update2(hhckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHttpHealthCheckExists( diff --git a/google/resource_compute_https_health_check_test.go b/google/resource_compute_https_health_check_test.go index 8cfbf4c2..8e034fc1 100644 --- a/google/resource_compute_https_health_check_test.go +++ b/google/resource_compute_https_health_check_test.go @@ -22,7 +22,7 @@ func TestAccComputeHttpsHealthCheck_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHttpsHealthCheck_basic(hhckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHttpsHealthCheckExists( @@ -33,7 +33,7 @@ func TestAccComputeHttpsHealthCheck_basic(t *testing.T) { 3, 3, &healthCheck), ), }, - resource.TestStep{ + { ResourceName: "google_compute_https_health_check.foobar", ImportState: true, ImportStateVerify: true, @@ -54,7 +54,7 @@ func TestAccComputeHttpsHealthCheck_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeHttpsHealthCheck_update1(hhckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHttpsHealthCheckExists( @@ -65,7 +65,7 @@ func TestAccComputeHttpsHealthCheck_update(t *testing.T) { 2, 2, &healthCheck), ), }, - resource.TestStep{ + { Config: testAccComputeHttpsHealthCheck_update2(hhckName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeHttpsHealthCheckExists( diff --git a/google/resource_compute_image.go b/google/resource_compute_image.go index 195bbf27..25f6423d 100644 --- a/google/resource_compute_image.go +++ b/google/resource_compute_image.go @@ -30,55 +30,55 @@ func resourceComputeImage() *schema.Resource { Schema: map[string]*schema.Schema{ // TODO(cblecker): one of source_disk or raw_disk is required - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "family": &schema.Schema{ + "family": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "source_disk": &schema.Schema{ + "source_disk": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "raw_disk": &schema.Schema{ + "raw_disk": { Type: schema.TypeList, Optional: true, ForceNew: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "sha1": &schema.Schema{ + "sha1": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "container_type": &schema.Schema{ + "container_type": { Type: schema.TypeString, Optional: true, Default: "TAR", @@ -88,25 +88,25 @@ func resourceComputeImage() *schema.Resource { }, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "create_timeout": &schema.Schema{ + "create_timeout": { Type: schema.TypeInt, Optional: true, Removed: "Use timeouts block instead. See https://www.terraform.io/docs/configuration/resources.html#timeouts.", }, - "labels": &schema.Schema{ + "labels": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "licenses": &schema.Schema{ + "licenses": { Type: schema.TypeList, Optional: true, ForceNew: true, @@ -114,7 +114,7 @@ func resourceComputeImage() *schema.Resource { Computed: true, }, - "label_fingerprint": &schema.Schema{ + "label_fingerprint": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_compute_image_test.go b/google/resource_compute_image_test.go index 66fe34c1..b2ebf652 100644 --- a/google/resource_compute_image_test.go +++ b/google/resource_compute_image_test.go @@ -20,7 +20,7 @@ func TestAccComputeImage_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeImageDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeImage_basic("image-test-" + acctest.RandString(10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeImageExists( @@ -46,7 +46,7 @@ func TestAccComputeImage_withLicense(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeImageDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeImage_license("image-test-" + acctest.RandString(10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeImageExists( @@ -75,7 +75,7 @@ func TestAccComputeImage_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeImageDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeImage_basic(name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeImageExists( @@ -85,7 +85,7 @@ func TestAccComputeImage_update(t *testing.T) { testAccCheckComputeImageHasComputedFingerprint(&image, "google_compute_image.foobar"), ), }, - resource.TestStep{ + { Config: testAccComputeImage_update(name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeImageExists( @@ -96,7 +96,7 @@ func TestAccComputeImage_update(t *testing.T) { testAccCheckComputeImageHasComputedFingerprint(&image, "google_compute_image.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_image.foobar", ImportState: true, ImportStateVerify: true, @@ -116,7 +116,7 @@ func TestAccComputeImage_basedondisk(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeImageDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeImage_basedondisk(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeImageExists( @@ -124,7 +124,7 @@ func TestAccComputeImage_basedondisk(t *testing.T) { testAccCheckComputeImageHasSourceDisk(&image), ), }, - resource.TestStep{ + { ResourceName: "google_compute_image.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_instance.go b/google/resource_compute_instance.go index 7d4ac128..71de97cc 100644 --- a/google/resource_compute_instance.go +++ b/google/resource_compute_instance.go @@ -42,40 +42,40 @@ func resourceComputeInstance() *schema.Resource { // template. Please attempt to maintain consistency with the // resource_compute_instance_template schema when updating this one. Schema: map[string]*schema.Schema{ - "boot_disk": &schema.Schema{ + "boot_disk": { Type: schema.TypeList, Required: true, ForceNew: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "auto_delete": &schema.Schema{ + "auto_delete": { Type: schema.TypeBool, Optional: true, Default: true, ForceNew: true, }, - "device_name": &schema.Schema{ + "device_name": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "disk_encryption_key_raw": &schema.Schema{ + "disk_encryption_key_raw": { Type: schema.TypeString, Optional: true, ForceNew: true, Sensitive: true, }, - "disk_encryption_key_sha256": &schema.Schema{ + "disk_encryption_key_sha256": { Type: schema.TypeString, Computed: true, }, - "initialize_params": &schema.Schema{ + "initialize_params": { Type: schema.TypeList, Optional: true, Computed: true, @@ -83,7 +83,7 @@ func resourceComputeInstance() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "size": &schema.Schema{ + "size": { Type: schema.TypeInt, Optional: true, Computed: true, @@ -91,7 +91,7 @@ func resourceComputeInstance() *schema.Resource { ValidateFunc: validation.IntAtLeast(1), }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Optional: true, Computed: true, @@ -99,7 +99,7 @@ func resourceComputeInstance() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd"}, false), }, - "image": &schema.Schema{ + "image": { Type: schema.TypeString, Optional: true, Computed: true, @@ -110,7 +110,7 @@ func resourceComputeInstance() *schema.Resource { }, }, - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Optional: true, Computed: true, @@ -122,24 +122,24 @@ func resourceComputeInstance() *schema.Resource { }, }, - "machine_type": &schema.Schema{ + "machine_type": { Type: schema.TypeString, Required: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "network_interface": &schema.Schema{ + "network_interface": { Type: schema.TypeList, Required: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "network": &schema.Schema{ + "network": { Type: schema.TypeString, Optional: true, Computed: true, @@ -147,7 +147,7 @@ func resourceComputeInstance() *schema.Resource { DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "subnetwork": &schema.Schema{ + "subnetwork": { Type: schema.TypeString, Optional: true, Computed: true, @@ -155,50 +155,50 @@ func resourceComputeInstance() *schema.Resource { DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "subnetwork_project": &schema.Schema{ + "subnetwork_project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "network_ip": &schema.Schema{ + "network_ip": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "access_config": &schema.Schema{ + "access_config": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "nat_ip": &schema.Schema{ + "nat_ip": { Type: schema.TypeString, Optional: true, Computed: true, }, - "network_tier": &schema.Schema{ + "network_tier": { Type: schema.TypeString, Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{"PREMIUM", "STANDARD"}, false), }, - "assigned_nat_ip": &schema.Schema{ + "assigned_nat_ip": { Type: schema.TypeString, Computed: true, Removed: "Use network_interface.access_config.nat_ip instead.", }, - "public_ptr_domain_name": &schema.Schema{ + "public_ptr_domain_name": { Type: schema.TypeString, Optional: true, }, @@ -206,17 +206,17 @@ func resourceComputeInstance() *schema.Resource { }, }, - "alias_ip_range": &schema.Schema{ + "alias_ip_range": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ip_cidr_range": &schema.Schema{ + "ip_cidr_range": { Type: schema.TypeString, Required: true, DiffSuppressFunc: ipCidrRangeDiffSuppress, }, - "subnetwork_range_name": &schema.Schema{ + "subnetwork_range_name": { Type: schema.TypeString, Optional: true, }, @@ -224,7 +224,7 @@ func resourceComputeInstance() *schema.Resource { }, }, - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -235,42 +235,42 @@ func resourceComputeInstance() *schema.Resource { }, }, - "allow_stopping_for_update": &schema.Schema{ + "allow_stopping_for_update": { Type: schema.TypeBool, Optional: true, }, - "attached_disk": &schema.Schema{ + "attached_disk": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Required: true, DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "device_name": &schema.Schema{ + "device_name": { Type: schema.TypeString, Optional: true, Computed: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Optional: true, Default: "READ_WRITE", ValidateFunc: validation.StringInSlice([]string{"READ_WRITE", "READ_ONLY"}, false), }, - "disk_encryption_key_raw": &schema.Schema{ + "disk_encryption_key_raw": { Type: schema.TypeString, Optional: true, Sensitive: true, }, - "disk_encryption_key_sha256": &schema.Schema{ + "disk_encryption_key_sha256": { Type: schema.TypeString, Computed: true, }, @@ -278,32 +278,32 @@ func resourceComputeInstance() *schema.Resource { }, }, - "can_ip_forward": &schema.Schema{ + "can_ip_forward": { Type: schema.TypeBool, Optional: true, Default: false, ForceNew: true, }, - "create_timeout": &schema.Schema{ + "create_timeout": { Type: schema.TypeInt, Optional: true, Removed: "Use timeouts block instead.", }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "deletion_protection": &schema.Schema{ + "deletion_protection": { Type: schema.TypeBool, Optional: true, Default: false, }, - "disk": &schema.Schema{ + "disk": { Type: schema.TypeList, Optional: true, ForceNew: true, @@ -312,56 +312,56 @@ func resourceComputeInstance() *schema.Resource { Schema: map[string]*schema.Schema{ // TODO(mitchellh): one of image or disk is required - "disk": &schema.Schema{ + "disk": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "image": &schema.Schema{ + "image": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "scratch": &schema.Schema{ + "scratch": { Type: schema.TypeBool, Optional: true, ForceNew: true, }, - "auto_delete": &schema.Schema{ + "auto_delete": { Type: schema.TypeBool, Optional: true, Default: true, ForceNew: true, }, - "size": &schema.Schema{ + "size": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "device_name": &schema.Schema{ + "device_name": { Type: schema.TypeString, Optional: true, }, - "disk_encryption_key_raw": &schema.Schema{ + "disk_encryption_key_raw": { Type: schema.TypeString, Optional: true, ForceNew: true, Sensitive: true, }, - "disk_encryption_key_sha256": &schema.Schema{ + "disk_encryption_key_sha256": { Type: schema.TypeString, Computed: true, }, @@ -369,19 +369,19 @@ func resourceComputeInstance() *schema.Resource { }, }, - "guest_accelerator": &schema.Schema{ + "guest_accelerator": { Type: schema.TypeList, Optional: true, Computed: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "count": &schema.Schema{ + "count": { Type: schema.TypeInt, Required: true, ForceNew: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -391,57 +391,57 @@ func resourceComputeInstance() *schema.Resource { }, }, - "labels": &schema.Schema{ + "labels": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "metadata": &schema.Schema{ + "metadata": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "metadata_startup_script": &schema.Schema{ + "metadata_startup_script": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "min_cpu_platform": &schema.Schema{ + "min_cpu_platform": { Type: schema.TypeString, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "scheduling": &schema.Schema{ + "scheduling": { Type: schema.TypeList, MaxItems: 1, Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "on_host_maintenance": &schema.Schema{ + "on_host_maintenance": { Type: schema.TypeString, Optional: true, Computed: true, }, - "automatic_restart": &schema.Schema{ + "automatic_restart": { Type: schema.TypeBool, Optional: true, Default: true, }, - "preemptible": &schema.Schema{ + "preemptible": { Type: schema.TypeBool, Optional: true, Default: false, @@ -451,13 +451,13 @@ func resourceComputeInstance() *schema.Resource { }, }, - "scratch_disk": &schema.Schema{ + "scratch_disk": { Type: schema.TypeList, Optional: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "interface": &schema.Schema{ + "interface": { Type: schema.TypeString, Optional: true, Default: "SCSI", @@ -467,19 +467,19 @@ func resourceComputeInstance() *schema.Resource { }, }, - "service_account": &schema.Schema{ + "service_account": { Type: schema.TypeList, MaxItems: 1, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "email": &schema.Schema{ + "email": { Type: schema.TypeString, Optional: true, Computed: true, }, - "scopes": &schema.Schema{ + "scopes": { Type: schema.TypeSet, Required: true, Elem: &schema.Schema{ @@ -494,46 +494,46 @@ func resourceComputeInstance() *schema.Resource { }, }, - "tags": &schema.Schema{ + "tags": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "zone": &schema.Schema{ + "zone": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "cpu_platform": &schema.Schema{ + "cpu_platform": { Type: schema.TypeString, Computed: true, }, - "instance_id": &schema.Schema{ + "instance_id": { Type: schema.TypeString, Computed: true, }, - "label_fingerprint": &schema.Schema{ + "label_fingerprint": { Type: schema.TypeString, Computed: true, }, - "metadata_fingerprint": &schema.Schema{ + "metadata_fingerprint": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "tags_fingerprint": &schema.Schema{ + "tags_fingerprint": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_compute_instance_from_template_test.go b/google/resource_compute_instance_from_template_test.go index f250150f..07d1b3d1 100644 --- a/google/resource_compute_instance_from_template_test.go +++ b/google/resource_compute_instance_from_template_test.go @@ -23,7 +23,7 @@ func TestAccComputeInstanceFromTemplate_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceFromTemplate_basic(instanceName, templateName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists(resourceName, &instance), diff --git a/google/resource_compute_instance_group_manager.go b/google/resource_compute_instance_group_manager.go index 20fd4ae1..fc89a1e2 100644 --- a/google/resource_compute_instance_group_manager.go +++ b/google/resource_compute_instance_group_manager.go @@ -31,52 +31,52 @@ func resourceComputeInstanceGroupManager() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "base_instance_name": &schema.Schema{ + "base_instance_name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "instance_template": &schema.Schema{ + "instance_template": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "version": &schema.Schema{ + "version": { Type: schema.TypeList, Optional: true, Computed: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "instance_template": &schema.Schema{ + "instance_template": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "target_size": &schema.Schema{ + "target_size": { Type: schema.TypeList, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "fixed": &schema.Schema{ + "fixed": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "percent": &schema.Schema{ + "percent": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", @@ -89,46 +89,46 @@ func resourceComputeInstanceGroupManager() *schema.Resource { }, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "zone": &schema.Schema{ + "zone": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "fingerprint": &schema.Schema{ + "fingerprint": { Type: schema.TypeString, Computed: true, }, - "instance_group": &schema.Schema{ + "instance_group": { Type: schema.TypeString, Computed: true, }, - "named_port": &schema.Schema{ + "named_port": { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "port": &schema.Schema{ + "port": { Type: schema.TypeInt, Required: true, }, @@ -136,19 +136,19 @@ func resourceComputeInstanceGroupManager() *schema.Resource { }, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "update_strategy": &schema.Schema{ + "update_strategy": { Type: schema.TypeString, Optional: true, Default: "REPLACE", @@ -164,7 +164,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource { }, }, - "target_pools": &schema.Schema{ + "target_pools": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{ @@ -173,27 +173,27 @@ func resourceComputeInstanceGroupManager() *schema.Resource { Set: selfLinkRelativePathHash, }, - "target_size": &schema.Schema{ + "target_size": { Type: schema.TypeInt, Computed: true, Optional: true, }, - "auto_healing_policies": &schema.Schema{ + "auto_healing_policies": { Type: schema.TypeList, Optional: true, MaxItems: 1, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "health_check": &schema.Schema{ + "health_check": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "initial_delay_sec": &schema.Schema{ + "initial_delay_sec": { Type: schema.TypeInt, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", @@ -203,7 +203,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource { }, }, - "rolling_update_policy": &schema.Schema{ + "rolling_update_policy": { Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Computed: true, Type: schema.TypeList, @@ -211,48 +211,48 @@ func resourceComputeInstanceGroupManager() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "minimal_action": &schema.Schema{ + "minimal_action": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.StringInSlice([]string{"RESTART", "REPLACE"}, false), }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.StringInSlice([]string{"OPPORTUNISTIC", "PROACTIVE"}, false), }, - "max_surge_fixed": &schema.Schema{ + "max_surge_fixed": { Type: schema.TypeInt, Optional: true, Computed: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "max_surge_percent": &schema.Schema{ + "max_surge_percent": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.IntBetween(0, 100), }, - "max_unavailable_fixed": &schema.Schema{ + "max_unavailable_fixed": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "max_unavailable_percent": &schema.Schema{ + "max_unavailable_percent": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.IntBetween(0, 100), }, - "min_ready_sec": &schema.Schema{ + "min_ready_sec": { Type: schema.TypeInt, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Optional: true, @@ -262,7 +262,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource { }, }, - "wait_for_instances": &schema.Schema{ + "wait_for_instances": { Type: schema.TypeBool, Optional: true, Default: false, diff --git a/google/resource_compute_instance_group_test.go b/google/resource_compute_instance_group_test.go index cddc4b78..7e1cb899 100644 --- a/google/resource_compute_instance_group_test.go +++ b/google/resource_compute_instance_group_test.go @@ -176,7 +176,7 @@ func TestAccComputeInstanceGroup_network(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccComputeInstanceGroup_destroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceGroup_network(instanceName), Check: resource.ComposeTestCheckFunc( testAccComputeInstanceGroup_exists( diff --git a/google/resource_compute_instance_migrate.go b/google/resource_compute_instance_migrate.go index b69b4c4a..53c21321 100644 --- a/google/resource_compute_instance_migrate.go +++ b/google/resource_compute_instance_migrate.go @@ -283,7 +283,7 @@ func migrateStateV3toV4(is *terraform.InstanceState, meta interface{}) (*terrafo } } - for k, _ := range is.Attributes { + for k := range is.Attributes { if !strings.HasPrefix(k, "disk.") { continue } diff --git a/google/resource_compute_instance_template.go b/google/resource_compute_instance_template.go index 35fae365..d316005c 100644 --- a/google/resource_compute_instance_template.go +++ b/google/resource_compute_instance_template.go @@ -27,7 +27,7 @@ func resourceComputeInstanceTemplate() *schema.Resource { // instance. Please attempt to maintain consistency with the // resource_compute_instance schema when updating this one. Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, Computed: true, @@ -36,7 +36,7 @@ func resourceComputeInstanceTemplate() *schema.Resource { ValidateFunc: validateGCPName, }, - "name_prefix": &schema.Schema{ + "name_prefix": { Type: schema.TypeString, Optional: true, Computed: true, @@ -53,79 +53,79 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "disk": &schema.Schema{ + "disk": { Type: schema.TypeList, Required: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "auto_delete": &schema.Schema{ + "auto_delete": { Type: schema.TypeBool, Optional: true, Default: true, ForceNew: true, }, - "boot": &schema.Schema{ + "boot": { Type: schema.TypeBool, Optional: true, ForceNew: true, Computed: true, }, - "device_name": &schema.Schema{ + "device_name": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "disk_name": &schema.Schema{ + "disk_name": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "disk_size_gb": &schema.Schema{ + "disk_size_gb": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "disk_type": &schema.Schema{ + "disk_type": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "source_image": &schema.Schema{ + "source_image": { Type: schema.TypeString, Optional: true, Computed: true, }, - "interface": &schema.Schema{ + "interface": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -152,62 +152,62 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "machine_type": &schema.Schema{ + "machine_type": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "automatic_restart": &schema.Schema{ + "automatic_restart": { Type: schema.TypeBool, Optional: true, ForceNew: true, Removed: "Use 'scheduling.automatic_restart' instead.", }, - "can_ip_forward": &schema.Schema{ + "can_ip_forward": { Type: schema.TypeBool, Optional: true, Default: false, ForceNew: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "instance_description": &schema.Schema{ + "instance_description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "metadata": &schema.Schema{ + "metadata": { Type: schema.TypeMap, Optional: true, ForceNew: true, }, - "metadata_startup_script": &schema.Schema{ + "metadata_startup_script": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "metadata_fingerprint": &schema.Schema{ + "metadata_fingerprint": { Type: schema.TypeString, Computed: true, }, - "network_interface": &schema.Schema{ + "network_interface": { Type: schema.TypeList, Optional: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "network": &schema.Schema{ + "network": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -215,13 +215,13 @@ func resourceComputeInstanceTemplate() *schema.Resource { DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "network_ip": &schema.Schema{ + "network_ip": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "subnetwork": &schema.Schema{ + "subnetwork": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -229,32 +229,32 @@ func resourceComputeInstanceTemplate() *schema.Resource { DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "subnetwork_project": &schema.Schema{ + "subnetwork_project": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "access_config": &schema.Schema{ + "access_config": { Type: schema.TypeList, Optional: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "nat_ip": &schema.Schema{ + "nat_ip": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "network_tier": &schema.Schema{ + "network_tier": { Type: schema.TypeString, Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{"PREMIUM", "STANDARD"}, false), }, - "assigned_nat_ip": &schema.Schema{ + "assigned_nat_ip": { Type: schema.TypeString, Computed: true, Removed: "Use network_interface.access_config.nat_ip instead.", @@ -263,19 +263,19 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "alias_ip_range": &schema.Schema{ + "alias_ip_range": { Type: schema.TypeList, Optional: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ip_cidr_range": &schema.Schema{ + "ip_cidr_range": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: ipCidrRangeDiffSuppress, }, - "subnetwork_range_name": &schema.Schema{ + "subnetwork_range_name": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -284,7 +284,7 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Computed: true, Optional: true, @@ -294,49 +294,49 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "on_host_maintenance": &schema.Schema{ + "on_host_maintenance": { Type: schema.TypeString, Optional: true, ForceNew: true, Removed: "Use 'scheduling.on_host_maintenance' instead.", }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "scheduling": &schema.Schema{ + "scheduling": { Type: schema.TypeList, Optional: true, Computed: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "preemptible": &schema.Schema{ + "preemptible": { Type: schema.TypeBool, Optional: true, Default: false, ForceNew: true, }, - "automatic_restart": &schema.Schema{ + "automatic_restart": { Type: schema.TypeBool, Optional: true, Default: true, ForceNew: true, }, - "on_host_maintenance": &schema.Schema{ + "on_host_maintenance": { Type: schema.TypeString, Optional: true, Computed: true, @@ -346,26 +346,26 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "service_account": &schema.Schema{ + "service_account": { Type: schema.TypeList, MaxItems: 1, Optional: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "email": &schema.Schema{ + "email": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "scopes": &schema.Schema{ + "scopes": { Type: schema.TypeSet, Required: true, ForceNew: true, @@ -381,18 +381,18 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "guest_accelerator": &schema.Schema{ + "guest_accelerator": { Type: schema.TypeList, Optional: true, ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "count": &schema.Schema{ + "count": { Type: schema.TypeInt, Required: true, ForceNew: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -402,13 +402,13 @@ func resourceComputeInstanceTemplate() *schema.Resource { }, }, - "min_cpu_platform": &schema.Schema{ + "min_cpu_platform": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "tags": &schema.Schema{ + "tags": { Type: schema.TypeSet, Optional: true, ForceNew: true, @@ -416,12 +416,12 @@ func resourceComputeInstanceTemplate() *schema.Resource { Set: schema.HashString, }, - "tags_fingerprint": &schema.Schema{ + "tags_fingerprint": { Type: schema.TypeString, Computed: true, }, - "labels": &schema.Schema{ + "labels": { Type: schema.TypeMap, Optional: true, ForceNew: true, diff --git a/google/resource_compute_instance_template_test.go b/google/resource_compute_instance_template_test.go index 6c1f177e..7c8090fb 100644 --- a/google/resource_compute_instance_template_test.go +++ b/google/resource_compute_instance_template_test.go @@ -24,7 +24,7 @@ func TestAccComputeInstanceTemplate_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -34,7 +34,7 @@ func TestAccComputeInstanceTemplate_basic(t *testing.T) { testAccCheckComputeInstanceTemplateContainsLabel(&instanceTemplate, "my_label", "foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -53,14 +53,14 @@ func TestAccComputeInstanceTemplate_imageShorthand(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_imageShorthand(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( "google_compute_instance_template.foobar", &instanceTemplate), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -79,7 +79,7 @@ func TestAccComputeInstanceTemplate_preemptible(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_preemptible(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -88,7 +88,7 @@ func TestAccComputeInstanceTemplate_preemptible(t *testing.T) { testAccCheckComputeInstanceTemplatePreemptible(&instanceTemplate, true), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -107,7 +107,7 @@ func TestAccComputeInstanceTemplate_IP(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_ip(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -115,7 +115,7 @@ func TestAccComputeInstanceTemplate_IP(t *testing.T) { testAccCheckComputeInstanceTemplateNetwork(&instanceTemplate), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -132,10 +132,10 @@ func TestAccComputeInstanceTemplate_networkTier(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_networkTier(), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -155,7 +155,7 @@ func TestAccComputeInstanceTemplate_networkIP(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_networkIP(networkIP), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -165,7 +165,7 @@ func TestAccComputeInstanceTemplate_networkIP(t *testing.T) { "google_compute_instance_template.foobar", networkIP, &instanceTemplate), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -184,7 +184,7 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_networkIPAddress(ipAddress), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -194,7 +194,7 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) { "google_compute_instance_template.foobar", ipAddress, &instanceTemplate), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -211,10 +211,10 @@ func TestAccComputeInstanceTemplate_disks(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_disks(), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -231,10 +231,10 @@ func TestAccComputeInstanceTemplate_regionDisks(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_regionDisks(), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -254,7 +254,7 @@ func TestAccComputeInstanceTemplate_subnet_auto(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_subnet_auto(network), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -262,7 +262,7 @@ func TestAccComputeInstanceTemplate_subnet_auto(t *testing.T) { testAccCheckComputeInstanceTemplateNetworkName(&instanceTemplate, network), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -281,7 +281,7 @@ func TestAccComputeInstanceTemplate_subnet_custom(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_subnet_custom(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -289,7 +289,7 @@ func TestAccComputeInstanceTemplate_subnet_custom(t *testing.T) { testAccCheckComputeInstanceTemplateSubnetwork(&instanceTemplate), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -311,7 +311,7 @@ func TestAccComputeInstanceTemplate_subnet_xpn(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_subnet_xpn(org, billingId, projectName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExistsInProject( @@ -334,7 +334,7 @@ func TestAccComputeInstanceTemplate_metadata_startup_script(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_startup_script(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists( @@ -355,14 +355,14 @@ func TestAccComputeInstanceTemplate_primaryAliasIpRange(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_primaryAliasIpRange(acctest.RandString(10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasAliasIpRange(&instanceTemplate, "", "/24"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -381,14 +381,14 @@ func TestAccComputeInstanceTemplate_secondaryAliasIpRange(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_secondaryAliasIpRange(acctest.RandString(10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasAliasIpRange(&instanceTemplate, "inst-test-secondary", "/24"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -407,14 +407,14 @@ func TestAccComputeInstanceTemplate_guestAccelerator(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_guestAccelerator(acctest.RandString(10), 1), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasGuestAccelerator(&instanceTemplate, "nvidia-tesla-k80", 1), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -434,7 +434,7 @@ func TestAccComputeInstanceTemplate_guestAcceleratorSkip(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_guestAccelerator(acctest.RandString(10), 0), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate), @@ -456,14 +456,14 @@ func TestAccComputeInstanceTemplate_minCpuPlatform(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_minCpuPlatform(acctest.RandString(10)), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate), testAccCheckComputeInstanceTemplateHasMinCpuPlatform(&instanceTemplate, DEFAULT_MIN_CPU_TEST_VALUE), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, @@ -489,13 +489,13 @@ func TestAccComputeInstanceTemplate_EncryptKMS(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceTemplateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstanceTemplate_encryptionKMS(pid, pname, org, billingAccount, diskName, keyRingName, keyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate), ), }, - resource.TestStep{ + { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_instance_test.go b/google/resource_compute_instance_test.go index 34690170..273a97d5 100644 --- a/google/resource_compute_instance_test.go +++ b/google/resource_compute_instance_test.go @@ -39,7 +39,7 @@ func TestAccComputeInstance_basic1(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -72,7 +72,7 @@ func TestAccComputeInstance_basic2(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic2(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -97,7 +97,7 @@ func TestAccComputeInstance_basic3(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic3(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -122,7 +122,7 @@ func TestAccComputeInstance_basic4(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic4(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -147,7 +147,7 @@ func TestAccComputeInstance_basic5(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic5(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -173,7 +173,7 @@ func TestAccComputeInstance_IP(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_ip(ipName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -198,7 +198,7 @@ func TestAccComputeInstance_PTRRecord(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_PTRRecord(ptrName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -207,7 +207,7 @@ func TestAccComputeInstance_PTRRecord(t *testing.T) { ), }, computeInstanceImportStep("us-central1-a", instanceName, []string{"metadata.baz", "metadata.foo"}), - resource.TestStep{ + { Config: testAccComputeInstance_ip(ipName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -229,7 +229,7 @@ func TestAccComputeInstance_networkTier(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_networkTier(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -270,7 +270,7 @@ func TestAccComputeInstance_diskEncryption(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_disks_encryption(bootEncryptionKey, diskNameToEncryptionKey, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -294,7 +294,7 @@ func TestAccComputeInstance_attachedDisk(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_attachedDisk(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -319,7 +319,7 @@ func TestAccComputeInstance_attachedDisk_sourceUrl(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_attachedDisk_sourceUrl(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -344,7 +344,7 @@ func TestAccComputeInstance_attachedDisk_modeRo(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_attachedDisk_modeRo(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -370,7 +370,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_attachedDisk(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -379,7 +379,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) { ), }, // check attaching - resource.TestStep{ + { Config: testAccComputeInstance_addAttachedDisk(diskName, diskName2, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -389,7 +389,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) { ), }, // check detaching - resource.TestStep{ + { Config: testAccComputeInstance_detachDisk(diskName, diskName2, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -398,7 +398,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) { ), }, // check updating - resource.TestStep{ + { Config: testAccComputeInstance_updateAttachedDiskEncryptionKey(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -422,7 +422,7 @@ func TestAccComputeInstance_bootDisk_source(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_bootDisk_source(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -447,7 +447,7 @@ func TestAccComputeInstance_bootDisk_sourceUrl(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_bootDisk_sourceUrl(diskName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -472,7 +472,7 @@ func TestAccComputeInstance_bootDisk_type(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_bootDisk_type(instanceName, diskType), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -495,7 +495,7 @@ func TestAccComputeInstance_scratchDisk(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_scratchDisk(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -519,14 +519,14 @@ func TestAccComputeInstance_forceNewAndChangeMetadata(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( "google_compute_instance.foobar", &instance), ), }, - resource.TestStep{ + { Config: testAccComputeInstance_forceNewAndChangeMetadata(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -550,14 +550,14 @@ func TestAccComputeInstance_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( "google_compute_instance.foobar", &instance), ), }, - resource.TestStep{ + { Config: testAccComputeInstance_update(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -585,7 +585,7 @@ func TestAccComputeInstance_stopInstanceToUpdate(t *testing.T) { CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ // Set fields that require stopping the instance - resource.TestStep{ + { Config: testAccComputeInstance_stopInstanceToUpdate(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -594,7 +594,7 @@ func TestAccComputeInstance_stopInstanceToUpdate(t *testing.T) { }, computeInstanceImportStep("us-central1-a", instanceName, []string{"allow_stopping_for_update"}), // Check that updating them works - resource.TestStep{ + { Config: testAccComputeInstance_stopInstanceToUpdate2(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -603,7 +603,7 @@ func TestAccComputeInstance_stopInstanceToUpdate(t *testing.T) { }, computeInstanceImportStep("us-central1-a", instanceName, []string{"allow_stopping_for_update"}), // Check that removing them works - resource.TestStep{ + { Config: testAccComputeInstance_stopInstanceToUpdate3(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -626,7 +626,7 @@ func TestAccComputeInstance_service_account(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_service_account(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -655,7 +655,7 @@ func TestAccComputeInstance_scheduling(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_scheduling(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -678,7 +678,7 @@ func TestAccComputeInstance_subnet_auto(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_subnet_auto(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -702,7 +702,7 @@ func TestAccComputeInstance_subnet_custom(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_subnet_custom(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -729,7 +729,7 @@ func TestAccComputeInstance_subnet_xpn(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_subnet_xpn(org, billingId, projectName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExistsInProject( @@ -753,7 +753,7 @@ func TestAccComputeInstance_networkIPAuto(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_networkIPAuto(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -776,7 +776,7 @@ func TestAccComputeInstance_network_ip_custom(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_network_ip_custom(instanceName, ipAddress), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -801,7 +801,7 @@ func TestAccComputeInstance_private_image_family(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_private_image_family(diskName, familyName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -823,7 +823,7 @@ func TestAccComputeInstance_forceChangeMachineTypeManually(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -849,7 +849,7 @@ func TestAccComputeInstance_multiNic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_multiNic(instanceName, networkName, subnetworkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -872,7 +872,7 @@ func TestAccComputeInstance_guestAccelerator(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_guestAccelerator(instanceName, 1), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -896,7 +896,7 @@ func TestAccComputeInstance_guestAcceleratorSkip(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_guestAccelerator(instanceName, 0), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -919,7 +919,7 @@ func TestAccComputeInstance_minCpuPlatform(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_minCpuPlatform(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -942,7 +942,7 @@ func TestAccComputeInstance_deletionProtectionExplicitFalse(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic_deletionProtectionFalse(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -965,7 +965,7 @@ func TestAccComputeInstance_deletionProtectionExplicitTrueAndUpdateFalse(t *test Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_basic_deletionProtectionTrue(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -975,7 +975,7 @@ func TestAccComputeInstance_deletionProtectionExplicitTrueAndUpdateFalse(t *test }, computeInstanceImportStep("us-central1-a", instanceName, []string{"metadata.foo"}), // Update deletion_protection to false, otherwise the test harness can't delete the instance - resource.TestStep{ + { Config: testAccComputeInstance_basic_deletionProtectionFalse(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists( @@ -998,7 +998,7 @@ func TestAccComputeInstance_primaryAliasIpRange(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_primaryAliasIpRange(instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -1023,7 +1023,7 @@ func TestAccComputeInstance_secondaryAliasIpRange(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeInstance_secondaryAliasIpRange(networkName, subnetName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -1031,7 +1031,7 @@ func TestAccComputeInstance_secondaryAliasIpRange(t *testing.T) { ), }, computeInstanceImportStep("us-east1-d", instanceName, []string{}), - resource.TestStep{ + { Config: testAccComputeInstance_secondaryAliasIpRangeUpdate(networkName, subnetName, instanceName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance), @@ -1908,7 +1908,7 @@ resource "google_compute_instance" "foobar" { func testAccComputeInstance_disks_encryption(bootEncryptionKey string, diskNameToEncryptionKey map[string]*compute.CustomerEncryptionKey, instance string) string { diskNames := []string{} - for k, _ := range diskNameToEncryptionKey { + for k := range diskNameToEncryptionKey { diskNames = append(diskNames, k) } return fmt.Sprintf(` diff --git a/google/resource_compute_network.go b/google/resource_compute_network.go index c30054e9..241bf7e5 100644 --- a/google/resource_compute_network.go +++ b/google/resource_compute_network.go @@ -19,37 +19,37 @@ func resourceComputeNetwork() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "auto_create_subnetworks": &schema.Schema{ + "auto_create_subnetworks": { Type: schema.TypeBool, Optional: true, ForceNew: true, Default: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "routing_mode": &schema.Schema{ + "routing_mode": { Type: schema.TypeString, Optional: true, Computed: true, }, - "gateway_ipv4": &schema.Schema{ + "gateway_ipv4": { Type: schema.TypeString, Computed: true, }, - "ipv4_range": &schema.Schema{ + "ipv4_range": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -57,14 +57,14 @@ func resourceComputeNetwork() *schema.Resource { Deprecated: "Please use google_compute_subnetwork resources instead.", }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_compute_network_peering.go b/google/resource_compute_network_peering.go index bbb2dc7b..288d3a5f 100644 --- a/google/resource_compute_network_peering.go +++ b/google/resource_compute_network_peering.go @@ -19,37 +19,37 @@ func resourceComputeNetworkPeering() *schema.Resource { Delete: resourceComputeNetworkPeeringDelete, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateGCPName, }, - "network": &schema.Schema{ + "network": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateRegexp(peerNetworkLinkRegex), DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "peer_network": &schema.Schema{ + "peer_network": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateRegexp(peerNetworkLinkRegex), DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "auto_create_routes": &schema.Schema{ + "auto_create_routes": { Type: schema.TypeBool, ForceNew: true, Optional: true, Default: true, }, - "state": &schema.Schema{ + "state": { Type: schema.TypeString, Computed: true, }, - "state_details": &schema.Schema{ + "state_details": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_compute_network_peering_test.go b/google/resource_compute_network_peering_test.go index 14accde2..2ac126f1 100644 --- a/google/resource_compute_network_peering_test.go +++ b/google/resource_compute_network_peering_test.go @@ -20,7 +20,7 @@ func TestAccComputeNetworkPeering_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccComputeNetworkPeeringDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeNetworkPeering_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkPeeringExist("google_compute_network_peering.foo", &peering), diff --git a/google/resource_compute_network_test.go b/google/resource_compute_network_test.go index 56ae6320..830e9ad9 100644 --- a/google/resource_compute_network_test.go +++ b/google/resource_compute_network_test.go @@ -20,14 +20,14 @@ func TestAccComputeNetwork_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeNetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeNetwork_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( "google_compute_network.foobar", &network), ), }, - resource.TestStep{ + { ResourceName: "google_compute_network.foobar", ImportState: true, ImportStateVerify: true, @@ -46,7 +46,7 @@ func TestAccComputeNetwork_auto_subnet(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeNetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeNetwork_auto_subnet(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( @@ -55,7 +55,7 @@ func TestAccComputeNetwork_auto_subnet(t *testing.T) { "google_compute_network.bar", &network), ), }, - resource.TestStep{ + { ResourceName: "google_compute_network.bar", ImportState: true, ImportStateVerify: true, @@ -74,7 +74,7 @@ func TestAccComputeNetwork_custom_subnet(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeNetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeNetwork_custom_subnet(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( @@ -83,7 +83,7 @@ func TestAccComputeNetwork_custom_subnet(t *testing.T) { "google_compute_network.baz", &network), ), }, - resource.TestStep{ + { ResourceName: "google_compute_network.baz", ImportState: true, ImportStateVerify: true, @@ -102,7 +102,7 @@ func TestAccComputeNetwork_routing_mode(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeNetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeNetwork_routing_mode("GLOBAL"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( @@ -112,7 +112,7 @@ func TestAccComputeNetwork_routing_mode(t *testing.T) { ), }, // Test updating the routing field (only updateable field). - resource.TestStep{ + { Config: testAccComputeNetwork_routing_mode("REGIONAL"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( @@ -137,7 +137,7 @@ func TestAccComputeNetwork_default_routing_mode(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeNetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeNetwork_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( diff --git a/google/resource_compute_project_metadata.go b/google/resource_compute_project_metadata.go index 1a934db8..68ea8c4a 100644 --- a/google/resource_compute_project_metadata.go +++ b/google/resource_compute_project_metadata.go @@ -21,13 +21,13 @@ func resourceComputeProjectMetadata() *schema.Resource { SchemaVersion: 0, Schema: map[string]*schema.Schema{ - "metadata": &schema.Schema{ + "metadata": { Type: schema.TypeMap, Required: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_compute_project_metadata_test.go b/google/resource_compute_project_metadata_test.go index f61cf746..17f9db8d 100644 --- a/google/resource_compute_project_metadata_test.go +++ b/google/resource_compute_project_metadata_test.go @@ -22,10 +22,10 @@ func TestAccComputeProjectMetadata_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeProjectMetadataDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeProject_basic0_metadata(projectID, pname, org, billingId), }, - resource.TestStep{ + { ResourceName: "google_compute_project_metadata.fizzbuzz", ImportState: true, ImportStateVerify: true, @@ -47,19 +47,19 @@ func TestAccComputeProjectMetadata_modify_1(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeProjectMetadataDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeProject_modify0_metadata(projectID, pname, org, billingId), }, - resource.TestStep{ + { ResourceName: "google_compute_project_metadata.fizzbuzz", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeProject_modify1_metadata(projectID, pname, org, billingId), }, - resource.TestStep{ + { ResourceName: "google_compute_project_metadata.fizzbuzz", ImportState: true, ImportStateVerify: true, @@ -81,19 +81,19 @@ func TestAccComputeProjectMetadata_modify_2(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeProjectMetadataDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeProject_basic0_metadata(projectID, pname, org, billingId), }, - resource.TestStep{ + { ResourceName: "google_compute_project_metadata.fizzbuzz", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeProject_basic1_metadata(projectID, pname, org, billingId), }, - resource.TestStep{ + { ResourceName: "google_compute_project_metadata.fizzbuzz", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_region_autoscaler_test.go b/google/resource_compute_region_autoscaler_test.go index 48e7950c..282f4cca 100644 --- a/google/resource_compute_region_autoscaler_test.go +++ b/google/resource_compute_region_autoscaler_test.go @@ -24,14 +24,14 @@ func TestAccComputeRegionAutoscaler_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionAutoscalerExists( "google_compute_region_autoscaler.foobar", &ascaler), ), }, - resource.TestStep{ + { ResourceName: "google_compute_region_autoscaler.foobar", ImportState: true, ImportStateVerify: true, @@ -53,14 +53,14 @@ func TestAccComputeRegionAutoscaler_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionAutoscalerExists( "google_compute_region_autoscaler.foobar", &ascaler), ), }, - resource.TestStep{ + { Config: testAccComputeRegionAutoscaler_update(it_name, tp_name, igm_name, autoscaler_name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionAutoscalerExists( diff --git a/google/resource_compute_region_backend_service.go b/google/resource_compute_region_backend_service.go index 376b08d8..b0393db8 100644 --- a/google/resource_compute_region_backend_service.go +++ b/google/resource_compute_region_backend_service.go @@ -19,14 +19,14 @@ func resourceComputeRegionBackendService() *schema.Resource { Delete: resourceComputeRegionBackendServiceDelete, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateGCPName, }, - "health_checks": &schema.Schema{ + "health_checks": { Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, @@ -35,16 +35,16 @@ func resourceComputeRegionBackendService() *schema.Resource { MaxItems: 1, }, - "backend": &schema.Schema{ + "backend": { Type: schema.TypeSet, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "group": &schema.Schema{ + "group": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, @@ -54,54 +54,54 @@ func resourceComputeRegionBackendService() *schema.Resource { Set: resourceGoogleComputeRegionBackendServiceBackendHash, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "fingerprint": &schema.Schema{ + "fingerprint": { Type: schema.TypeString, Computed: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "protocol": &schema.Schema{ + "protocol": { Type: schema.TypeString, Optional: true, Computed: true, }, - "session_affinity": &schema.Schema{ + "session_affinity": { Type: schema.TypeString, Optional: true, Computed: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "timeout_sec": &schema.Schema{ + "timeout_sec": { Type: schema.TypeInt, Optional: true, Computed: true, }, - "connection_draining_timeout_sec": &schema.Schema{ + "connection_draining_timeout_sec": { Type: schema.TypeInt, Optional: true, Default: 0, diff --git a/google/resource_compute_region_backend_service_test.go b/google/resource_compute_region_backend_service_test.go index bde3198c..c9358174 100644 --- a/google/resource_compute_region_backend_service_test.go +++ b/google/resource_compute_region_backend_service_test.go @@ -23,14 +23,14 @@ func TestAccComputeRegionBackendService_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionBackendService_basic(serviceName, checkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionBackendServiceExists( "google_compute_region_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeRegionBackendService_basicModified( serviceName, checkName, extraCheckName), Check: resource.ComposeTestCheckFunc( @@ -55,7 +55,7 @@ func TestAccComputeRegionBackendService_withBackend(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionBackendService_withBackend( serviceName, igName, itName, checkName, 10), Check: resource.ComposeTestCheckFunc( @@ -90,7 +90,7 @@ func TestAccComputeRegionBackendService_withBackendAndUpdate(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionBackendService_withBackend( serviceName, igName, itName, checkName, 10), Check: resource.ComposeTestCheckFunc( @@ -98,7 +98,7 @@ func TestAccComputeRegionBackendService_withBackendAndUpdate(t *testing.T) { "google_compute_region_backend_service.lipsum", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeRegionBackendService_withBackend( serviceName, igName, itName, checkName, 20), Check: resource.ComposeTestCheckFunc( @@ -132,7 +132,7 @@ func TestAccComputeRegionBackendService_withConnectionDraining(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionBackendService_withConnectionDraining(serviceName, checkName, 10), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionBackendServiceExists( @@ -159,14 +159,14 @@ func TestAccComputeRegionBackendService_withConnectionDrainingAndUpdate(t *testi Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionBackendService_withConnectionDraining(serviceName, checkName, 10), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionBackendServiceExists( "google_compute_region_backend_service.foobar", &svc), ), }, - resource.TestStep{ + { Config: testAccComputeRegionBackendService_basic(serviceName, checkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionBackendServiceExists( @@ -193,7 +193,7 @@ func TestAccComputeRegionBackendService_withSessionAffinity(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionBackendService_withSessionAffinity( serviceName, checkName), Check: resource.ComposeTestCheckFunc( diff --git a/google/resource_compute_region_disk_test.go b/google/resource_compute_region_disk_test.go index b7e4d4ff..1dd60889 100644 --- a/google/resource_compute_region_disk_test.go +++ b/google/resource_compute_region_disk_test.go @@ -23,26 +23,26 @@ func TestAccComputeRegionDisk_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionDisk_basic(diskName, "self_link"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( "google_compute_region_disk.regiondisk", &disk), ), }, - resource.TestStep{ + { ResourceName: "google_compute_region_disk.regiondisk", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeRegionDisk_basic(diskName, "name"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( "google_compute_region_disk.regiondisk", &disk), ), }, - resource.TestStep{ + { ResourceName: "google_compute_region_disk.regiondisk", ImportState: true, ImportStateVerify: true, @@ -63,19 +63,19 @@ func TestAccComputeRegionDisk_basicUpdate(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionDisk_basic(diskName, "self_link"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( "google_compute_region_disk.regiondisk", &disk), ), }, - resource.TestStep{ + { ResourceName: "google_compute_region_disk.regiondisk", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeRegionDisk_basicUpdated(diskName, "self_link"), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( @@ -86,7 +86,7 @@ func TestAccComputeRegionDisk_basicUpdate(t *testing.T) { testAccCheckComputeRegionDiskHasLabelFingerprint(&disk, "google_compute_region_disk.regiondisk"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_region_disk.regiondisk", ImportState: true, ImportStateVerify: true, @@ -106,7 +106,7 @@ func TestAccComputeRegionDisk_encryption(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionDisk_encryption(diskName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( @@ -133,7 +133,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRegionDiskDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( @@ -144,7 +144,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) { // listed as attached to the disk; the instance is created after the // disk. and the disk's properties aren't refreshed unless there's // another step - resource.TestStep{ + { Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( @@ -154,7 +154,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) { ), }, // Change the disk name to destroy it, which detaches it from the instance - resource.TestStep{ + { Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName2), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( @@ -162,7 +162,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) { ), }, // Add the extra step like before - resource.TestStep{ + { Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName2), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRegionDiskExists( diff --git a/google/resource_compute_region_instance_group_manager.go b/google/resource_compute_region_instance_group_manager.go index 06bbdaf4..7751ab53 100644 --- a/google/resource_compute_region_instance_group_manager.go +++ b/google/resource_compute_region_instance_group_manager.go @@ -36,52 +36,52 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "base_instance_name": &schema.Schema{ + "base_instance_name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "instance_template": &schema.Schema{ + "instance_template": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "version": &schema.Schema{ + "version": { Type: schema.TypeList, Optional: true, Computed: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "instance_template": &schema.Schema{ + "instance_template": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "target_size": &schema.Schema{ + "target_size": { Type: schema.TypeList, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "fixed": &schema.Schema{ + "fixed": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "percent": &schema.Schema{ + "percent": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", @@ -94,45 +94,45 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "fingerprint": &schema.Schema{ + "fingerprint": { Type: schema.TypeString, Computed: true, }, - "instance_group": &schema.Schema{ + "instance_group": { Type: schema.TypeString, Computed: true, }, - "named_port": &schema.Schema{ + "named_port": { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "port": &schema.Schema{ + "port": { Type: schema.TypeInt, Required: true, }, @@ -140,26 +140,26 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "update_strategy": &schema.Schema{ + "update_strategy": { Type: schema.TypeString, Deprecated: "This field is removed.", Optional: true, Computed: true, }, - "target_pools": &schema.Schema{ + "target_pools": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{ @@ -167,7 +167,7 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { }, Set: selfLinkRelativePathHash, }, - "target_size": &schema.Schema{ + "target_size": { Type: schema.TypeInt, Computed: true, Optional: true, @@ -176,27 +176,27 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { // If true, the resource will report ready only after no instances are being created. // This will not block future reads if instances are being recreated, and it respects // the "createNoRetry" parameter that's available for this resource. - "wait_for_instances": &schema.Schema{ + "wait_for_instances": { Type: schema.TypeBool, Optional: true, Default: false, }, - "auto_healing_policies": &schema.Schema{ + "auto_healing_policies": { Type: schema.TypeList, Optional: true, MaxItems: 1, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "health_check": &schema.Schema{ + "health_check": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", DiffSuppressFunc: compareSelfLinkRelativePaths, }, - "initial_delay_sec": &schema.Schema{ + "initial_delay_sec": { Type: schema.TypeInt, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", @@ -206,7 +206,7 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, - "distribution_policy_zones": &schema.Schema{ + "distribution_policy_zones": { Type: schema.TypeSet, Optional: true, ForceNew: true, @@ -218,7 +218,7 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, - "rolling_update_policy": &schema.Schema{ + "rolling_update_policy": { Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Computed: true, Type: schema.TypeList, @@ -226,48 +226,48 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "minimal_action": &schema.Schema{ + "minimal_action": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.StringInSlice([]string{"RESTART", "REPLACE"}, false), }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.StringInSlice([]string{"OPPORTUNISTIC", "PROACTIVE"}, false), }, - "max_surge_fixed": &schema.Schema{ + "max_surge_fixed": { Type: schema.TypeInt, Optional: true, Computed: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "max_surge_percent": &schema.Schema{ + "max_surge_percent": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.IntBetween(0, 100), }, - "max_unavailable_fixed": &schema.Schema{ + "max_unavailable_fixed": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", }, - "max_unavailable_percent": &schema.Schema{ + "max_unavailable_percent": { Type: schema.TypeInt, Optional: true, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", ValidateFunc: validation.IntBetween(0, 100), }, - "min_ready_sec": &schema.Schema{ + "min_ready_sec": { Type: schema.TypeInt, Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Optional: true, diff --git a/google/resource_compute_region_instance_group_manager_test.go b/google/resource_compute_region_instance_group_manager_test.go index 313c4bcf..43886aaf 100644 --- a/google/resource_compute_region_instance_group_manager_test.go +++ b/google/resource_compute_region_instance_group_manager_test.go @@ -139,7 +139,7 @@ func TestAccRegionInstanceGroupManager_updateStrategy(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckInstanceGroupManagerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRegionInstanceGroupManager_updateStrategy(igm), }, { diff --git a/google/resource_compute_route.go b/google/resource_compute_route.go index 67ad712b..1a88536e 100644 --- a/google/resource_compute_route.go +++ b/google/resource_compute_route.go @@ -104,7 +104,7 @@ func resourceComputeRoute() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "next_hop_instance_zone": &schema.Schema{ + "next_hop_instance_zone": { Type: schema.TypeString, Optional: true, ForceNew: true, diff --git a/google/resource_compute_route_test.go b/google/resource_compute_route_test.go index 0b91a951..d90b8cad 100644 --- a/google/resource_compute_route_test.go +++ b/google/resource_compute_route_test.go @@ -21,7 +21,7 @@ func TestAccComputeRoute_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouteDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRoute_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRouteExists( @@ -30,7 +30,7 @@ func TestAccComputeRoute_basic(t *testing.T) { "google_compute_route.foobar", "description", regexp.MustCompile("This is a route")), ), }, - resource.TestStep{ + { ResourceName: "google_compute_route.foobar", ImportState: true, ImportStateVerify: true, @@ -49,14 +49,14 @@ func TestAccComputeRoute_defaultInternetGateway(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouteDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRoute_defaultInternetGateway(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRouteExists( "google_compute_route.foobar", &route), ), }, - resource.TestStep{ + { ResourceName: "google_compute_route.foobar", ImportState: true, ImportStateVerify: true, @@ -77,7 +77,7 @@ func TestAccComputeRoute_hopInstance(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouteDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRoute_hopInstance(instanceName, zone), Check: resource.ComposeTestCheckFunc( testAccCheckComputeRouteExists( @@ -86,7 +86,7 @@ func TestAccComputeRoute_hopInstance(t *testing.T) { resource.TestMatchResourceAttr("google_compute_route.foobar", "next_hop_instance", instanceNameRegexp), ), }, - resource.TestStep{ + { ResourceName: "google_compute_route.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_router_interface.go b/google/resource_compute_router_interface.go index 4e6151b6..c7e55d21 100644 --- a/google/resource_compute_router_interface.go +++ b/google/resource_compute_router_interface.go @@ -21,36 +21,36 @@ func resourceComputeRouterInterface() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "router": &schema.Schema{ + "router": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "vpn_tunnel": &schema.Schema{ + "vpn_tunnel": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: linkDiffSuppress, }, - "ip_range": &schema.Schema{ + "ip_range": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_compute_router_interface_test.go b/google/resource_compute_router_interface_test.go index ca383b21..c284d2c9 100644 --- a/google/resource_compute_router_interface_test.go +++ b/google/resource_compute_router_interface_test.go @@ -18,17 +18,17 @@ func TestAccComputeRouterInterface_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterInterfaceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterInterfaceBasic(testId), Check: testAccCheckComputeRouterInterfaceExists( "google_compute_router_interface.foobar"), }, - resource.TestStep{ + { ResourceName: "google_compute_router_interface.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeRouterInterfaceKeepRouter(testId), Check: testAccCheckComputeRouterInterfaceDelete( "google_compute_router_interface.foobar"), diff --git a/google/resource_compute_router_nat.go b/google/resource_compute_router_nat.go index bc45b8de..b55eec12 100644 --- a/google/resource_compute_router_nat.go +++ b/google/resource_compute_router_nat.go @@ -17,18 +17,18 @@ import ( var ( routerNatSubnetworkConfig = &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "source_ip_ranges_to_nat": &schema.Schema{ + "source_ip_ranges_to_nat": { Type: schema.TypeSet, Optional: true, ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "secondary_ip_range_names": &schema.Schema{ + "secondary_ip_range_names": { Type: schema.TypeSet, Optional: true, ForceNew: true, @@ -54,73 +54,73 @@ func resourceComputeRouterNat() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateRFC1035Name(2, 63), }, - "router": &schema.Schema{ + "router": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "nat_ip_allocate_option": &schema.Schema{ + "nat_ip_allocate_option": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"MANUAL_ONLY", "AUTO_ONLY"}, false), }, - "nat_ips": &schema.Schema{ + "nat_ips": { Type: schema.TypeSet, Optional: true, ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "source_subnetwork_ip_ranges_to_nat": &schema.Schema{ + "source_subnetwork_ip_ranges_to_nat": { Type: schema.TypeString, Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"ALL_SUBNETWORKS_ALL_IP_RANGES", "ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES", "LIST_OF_SUBNETWORKS"}, false), }, - "subnetwork": &schema.Schema{ + "subnetwork": { Type: schema.TypeSet, Optional: true, ForceNew: true, Elem: routerNatSubnetworkConfig, }, - "min_ports_per_vm": &schema.Schema{ + "min_ports_per_vm": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "udp_idle_timeout_sec": &schema.Schema{ + "udp_idle_timeout_sec": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "icmp_idle_timeout_sec": &schema.Schema{ + "icmp_idle_timeout_sec": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "tcp_established_idle_timeout_sec": &schema.Schema{ + "tcp_established_idle_timeout_sec": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "tcp_transitory_idle_timeout_sec": &schema.Schema{ + "tcp_transitory_idle_timeout_sec": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_compute_router_nat_test.go b/google/resource_compute_router_nat_test.go index 3a728cb9..09b108a5 100644 --- a/google/resource_compute_router_nat_test.go +++ b/google/resource_compute_router_nat_test.go @@ -18,15 +18,15 @@ func TestAccComputeRouterNat_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterNatDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterNatBasic(testId), }, - resource.TestStep{ + { ResourceName: "google_compute_router_nat.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeRouterNatKeepRouter(testId), Check: testAccCheckComputeRouterNatDelete( "google_compute_router_nat.foobar"), @@ -44,10 +44,10 @@ func TestAccComputeRouterNat_withManualIpAndSubnetConfiguration(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterNatDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterNatWithManualIpAndSubnetConfiguration(testId), }, - resource.TestStep{ + { ResourceName: "google_compute_router_nat.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_router_peer.go b/google/resource_compute_router_peer.go index c3212709..3f3afd0c 100644 --- a/google/resource_compute_router_peer.go +++ b/google/resource_compute_router_peer.go @@ -21,53 +21,53 @@ func resourceComputeRouterPeer() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "router": &schema.Schema{ + "router": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "interface": &schema.Schema{ + "interface": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "peer_ip_address": &schema.Schema{ + "peer_ip_address": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "peer_asn": &schema.Schema{ + "peer_asn": { Type: schema.TypeInt, Required: true, ForceNew: true, }, - "advertised_route_priority": &schema.Schema{ + "advertised_route_priority": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "ip_address": &schema.Schema{ + "ip_address": { Type: schema.TypeString, Computed: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_compute_router_peer_test.go b/google/resource_compute_router_peer_test.go index 04c89f6d..89ea3a96 100644 --- a/google/resource_compute_router_peer_test.go +++ b/google/resource_compute_router_peer_test.go @@ -18,17 +18,17 @@ func TestAccComputeRouterPeer_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterPeerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterPeerBasic(testId), Check: testAccCheckComputeRouterPeerExists( "google_compute_router_peer.foobar"), }, - resource.TestStep{ + { ResourceName: "google_compute_router_peer.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeRouterPeerKeepRouter(testId), Check: testAccCheckComputeRouterPeerDelete( "google_compute_router_peer.foobar"), diff --git a/google/resource_compute_router_test.go b/google/resource_compute_router_test.go index adaeb3e0..95280101 100644 --- a/google/resource_compute_router_test.go +++ b/google/resource_compute_router_test.go @@ -18,10 +18,10 @@ func TestAccComputeRouter_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterBasic(testId, resourceRegion), }, - resource.TestStep{ + { ResourceName: "google_compute_router.foobar", ImportState: true, ImportStateVerify: true, @@ -40,10 +40,10 @@ func TestAccComputeRouter_noRegion(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterNoRegion(testId, providerRegion), }, - resource.TestStep{ + { ResourceName: "google_compute_router.foobar", ImportState: true, ImportStateVerify: true, @@ -61,10 +61,10 @@ func TestAccComputeRouter_full(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterFull(testId), }, - resource.TestStep{ + { ResourceName: "google_compute_router.foobar", ImportState: true, ImportStateVerify: true, @@ -83,26 +83,26 @@ func TestAccComputeRouter_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeRouterDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeRouterBasic(testId, region), }, - resource.TestStep{ + { ResourceName: "google_compute_router.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeRouterFull(testId), }, - resource.TestStep{ + { ResourceName: "google_compute_router.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeRouterBasic(testId, region), }, - resource.TestStep{ + { ResourceName: "google_compute_router.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_security_policy.go b/google/resource_compute_security_policy.go index ff7318df..686c6142 100644 --- a/google/resource_compute_security_policy.go +++ b/google/resource_compute_security_policy.go @@ -29,55 +29,55 @@ func resourceComputeSecurityPolicy() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateGCPName, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "rule": &schema.Schema{ + "rule": { Type: schema.TypeSet, Optional: true, Computed: true, // If no rules are set, a default rule is added Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": &schema.Schema{ + "action": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{"allow", "deny(403)", "deny(404)", "deny(502)"}, false), }, - "priority": &schema.Schema{ + "priority": { Type: schema.TypeInt, Required: true, }, - "match": &schema.Schema{ + "match": { Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "config": &schema.Schema{ + "config": { Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "src_ip_ranges": &schema.Schema{ + "src_ip_ranges": { Type: schema.TypeSet, Required: true, MinItems: 1, @@ -88,7 +88,7 @@ func resourceComputeSecurityPolicy() *schema.Resource { }, }, - "versioned_expr": &schema.Schema{ + "versioned_expr": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{"SRC_IPS_V1"}, false), @@ -97,12 +97,12 @@ func resourceComputeSecurityPolicy() *schema.Resource { }, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "preview": &schema.Schema{ + "preview": { Type: schema.TypeBool, Optional: true, }, @@ -110,12 +110,12 @@ func resourceComputeSecurityPolicy() *schema.Resource { }, }, - "fingerprint": &schema.Schema{ + "fingerprint": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_compute_security_policy_test.go b/google/resource_compute_security_policy_test.go index e1d6834e..efd980e6 100644 --- a/google/resource_compute_security_policy_test.go +++ b/google/resource_compute_security_policy_test.go @@ -19,10 +19,10 @@ func TestAccComputeSecurityPolicy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSecurityPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSecurityPolicy_basic(spName), }, - resource.TestStep{ + { ResourceName: "google_compute_security_policy.policy", ImportState: true, ImportStateVerify: true, @@ -41,10 +41,10 @@ func TestAccComputeSecurityPolicy_withRule(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSecurityPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSecurityPolicy_withRule(spName), }, - resource.TestStep{ + { ResourceName: "google_compute_security_policy.policy", ImportState: true, ImportStateVerify: true, @@ -63,28 +63,28 @@ func TestAccComputeSecurityPolicy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSecurityPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSecurityPolicy_withRule(spName), }, - resource.TestStep{ + { ResourceName: "google_compute_security_policy.policy", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeSecurityPolicy_update(spName), }, - resource.TestStep{ + { ResourceName: "google_compute_security_policy.policy", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeSecurityPolicy_withRule(spName), }, - resource.TestStep{ + { ResourceName: "google_compute_security_policy.policy", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_shared_vpc_host_project.go b/google/resource_compute_shared_vpc_host_project.go index 07f00857..413e6f27 100644 --- a/google/resource_compute_shared_vpc_host_project.go +++ b/google/resource_compute_shared_vpc_host_project.go @@ -17,7 +17,7 @@ func resourceComputeSharedVpcHostProject() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Required: true, ForceNew: true, diff --git a/google/resource_compute_shared_vpc_service_project.go b/google/resource_compute_shared_vpc_service_project.go index 8ddba80e..c56560ab 100644 --- a/google/resource_compute_shared_vpc_service_project.go +++ b/google/resource_compute_shared_vpc_service_project.go @@ -22,12 +22,12 @@ func resourceComputeSharedVpcServiceProject() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "host_project": &schema.Schema{ + "host_project": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "service_project": &schema.Schema{ + "service_project": { Type: schema.TypeString, Required: true, ForceNew: true, diff --git a/google/resource_compute_shared_vpc_test.go b/google/resource_compute_shared_vpc_test.go index 6c31dcdd..b6629989 100644 --- a/google/resource_compute_shared_vpc_test.go +++ b/google/resource_compute_shared_vpc_test.go @@ -23,7 +23,7 @@ func TestAccComputeSharedVpc_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSharedVpc_basic(hostProject, serviceProject, org, billingId), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSharedVpcHostProject(hostProject, true), @@ -31,18 +31,18 @@ func TestAccComputeSharedVpc_basic(t *testing.T) { ), }, // Test import. - resource.TestStep{ + { ResourceName: hostProjectResourceName, ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: serviceProjectResourceName, ImportState: true, ImportStateVerify: true, }, // Use a separate TestStep rather than a CheckDestroy because we need the project to still exist. - resource.TestStep{ + { Config: testAccComputeSharedVpc_disabled(hostProject, serviceProject, org, billingId), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSharedVpcHostProject(hostProject, false), diff --git a/google/resource_compute_ssl_certificate_test.go b/google/resource_compute_ssl_certificate_test.go index 6add6288..bddd9ed0 100644 --- a/google/resource_compute_ssl_certificate_test.go +++ b/google/resource_compute_ssl_certificate_test.go @@ -17,14 +17,14 @@ func TestAccComputeSslCertificate_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslCertificateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslCertificate_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslCertificateExists( "google_compute_ssl_certificate.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_certificate.foobar", ImportState: true, ImportStateVerify: true, @@ -42,14 +42,14 @@ func TestAccComputeSslCertificate_no_name(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslCertificateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslCertificate_no_name(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslCertificateExists( "google_compute_ssl_certificate.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_certificate.foobar", ImportState: true, ImportStateVerify: true, @@ -67,14 +67,14 @@ func TestAccComputeSslCertificate_name_prefix(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslCertificateDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslCertificate_name_prefix(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslCertificateExists( "google_compute_ssl_certificate.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_certificate.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_ssl_policy_test.go b/google/resource_compute_ssl_policy_test.go index 3daa97d8..5763aa98 100644 --- a/google/resource_compute_ssl_policy_test.go +++ b/google/resource_compute_ssl_policy_test.go @@ -21,7 +21,7 @@ func TestAccComputeSslPolicy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslPolicyBasic(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -33,7 +33,7 @@ func TestAccComputeSslPolicy_basic(t *testing.T) { "google_compute_ssl_policy.basic", "min_tls_version", "TLS_1_0"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.basic", ImportState: true, ImportStateVerify: true, @@ -53,7 +53,7 @@ func TestAccComputeSslPolicy_profile(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslPolicyProfile(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -62,7 +62,7 @@ func TestAccComputeSslPolicy_profile(t *testing.T) { "google_compute_ssl_policy.profile", "profile", "MODERN"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.profile", ImportState: true, ImportStateVerify: true, @@ -82,7 +82,7 @@ func TestAccComputeSslPolicy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslUpdate1(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -93,12 +93,12 @@ func TestAccComputeSslPolicy_update(t *testing.T) { "google_compute_ssl_policy.update", "min_tls_version", "TLS_1_0"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.update", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeSslUpdate2(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -109,7 +109,7 @@ func TestAccComputeSslPolicy_update(t *testing.T) { "google_compute_ssl_policy.update", "min_tls_version", "TLS_1_2"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.update", ImportState: true, ImportStateVerify: true, @@ -129,7 +129,7 @@ func TestAccComputeSslPolicy_tls_version(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslPolicyTlsVersion(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -138,7 +138,7 @@ func TestAccComputeSslPolicy_tls_version(t *testing.T) { "google_compute_ssl_policy.tlsversion", "min_tls_version", "TLS_1_2"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.tlsversion", ImportState: true, ImportStateVerify: true, @@ -158,7 +158,7 @@ func TestAccComputeSslPolicy_custom(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslPolicyCustom(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -169,7 +169,7 @@ func TestAccComputeSslPolicy_custom(t *testing.T) { "google_compute_ssl_policy.custom", "profile", "CUSTOM"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.custom", ImportState: true, ImportStateVerify: true, @@ -189,7 +189,7 @@ func TestAccComputeSslPolicy_update_to_custom(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslUpdate1(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -200,12 +200,12 @@ func TestAccComputeSslPolicy_update_to_custom(t *testing.T) { "google_compute_ssl_policy.update", "min_tls_version", "TLS_1_0"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.update", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeSslUpdate3(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -216,7 +216,7 @@ func TestAccComputeSslPolicy_update_to_custom(t *testing.T) { "google_compute_ssl_policy.update", "min_tls_version", "TLS_1_1"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.update", ImportState: true, ImportStateVerify: true, @@ -236,7 +236,7 @@ func TestAccComputeSslPolicy_update_from_custom(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSslPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSslUpdate3(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -247,12 +247,12 @@ func TestAccComputeSslPolicy_update_from_custom(t *testing.T) { "google_compute_ssl_policy.update", "min_tls_version", "TLS_1_1"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.update", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccComputeSslUpdate1(sslPolicyName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSslPolicyExists( @@ -263,7 +263,7 @@ func TestAccComputeSslPolicy_update_from_custom(t *testing.T) { "google_compute_ssl_policy.update", "min_tls_version", "TLS_1_0"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_ssl_policy.update", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_compute_subnetwork_test.go b/google/resource_compute_subnetwork_test.go index e3e7854d..dbc3e4ec 100644 --- a/google/resource_compute_subnetwork_test.go +++ b/google/resource_compute_subnetwork_test.go @@ -64,7 +64,7 @@ func TestAccComputeSubnetwork_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSubnetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSubnetwork_basic(cnName, subnetwork1Name, subnetwork2Name, subnetwork3Name), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSubnetworkExists( @@ -73,12 +73,12 @@ func TestAccComputeSubnetwork_basic(t *testing.T) { "google_compute_subnetwork.network-ref-by-name", &subnetwork2), ), }, - resource.TestStep{ + { ResourceName: "google_compute_subnetwork.network-ref-by-url", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_compute_subnetwork.network-with-private-google-access", ImportState: true, ImportStateVerify: true, @@ -100,14 +100,14 @@ func TestAccComputeSubnetwork_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSubnetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSubnetwork_update1(cnName, "10.2.0.0/24", subnetworkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSubnetworkExists( "google_compute_subnetwork.network-with-private-google-access", &subnetwork), ), }, - resource.TestStep{ + { // Expand IP CIDR range and update private_ip_google_access Config: testAccComputeSubnetwork_update2(cnName, "10.2.0.0/16", subnetworkName), Check: resource.ComposeTestCheckFunc( @@ -115,7 +115,7 @@ func TestAccComputeSubnetwork_update(t *testing.T) { "google_compute_subnetwork.network-with-private-google-access", &subnetwork), ), }, - resource.TestStep{ + { // Shrink IP CIDR range and update private_ip_google_access Config: testAccComputeSubnetwork_update2(cnName, "10.2.0.0/24", subnetworkName), Check: resource.ComposeTestCheckFunc( @@ -144,14 +144,14 @@ func TestAccComputeSubnetwork_secondaryIpRanges(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeSubnetworkDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeSubnetwork_secondaryIpRanges_update1(cnName, subnetworkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-ranges", &subnetwork), testAccCheckComputeSubnetworkHasSecondaryIpRange(&subnetwork, "tf-test-secondary-range-update1", "192.168.10.0/24"), ), }, - resource.TestStep{ + { Config: testAccComputeSubnetwork_secondaryIpRanges_update2(cnName, subnetworkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-ranges", &subnetwork), @@ -159,7 +159,7 @@ func TestAccComputeSubnetwork_secondaryIpRanges(t *testing.T) { testAccCheckComputeSubnetworkHasSecondaryIpRange(&subnetwork, "tf-test-secondary-range-update2", "192.168.11.0/24"), ), }, - resource.TestStep{ + { Config: testAccComputeSubnetwork_secondaryIpRanges_update1(cnName, subnetworkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-ranges", &subnetwork), diff --git a/google/resource_compute_target_http_proxy_test.go b/google/resource_compute_target_http_proxy_test.go index 33d33167..b63999bc 100644 --- a/google/resource_compute_target_http_proxy_test.go +++ b/google/resource_compute_target_http_proxy_test.go @@ -23,14 +23,14 @@ func TestAccComputeTargetHttpProxy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetHttpProxy_basic1(target, backend, hc, urlmap1, urlmap2), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetHttpProxyExists( "google_compute_target_http_proxy.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_target_http_proxy.foobar", ImportState: true, ImportStateVerify: true, @@ -53,7 +53,7 @@ func TestAccComputeTargetHttpProxy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetHttpProxy_basic1(target, backend, hc, urlmap1, urlmap2), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetHttpProxyExists( @@ -61,7 +61,7 @@ func TestAccComputeTargetHttpProxy_update(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccComputeTargetHttpProxy_basic2(target, backend, hc, urlmap1, urlmap2), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetHttpProxyExists( diff --git a/google/resource_compute_target_https_proxy_test.go b/google/resource_compute_target_https_proxy_test.go index 834606d1..c4f6c47f 100644 --- a/google/resource_compute_target_https_proxy_test.go +++ b/google/resource_compute_target_https_proxy_test.go @@ -25,7 +25,7 @@ func TestAccComputeTargetHttpsProxy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetHttpsProxy_basic1(resourceSuffix), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetHttpsProxyExists( @@ -34,7 +34,7 @@ func TestAccComputeTargetHttpsProxy_basic(t *testing.T) { testAccComputeTargetHttpsProxyHasSslCertificate("httpsproxy-test-cert1-"+resourceSuffix, &proxy), ), }, - resource.TestStep{ + { ResourceName: "google_compute_target_https_proxy.foobar", ImportState: true, ImportStateVerify: true, @@ -54,7 +54,7 @@ func TestAccComputeTargetHttpsProxy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetHttpsProxy_basic1(resourceSuffix), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetHttpsProxyExists( @@ -64,7 +64,7 @@ func TestAccComputeTargetHttpsProxy_update(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccComputeTargetHttpsProxy_basic2(resourceSuffix), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetHttpsProxyExists( diff --git a/google/resource_compute_target_pool_test.go b/google/resource_compute_target_pool_test.go index b9c29e86..9343d60f 100644 --- a/google/resource_compute_target_pool_test.go +++ b/google/resource_compute_target_pool_test.go @@ -17,7 +17,7 @@ func TestAccComputeTargetPool_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetPoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetPool_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetPoolExists( @@ -28,7 +28,7 @@ func TestAccComputeTargetPool_basic(t *testing.T) { testAccCheckComputeTargetPoolHealthCheck("google_compute_target_pool.bar", "google_compute_http_health_check.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_target_pool.foo", ImportState: true, ImportStateVerify: true, @@ -49,27 +49,27 @@ func TestAccComputeTargetPool_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetPoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { // Create target pool with no instances attached Config: testAccComputeTargetPool_update(tpname, "", name1, name2), }, - resource.TestStep{ + { ResourceName: "google_compute_target_pool.foo", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { // Add the two instances to the pool Config: testAccComputeTargetPool_update(tpname, `"${google_compute_instance.foo.self_link}", "${google_compute_instance.bar.self_link}"`, name1, name2), }, - resource.TestStep{ + { ResourceName: "google_compute_target_pool.foo", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { // Reversing the order of instances or changing import format shouldn't matter Config: testAccComputeTargetPool_update(tpname, fmt.Sprintf(`"${google_compute_instance.bar.self_link}", "us-central1-a/%s"`, name1), diff --git a/google/resource_compute_target_ssl_proxy_test.go b/google/resource_compute_target_ssl_proxy_test.go index a32239e8..c863b4da 100644 --- a/google/resource_compute_target_ssl_proxy_test.go +++ b/google/resource_compute_target_ssl_proxy_test.go @@ -21,14 +21,14 @@ func TestAccComputeTargetSslProxy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetSslProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetSslProxy_basic1(target, sslPolicy, cert, backend, hc), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetSslProxy( "google_compute_target_ssl_proxy.foobar", "NONE", cert), ), }, - resource.TestStep{ + { ResourceName: "google_compute_target_ssl_proxy.foobar", ImportState: true, ImportStateVerify: true, @@ -51,14 +51,14 @@ func TestAccComputeTargetSslProxy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetSslProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetSslProxy_basic1(target, sslPolicy, cert1, backend1, hc), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetSslProxy( "google_compute_target_ssl_proxy.foobar", "NONE", cert1), ), }, - resource.TestStep{ + { Config: testAccComputeTargetSslProxy_basic2(target, sslPolicy, cert1, cert2, backend1, backend2, hc), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetSslProxy( diff --git a/google/resource_compute_target_tcp_proxy_test.go b/google/resource_compute_target_tcp_proxy_test.go index ec4cc4f2..8c58c672 100644 --- a/google/resource_compute_target_tcp_proxy_test.go +++ b/google/resource_compute_target_tcp_proxy_test.go @@ -21,14 +21,14 @@ func TestAccComputeTargetTcpProxy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetTcpProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetTcpProxy_basic1(target, backend, hc), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetTcpProxyExists( "google_compute_target_tcp_proxy.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_target_tcp_proxy.foobar", ImportState: true, ImportStateVerify: true, @@ -49,14 +49,14 @@ func TestAccComputeTargetTcpProxy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeTargetTcpProxyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeTargetTcpProxy_basic1(target, backend, hc), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetTcpProxyExists( "google_compute_target_tcp_proxy.foobar"), ), }, - resource.TestStep{ + { Config: testAccComputeTargetTcpProxy_basic2(target, backend, hc), Check: resource.ComposeTestCheckFunc( testAccCheckComputeTargetTcpProxyExists( diff --git a/google/resource_compute_url_map_test.go b/google/resource_compute_url_map_test.go index 6567d732..ed7dbb53 100644 --- a/google/resource_compute_url_map_test.go +++ b/google/resource_compute_url_map_test.go @@ -20,14 +20,14 @@ func TestAccComputeUrlMap_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeUrlMapDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeUrlMap_basic1(bsName, hcName, umName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( "google_compute_url_map.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_compute_url_map.foobar", ImportState: true, ImportStateVerify: true, @@ -48,7 +48,7 @@ func TestAccComputeUrlMap_update_path_matcher(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeUrlMapDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeUrlMap_basic1(bsName, hcName, umName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( @@ -56,7 +56,7 @@ func TestAccComputeUrlMap_update_path_matcher(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccComputeUrlMap_basic2(bsName, hcName, umName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( @@ -75,7 +75,7 @@ func TestAccComputeUrlMap_advanced(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeUrlMapDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeUrlMap_advanced1(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( @@ -83,7 +83,7 @@ func TestAccComputeUrlMap_advanced(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccComputeUrlMap_advanced2(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( @@ -105,14 +105,14 @@ func TestAccComputeUrlMap_noPathRulesWithUpdate(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeUrlMapDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeUrlMap_noPathRules(bsName, hcName, umName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( "google_compute_url_map.foobar"), ), }, - resource.TestStep{ + { Config: testAccComputeUrlMap_basic1(bsName, hcName, umName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeUrlMapExists( diff --git a/google/resource_compute_vpn_gateway_test.go b/google/resource_compute_vpn_gateway_test.go index a111a417..977f7a41 100644 --- a/google/resource_compute_vpn_gateway_test.go +++ b/google/resource_compute_vpn_gateway_test.go @@ -19,7 +19,7 @@ func TestAccComputeVpnGateway_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeVpnGatewayDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeVpnGateway_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckComputeVpnGatewayExists( diff --git a/google/resource_compute_vpn_tunnel_test.go b/google/resource_compute_vpn_tunnel_test.go index 436fb5f1..3d4589e0 100644 --- a/google/resource_compute_vpn_tunnel_test.go +++ b/google/resource_compute_vpn_tunnel_test.go @@ -16,10 +16,10 @@ func TestAccComputeVpnTunnel_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeVpnTunnelDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeVpnTunnel_basic(), }, - resource.TestStep{ + { ResourceName: "google_compute_vpn_tunnel.foobar", ImportState: true, ImportStateVerify: true, @@ -44,10 +44,10 @@ func TestAccComputeVpnTunnel_regionFromGateway(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeVpnTunnelDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeVpnTunnel_regionFromGateway(region), }, - resource.TestStep{ + { ResourceName: "google_compute_vpn_tunnel.foobar", ImportState: true, ImportStateVerify: true, @@ -66,10 +66,10 @@ func TestAccComputeVpnTunnel_router(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeVpnTunnelDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeVpnTunnelRouter(router), }, - resource.TestStep{ + { ResourceName: "google_compute_vpn_tunnel.foobar", ImportState: true, ImportStateVerify: true, @@ -87,10 +87,10 @@ func TestAccComputeVpnTunnel_defaultTrafficSelectors(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckComputeVpnTunnelDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccComputeVpnTunnelDefaultTrafficSelectors(), }, - resource.TestStep{ + { ResourceName: "google_compute_vpn_tunnel.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_container_cluster_test.go b/google/resource_container_cluster_test.go index a8b5979b..6f906858 100644 --- a/google/resource_container_cluster_test.go +++ b/google/resource_container_cluster_test.go @@ -855,7 +855,7 @@ func TestAccContainerCluster_withNodePoolAutoscaling(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerCluster_withNodePoolAutoscaling(clusterName, npName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_container_cluster.with_node_pool", "node_pool.0.autoscaling.0.min_node_count", "1"), @@ -868,7 +868,7 @@ func TestAccContainerCluster_withNodePoolAutoscaling(t *testing.T) { ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccContainerCluster_withNodePoolUpdateAutoscaling(clusterName, npName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_container_cluster.with_node_pool", "node_pool.0.autoscaling.0.min_node_count", "1"), @@ -881,7 +881,7 @@ func TestAccContainerCluster_withNodePoolAutoscaling(t *testing.T) { ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccContainerCluster_withNodePoolBasic(clusterName, npName), Check: resource.ComposeTestCheckFunc( resource.TestCheckNoResourceAttr("google_container_cluster.with_node_pool", "node_pool.0.autoscaling.0.min_node_count"), diff --git a/google/resource_container_node_pool.go b/google/resource_container_node_pool.go index 6bdf3448..fbda8c68 100644 --- a/google/resource_container_node_pool.go +++ b/google/resource_container_node_pool.go @@ -36,24 +36,24 @@ func resourceContainerNodePool() *schema.Resource { Schema: mergeSchemas( schemaNodePool, map[string]*schema.Schema{ - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "zone": &schema.Schema{ + "zone": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -63,19 +63,19 @@ func resourceContainerNodePool() *schema.Resource { } var schemaNodePool = map[string]*schema.Schema{ - "autoscaling": &schema.Schema{ + "autoscaling": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "min_node_count": &schema.Schema{ + "min_node_count": { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntAtLeast(0), }, - "max_node_count": &schema.Schema{ + "max_node_count": { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntAtLeast(1), @@ -84,7 +84,7 @@ var schemaNodePool = map[string]*schema.Schema{ }, }, - "max_pods_per_node": &schema.Schema{ + "max_pods_per_node": { Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.", Type: schema.TypeInt, Optional: true, @@ -92,7 +92,7 @@ var schemaNodePool = map[string]*schema.Schema{ Computed: true, }, - "initial_node_count": &schema.Schema{ + "initial_node_count": { Type: schema.TypeInt, Optional: true, ForceNew: true, @@ -127,14 +127,14 @@ var schemaNodePool = map[string]*schema.Schema{ }, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "name_prefix": &schema.Schema{ + "name_prefix": { Type: schema.TypeString, Optional: true, Computed: true, @@ -518,7 +518,7 @@ func flattenNodePool(d *schema.ResourceData, config *Config, np *containerBeta.N if np.Autoscaling != nil && np.Autoscaling.Enabled { nodePool["autoscaling"] = []map[string]interface{}{ - map[string]interface{}{ + { "min_node_count": np.Autoscaling.MinNodeCount, "max_node_count": np.Autoscaling.MaxNodeCount, }, diff --git a/google/resource_container_node_pool_test.go b/google/resource_container_node_pool_test.go index a64be0e1..4a258f1c 100644 --- a/google/resource_container_node_pool_test.go +++ b/google/resource_container_node_pool_test.go @@ -20,10 +20,10 @@ func TestAccContainerNodePool_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_basic(cluster, np), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, @@ -42,10 +42,10 @@ func TestAccContainerNodePool_noName(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_noName(cluster), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, @@ -65,10 +65,10 @@ func TestAccContainerNodePool_withNodeConfig(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_withNodeConfig(cluster, nodePool), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np_with_node_config", ImportState: true, ImportStateVerify: true, @@ -76,10 +76,10 @@ func TestAccContainerNodePool_withNodeConfig(t *testing.T) { // but will still cause an import diff ImportStateVerifyIgnore: []string{"autoscaling.#"}, }, - resource.TestStep{ + { Config: testAccContainerNodePool_withNodeConfigUpdate(cluster, nodePool), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np_with_node_config", ImportState: true, ImportStateVerify: true, @@ -99,10 +99,10 @@ func TestAccContainerNodePool_withGPU(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_withGPU(), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np_with_gpu", ImportState: true, ImportStateVerify: true, @@ -127,7 +127,7 @@ func TestAccContainerNodePool_withManagement(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_withManagement(cluster, nodePool, ""), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( @@ -138,12 +138,12 @@ func TestAccContainerNodePool_withManagement(t *testing.T) { "google_container_node_pool.np_with_management", "management.0.auto_repair", "false"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np_with_management", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccContainerNodePool_withManagement(cluster, nodePool, management), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( @@ -154,7 +154,7 @@ func TestAccContainerNodePool_withManagement(t *testing.T) { "google_container_node_pool.np_with_management", "management.0.auto_repair", "true"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np_with_management", ImportState: true, ImportStateVerify: true, @@ -171,10 +171,10 @@ func TestAccContainerNodePool_withNodeConfigScopeAlias(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_withNodeConfigScopeAlias(), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np_with_node_config_scope_alias", ImportState: true, ImportStateVerify: true, @@ -195,38 +195,38 @@ func TestAccContainerNodePool_regionalAutoscaling(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_regionalAutoscaling(cluster, np), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.min_node_count", "1"), resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.max_node_count", "3"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccContainerNodePool_updateAutoscaling(cluster, np), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.min_node_count", "0"), resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.max_node_count", "5"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccContainerNodePool_basic(cluster, np), Check: resource.ComposeTestCheckFunc( resource.TestCheckNoResourceAttr("google_container_node_pool.np", "autoscaling.0.min_node_count"), resource.TestCheckNoResourceAttr("google_container_node_pool.np", "autoscaling.0.max_node_count"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, @@ -249,38 +249,38 @@ func TestAccContainerNodePool_autoscaling(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_autoscaling(cluster, np), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.min_node_count", "1"), resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.max_node_count", "3"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccContainerNodePool_updateAutoscaling(cluster, np), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.min_node_count", "0"), resource.TestCheckResourceAttr("google_container_node_pool.np", "autoscaling.0.max_node_count", "5"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccContainerNodePool_basic(cluster, np), Check: resource.ComposeTestCheckFunc( resource.TestCheckNoResourceAttr("google_container_node_pool.np", "autoscaling.0.min_node_count"), resource.TestCheckNoResourceAttr("google_container_node_pool.np", "autoscaling.0.max_node_count"), ), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, @@ -413,10 +413,10 @@ func TestAccContainerNodePool_regionalClusters(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckContainerNodePoolDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccContainerNodePool_regionalClusters(cluster, np), }, - resource.TestStep{ + { ResourceName: "google_container_node_pool.np", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_dataflow_job.go b/google/resource_dataflow_job.go index 11da9ebb..7fce37af 100644 --- a/google/resource_dataflow_job.go +++ b/google/resource_dataflow_job.go @@ -30,37 +30,37 @@ func resourceDataflowJob() *schema.Resource { Delete: resourceDataflowJobDelete, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "template_gcs_path": &schema.Schema{ + "template_gcs_path": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "temp_gcs_location": &schema.Schema{ + "temp_gcs_location": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "zone": &schema.Schema{ + "zone": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "max_workers": &schema.Schema{ + "max_workers": { Type: schema.TypeInt, Optional: true, ForceNew: true, @@ -72,7 +72,7 @@ func resourceDataflowJob() *schema.Resource { ForceNew: true, }, - "on_delete": &schema.Schema{ + "on_delete": { Type: schema.TypeString, ValidateFunc: validation.StringInSlice([]string{"cancel", "drain"}, false), Optional: true, @@ -80,13 +80,13 @@ func resourceDataflowJob() *schema.Resource { ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "state": &schema.Schema{ + "state": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_dataflow_job_test.go b/google/resource_dataflow_job_test.go index 5750893d..e61704ec 100644 --- a/google/resource_dataflow_job_test.go +++ b/google/resource_dataflow_job_test.go @@ -16,7 +16,7 @@ func TestAccDataflowJobCreate(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDataflowJobDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataflowJob, Check: resource.ComposeTestCheckFunc( testAccDataflowJobExists( @@ -34,7 +34,7 @@ func TestAccDataflowJobRegionCreate(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDataflowJobRegionDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDataflowJobRegion, Check: resource.ComposeTestCheckFunc( testAccDataflowJobRegionExists( diff --git a/google/resource_dataproc_cluster.go b/google/resource_dataproc_cluster.go index d12ff650..d1871fc2 100644 --- a/google/resource_dataproc_cluster.go +++ b/google/resource_dataproc_cluster.go @@ -177,7 +177,7 @@ func resourceDataprocCluster() *schema.Resource { Default: false, }, - "metadata": &schema.Schema{ + "metadata": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, diff --git a/google/resource_dns_managed_zone_test.go b/google/resource_dns_managed_zone_test.go index 8d27ed58..eeb1d7dc 100644 --- a/google/resource_dns_managed_zone_test.go +++ b/google/resource_dns_managed_zone_test.go @@ -18,18 +18,18 @@ func TestAccDnsManagedZone_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsManagedZoneDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsManagedZone_basic(zoneSuffix, "description1"), }, - resource.TestStep{ + { ResourceName: "google_dns_managed_zone.foobar", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccDnsManagedZone_basic(zoneSuffix, "description2"), }, - resource.TestStep{ + { ResourceName: "google_dns_managed_zone.foobar", ImportState: true, ImportStateVerify: true, @@ -138,10 +138,10 @@ func TestAccDnsManagedZone_importWithProject(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsManagedZoneDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsManagedZone_basicWithProject(zoneSuffix, "description1", project), }, - resource.TestStep{ + { ResourceName: "google_dns_managed_zone.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_dns_record_set.go b/google/resource_dns_record_set.go index 5bf36027..ed0d1325 100644 --- a/google/resource_dns_record_set.go +++ b/google/resource_dns_record_set.go @@ -22,19 +22,19 @@ func resourceDnsRecordSet() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "managed_zone": &schema.Schema{ + "managed_zone": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "rrdatas": &schema.Schema{ + "rrdatas": { Type: schema.TypeList, Required: true, Elem: &schema.Schema{ @@ -51,17 +51,17 @@ func resourceDnsRecordSet() *schema.Resource { }, }, - "ttl": &schema.Schema{ + "ttl": { Type: schema.TypeInt, Required: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, @@ -86,7 +86,7 @@ func resourceDnsRecordSetCreate(d *schema.ResourceData, meta interface{}) error // Build the change chg := &dns.Change{ Additions: []*dns.ResourceRecordSet{ - &dns.ResourceRecordSet{ + { Name: name, Type: rType, Ttl: int64(d.Get("ttl").(int)), @@ -214,7 +214,7 @@ func resourceDnsRecordSetDelete(d *schema.ResourceData, meta interface{}) error // Build the change chg := &dns.Change{ Deletions: []*dns.ResourceRecordSet{ - &dns.ResourceRecordSet{ + { Name: d.Get("name").(string), Type: d.Get("type").(string), Ttl: int64(d.Get("ttl").(int)), @@ -263,7 +263,7 @@ func resourceDnsRecordSetUpdate(d *schema.ResourceData, meta interface{}) error chg := &dns.Change{ Deletions: []*dns.ResourceRecordSet{ - &dns.ResourceRecordSet{ + { Name: recordName, Type: oldType.(string), Ttl: int64(oldTtl.(int)), @@ -271,7 +271,7 @@ func resourceDnsRecordSetUpdate(d *schema.ResourceData, meta interface{}) error }, }, Additions: []*dns.ResourceRecordSet{ - &dns.ResourceRecordSet{ + { Name: recordName, Type: newType.(string), Ttl: int64(newTtl.(int)), diff --git a/google/resource_dns_record_set_test.go b/google/resource_dns_record_set_test.go index 763a46fd..7f273599 100644 --- a/google/resource_dns_record_set_test.go +++ b/google/resource_dns_record_set_test.go @@ -43,14 +43,14 @@ func TestAccDnsRecordSet_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsRecordSetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsRecordSet_basic(zoneName, "127.0.0.10", 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( "google_dns_record_set.foobar", zoneName), ), }, - resource.TestStep{ + { ResourceName: "google_dns_record_set.foobar", ImportStateId: fmt.Sprintf("%s/test-record.%s.hashicorptest.com./A", zoneName, zoneName), ImportState: true, @@ -69,21 +69,21 @@ func TestAccDnsRecordSet_modify(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsRecordSetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsRecordSet_basic(zoneName, "127.0.0.10", 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( "google_dns_record_set.foobar", zoneName), ), }, - resource.TestStep{ + { Config: testAccDnsRecordSet_basic(zoneName, "127.0.0.11", 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( "google_dns_record_set.foobar", zoneName), ), }, - resource.TestStep{ + { Config: testAccDnsRecordSet_basic(zoneName, "127.0.0.11", 600), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( @@ -103,14 +103,14 @@ func TestAccDnsRecordSet_changeType(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsRecordSetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsRecordSet_basic(zoneName, "127.0.0.10", 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( "google_dns_record_set.foobar", zoneName), ), }, - resource.TestStep{ + { Config: testAccDnsRecordSet_bigChange(zoneName, 600), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( @@ -130,14 +130,14 @@ func TestAccDnsRecordSet_ns(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsRecordSetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsRecordSet_ns(zoneName, 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( "google_dns_record_set.foobar", zoneName), ), }, - resource.TestStep{ + { ResourceName: "google_dns_record_set.foobar", ImportStateId: fmt.Sprintf("%s/%s.hashicorptest.com./NS", zoneName, zoneName), ImportState: true, @@ -156,7 +156,7 @@ func TestAccDnsRecordSet_nestedNS(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsRecordSetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsRecordSet_nestedNS(zoneName, 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( @@ -176,7 +176,7 @@ func TestAccDnsRecordSet_quotedTXT(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsRecordSetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsRecordSet_quotedTXT(zoneName, 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( @@ -196,7 +196,7 @@ func TestAccDnsRecordSet_uppercaseMX(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDnsRecordSetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDnsRecordSet_uppercaseMX(zoneName, 300), Check: resource.ComposeTestCheckFunc( testAccCheckDnsRecordSetExists( diff --git a/google/resource_endpoints_service.go b/google/resource_endpoints_service.go index 22427271..7a513035 100644 --- a/google/resource_endpoints_service.go +++ b/google/resource_endpoints_service.go @@ -20,75 +20,75 @@ func resourceEndpointsService() *schema.Resource { MigrateState: migrateEndpointsService, Schema: map[string]*schema.Schema{ - "service_name": &schema.Schema{ + "service_name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "openapi_config": &schema.Schema{ + "openapi_config": { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"grpc_config", "protoc_output_base64"}, }, - "grpc_config": &schema.Schema{ + "grpc_config": { Type: schema.TypeString, Optional: true, }, - "protoc_output": &schema.Schema{ + "protoc_output": { Type: schema.TypeString, Optional: true, Computed: true, Removed: "Please use protoc_output_base64 instead.", }, - "protoc_output_base64": &schema.Schema{ + "protoc_output_base64": { Type: schema.TypeString, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "config_id": &schema.Schema{ + "config_id": { Type: schema.TypeString, Computed: true, }, - "apis": &schema.Schema{ + "apis": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "syntax": &schema.Schema{ + "syntax": { Type: schema.TypeString, Computed: true, }, - "version": &schema.Schema{ + "version": { Type: schema.TypeString, Computed: true, }, - "methods": &schema.Schema{ + "methods": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "syntax": &schema.Schema{ + "syntax": { Type: schema.TypeString, Computed: true, }, - "request_type": &schema.Schema{ + "request_type": { Type: schema.TypeString, Computed: true, }, - "response_type": &schema.Schema{ + "response_type": { Type: schema.TypeString, Computed: true, }, @@ -98,20 +98,20 @@ func resourceEndpointsService() *schema.Resource { }, }, }, - "dns_address": &schema.Schema{ + "dns_address": { Type: schema.TypeString, Computed: true, }, - "endpoints": &schema.Schema{ + "endpoints": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_endpoints_service_test.go b/google/resource_endpoints_service_test.go index 4df87cb9..ec6cf2e2 100644 --- a/google/resource_endpoints_service_test.go +++ b/google/resource_endpoints_service_test.go @@ -19,7 +19,7 @@ func TestAccEndpointsService_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccEndpointsService_basic(random_name), Check: testAccCheckEndpointExistsByName(random_name), }, @@ -35,7 +35,7 @@ func TestAccEndpointsService_grpc(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccEndpointsService_grpc(random_name), Check: testAccCheckEndpointExistsByName(random_name), }, diff --git a/google/resource_google_folder.go b/google/resource_google_folder.go index 0e2fa893..fac9bc8e 100644 --- a/google/resource_google_folder.go +++ b/google/resource_google_folder.go @@ -21,27 +21,27 @@ func resourceGoogleFolder() *schema.Resource { Schema: map[string]*schema.Schema{ // Format is either folders/{folder_id} or organizations/{org_id}. - "parent": &schema.Schema{ + "parent": { Type: schema.TypeString, Required: true, }, // Must be unique amongst its siblings. - "display_name": &schema.Schema{ + "display_name": { Type: schema.TypeString, Required: true, }, // Format is 'folders/{folder_id}. // The terraform id holds the same value. - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "lifecycle_state": &schema.Schema{ + "lifecycle_state": { Type: schema.TypeString, Computed: true, }, - "create_time": &schema.Schema{ + "create_time": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_google_folder_iam_policy_test.go b/google/resource_google_folder_iam_policy_test.go index 91a54740..3ea7470f 100644 --- a/google/resource_google_folder_iam_policy_test.go +++ b/google/resource_google_folder_iam_policy_test.go @@ -35,7 +35,7 @@ func TestAccFolderIamPolicy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckGoogleFolderIamPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccFolderIamPolicy_basic(folderDisplayName, parent, policy), Check: testAccCheckGoogleFolderIamPolicy("google_folder_iam_policy.test", policy), }, @@ -82,11 +82,11 @@ func TestAccFolderIamPolicy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckGoogleFolderIamPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccFolderIamPolicy_basic(folderDisplayName, parent, policy1), Check: testAccCheckGoogleFolderIamPolicy("google_folder_iam_policy.test", policy1), }, - resource.TestStep{ + { Config: testAccFolderIamPolicy_basic(folderDisplayName, parent, policy2), Check: testAccCheckGoogleFolderIamPolicy("google_folder_iam_policy.test", policy2), }, diff --git a/google/resource_google_folder_test.go b/google/resource_google_folder_test.go index 410465a1..f5a7bc33 100644 --- a/google/resource_google_folder_test.go +++ b/google/resource_google_folder_test.go @@ -25,7 +25,7 @@ func TestAccFolder_rename(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckGoogleFolderDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccFolder_basic(folderDisplayName, parent), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleFolderExists("google_folder.folder1", &folder), @@ -33,14 +33,14 @@ func TestAccFolder_rename(t *testing.T) { testAccCheckGoogleFolderDisplayName(&folder, folderDisplayName), ), }, - resource.TestStep{ + { Config: testAccFolder_basic(newFolderDisplayName, parent), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleFolderExists("google_folder.folder1", &folder), testAccCheckGoogleFolderParent(&folder, parent), testAccCheckGoogleFolderDisplayName(&folder, newFolderDisplayName), )}, - resource.TestStep{ + { ResourceName: "google_folder.folder1", ImportState: true, ImportStateVerify: true, @@ -64,7 +64,7 @@ func TestAccFolder_moveParent(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckGoogleFolderDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccFolder_basic(folder1DisplayName, parent), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleFolderExists("google_folder.folder1", &folder1), @@ -72,7 +72,7 @@ func TestAccFolder_moveParent(t *testing.T) { testAccCheckGoogleFolderDisplayName(&folder1, folder1DisplayName), ), }, - resource.TestStep{ + { Config: testAccFolder_move(folder1DisplayName, folder2DisplayName, parent), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleFolderExists("google_folder.folder1", &folder1), diff --git a/google/resource_google_project.go b/google/resource_google_project.go index 9c9fa8d7..31eae963 100644 --- a/google/resource_google_project.go +++ b/google/resource_google_project.go @@ -31,64 +31,64 @@ func resourceGoogleProject() *schema.Resource { MigrateState: resourceGoogleProjectMigrateState, Schema: map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateProjectID(), }, - "skip_delete": &schema.Schema{ + "skip_delete": { Type: schema.TypeBool, Optional: true, Computed: true, }, - "auto_create_network": &schema.Schema{ + "auto_create_network": { Type: schema.TypeBool, Optional: true, Default: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ValidateFunc: validateProjectName(), }, - "org_id": &schema.Schema{ + "org_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "folder_id": &schema.Schema{ + "folder_id": { Type: schema.TypeString, Optional: true, Computed: true, StateFunc: parseFolderId, }, - "policy_data": &schema.Schema{ + "policy_data": { Type: schema.TypeString, Optional: true, Computed: true, Removed: "Use the 'google_project_iam_policy' resource to define policies for a Google Project", }, - "policy_etag": &schema.Schema{ + "policy_etag": { Type: schema.TypeString, Computed: true, Removed: "Use the the 'google_project_iam_policy' resource to define policies for a Google Project", }, - "number": &schema.Schema{ + "number": { Type: schema.TypeString, Computed: true, }, - "billing_account": &schema.Schema{ + "billing_account": { Type: schema.TypeString, Optional: true, }, - "labels": &schema.Schema{ + "labels": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "app_engine": &schema.Schema{ + "app_engine": { Type: schema.TypeList, Elem: appEngineResource(), Computed: true, @@ -101,58 +101,58 @@ func resourceGoogleProject() *schema.Resource { func appEngineResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "auth_domain": &schema.Schema{ + "auth_domain": { Type: schema.TypeString, Optional: true, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "location_id": &schema.Schema{ + "location_id": { Type: schema.TypeString, Optional: true, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "serving_status": &schema.Schema{ + "serving_status": { Type: schema.TypeString, Optional: true, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "feature_settings": &schema.Schema{ + "feature_settings": { Type: schema.TypeList, Optional: true, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", Elem: appEngineFeatureSettingsResource(), }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "url_dispatch_rule": &schema.Schema{ + "url_dispatch_rule": { Type: schema.TypeList, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", Elem: appEngineURLDispatchRuleResource(), }, - "code_bucket": &schema.Schema{ + "code_bucket": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "default_hostname": &schema.Schema{ + "default_hostname": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "default_bucket": &schema.Schema{ + "default_bucket": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "gcr_domain": &schema.Schema{ + "gcr_domain": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", @@ -164,17 +164,17 @@ func appEngineResource() *schema.Resource { func appEngineURLDispatchRuleResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "domain": &schema.Schema{ + "domain": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "path": &schema.Schema{ + "path": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", }, - "service": &schema.Schema{ + "service": { Type: schema.TypeString, Computed: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", @@ -186,7 +186,7 @@ func appEngineURLDispatchRuleResource() *schema.Resource { func appEngineFeatureSettingsResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "split_health_checks": &schema.Schema{ + "split_health_checks": { Type: schema.TypeBool, Optional: true, Removed: "This field has been removed. Use the google_app_engine_application resource instead.", diff --git a/google/resource_google_project_iam_policy.go b/google/resource_google_project_iam_policy.go index 195c44d7..4dbd6e37 100644 --- a/google/resource_google_project_iam_policy.go +++ b/google/resource_google_project_iam_policy.go @@ -22,31 +22,31 @@ func resourceGoogleProjectIamPolicy() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "policy_data": &schema.Schema{ + "policy_data": { Type: schema.TypeString, Required: true, DiffSuppressFunc: jsonPolicyDiffSuppress, }, - "etag": &schema.Schema{ + "etag": { Type: schema.TypeString, Computed: true, }, - "authoritative": &schema.Schema{ + "authoritative": { Removed: "The authoritative field was removed. To ignore changes not managed by Terraform, use google_project_iam_binding and google_project_iam_member instead. See https://www.terraform.io/docs/providers/google/r/google_project_iam.html for more information.", Type: schema.TypeBool, Optional: true, }, - "restore_policy": &schema.Schema{ + "restore_policy": { Removed: "This field was removed alongside the authoritative field. To ignore changes not managed by Terraform, use google_project_iam_binding and google_project_iam_member instead. See https://www.terraform.io/docs/providers/google/r/google_project_iam.html for more information.", Type: schema.TypeString, Computed: true, }, - "disable_project": &schema.Schema{ + "disable_project": { Removed: "This field was removed alongside the authoritative field. Use lifecycle.prevent_destroy instead.", Type: schema.TypeBool, Optional: true, diff --git a/google/resource_google_project_iam_policy_test.go b/google/resource_google_project_iam_policy_test.go index 04cb9ee0..024762d1 100644 --- a/google/resource_google_project_iam_policy_test.go +++ b/google/resource_google_project_iam_policy_test.go @@ -24,7 +24,7 @@ func TestAccProjectIamPolicy_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // Create a new project - resource.TestStep{ + { Config: testAccProject_create(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccProjectExistingPolicy(pid), @@ -32,10 +32,10 @@ func TestAccProjectIamPolicy_basic(t *testing.T) { }, // Apply an IAM policy from a data source. The application // merges policies, so we validate the expected state. - resource.TestStep{ + { Config: testAccProjectAssociatePolicyBasic(pid, pname, org), }, - resource.TestStep{ + { ResourceName: "google_project_iam_policy.acceptance", ImportState: true, }, @@ -53,7 +53,7 @@ func TestAccProjectIamPolicy_expanded(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccProjectAssociatePolicyExpanded(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectIamPolicyExists("google_project_iam_policy.acceptance", "data.google_iam_policy.expanded", pid), @@ -226,7 +226,7 @@ func TestIamMergeBindings(t *testing.T) { for _, test := range table { got := mergeBindings(test.input) sort.Sort(sortableBindings(got)) - for i, _ := range got { + for i := range got { sort.Strings(got[i].Members) } if !reflect.DeepEqual(derefBindings(got), test.expect) { diff --git a/google/resource_google_project_service.go b/google/resource_google_project_service.go index d87db7cd..f8408c92 100644 --- a/google/resource_google_project_service.go +++ b/google/resource_google_project_service.go @@ -26,13 +26,13 @@ func resourceGoogleProjectService() *schema.Resource { Required: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "disable_on_destroy": &schema.Schema{ + "disable_on_destroy": { Type: schema.TypeBool, Optional: true, Default: true, diff --git a/google/resource_google_project_service_test.go b/google/resource_google_project_service_test.go index 8f4b0e08..3510fdac 100644 --- a/google/resource_google_project_service_test.go +++ b/google/resource_google_project_service_test.go @@ -20,40 +20,40 @@ func TestAccProjectService_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccProjectService_basic(services, pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckProjectService(services, pid, true), ), }, - resource.TestStep{ + { ResourceName: "google_project_service.test", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"disable_on_destroy"}, }, - resource.TestStep{ + { ResourceName: "google_project_service.test2", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"disable_on_destroy"}, }, // Use a separate TestStep rather than a CheckDestroy because we need the project to still exist. - resource.TestStep{ + { Config: testAccProject_create(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckProjectService(services, pid, false), ), }, // Create services with disabling turned off. - resource.TestStep{ + { Config: testAccProjectService_noDisable(services, pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckProjectService(services, pid, true), ), }, // Check that services are still enabled even after the resources are deleted. - resource.TestStep{ + { Config: testAccProject_create(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckProjectService(services, pid, true), @@ -73,14 +73,14 @@ func TestAccProjectService_handleNotFound(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccProjectService_handleNotFound(service, pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckProjectService([]string{service}, pid, true), ), }, // Delete the project, implicitly deletes service, expect the plan to want to create the service again - resource.TestStep{ + { Config: testAccProjectService_handleNotFoundNoProject(service, pid), ExpectNonEmptyPlan: true, }, diff --git a/google/resource_google_project_services.go b/google/resource_google_project_services.go index 206a4f3a..89083580 100644 --- a/google/resource_google_project_services.go +++ b/google/resource_google_project_services.go @@ -23,7 +23,7 @@ func resourceGoogleProjectServices() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -38,7 +38,7 @@ func resourceGoogleProjectServices() *schema.Resource { ValidateFunc: StringNotInSlice(ignoredProjectServices, false), }, }, - "disable_on_destroy": &schema.Schema{ + "disable_on_destroy": { Type: schema.TypeBool, Optional: true, Default: true, @@ -151,7 +151,7 @@ func reconcileServices(cfgServices, apiServices []string, config *Config, pid st cfgMap := m(cfgServices) apiMap := m(apiServices) - for k, _ := range apiMap { + for k := range apiMap { if _, ok := cfgMap[k]; !ok { // The service in the API is not in the config; disable it. err := disableService(k, pid, config) @@ -166,7 +166,7 @@ func reconcileServices(cfgServices, apiServices []string, config *Config, pid st } keys := make([]string, 0, len(cfgMap)) - for k, _ := range cfgMap { + for k := range cfgMap { keys = append(keys, k) } err := enableServices(keys, pid, config) diff --git a/google/resource_google_project_services_test.go b/google/resource_google_project_services_test.go index d3057c53..b188a0cf 100644 --- a/google/resource_google_project_services_test.go +++ b/google/resource_google_project_services_test.go @@ -27,21 +27,21 @@ func TestAccProjectServices_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // Create a new project with some services - resource.TestStep{ + { Config: testAccProjectAssociateServicesBasic(services1, pid, pname, org), Check: resource.ComposeTestCheckFunc( testProjectServicesMatch(services1, pid), ), }, // Update services to remove one - resource.TestStep{ + { Config: testAccProjectAssociateServicesBasic(services2, pid, pname, org), Check: resource.ComposeTestCheckFunc( testProjectServicesMatch(services2, pid), ), }, // Add a service out-of-band and ensure it is removed - resource.TestStep{ + { PreConfig: func() { config := testAccProvider.Meta().(*Config) enableService(oobService, pid, config) @@ -51,7 +51,7 @@ func TestAccProjectServices_basic(t *testing.T) { testProjectServicesMatch(services2, pid), ), }, - resource.TestStep{ + { ResourceName: "google_project_services.acceptance", ImportState: true, ImportStateId: pid, @@ -76,7 +76,7 @@ func TestAccProjectServices_authoritative(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // Create a new project with no services - resource.TestStep{ + { Config: testAccProject_create(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectExists("google_project.acceptance", pid), @@ -84,7 +84,7 @@ func TestAccProjectServices_authoritative(t *testing.T) { }, // Add a service out-of-band, then apply a config that creates a service. // It should remove the out-of-band service. - resource.TestStep{ + { PreConfig: func() { config := testAccProvider.Meta().(*Config) enableService(oobService, pid, config) @@ -114,7 +114,7 @@ func TestAccProjectServices_authoritative2(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // Create a new project with no services - resource.TestStep{ + { Config: testAccProject_create(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectExists("google_project.acceptance", pid), @@ -122,7 +122,7 @@ func TestAccProjectServices_authoritative2(t *testing.T) { }, // Add a service out-of-band, then apply a config that creates a service. // It should remove the out-of-band service. - resource.TestStep{ + { PreConfig: func() { config := testAccProvider.Meta().(*Config) for _, s := range oobServices { @@ -168,7 +168,7 @@ func TestAccProjectServices_ignoreUnenablableServices(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccProjectAssociateServicesBasic_withBilling(services, pid, pname, org, billingId), Check: resource.ComposeTestCheckFunc( testProjectServicesMatch(services, pid), @@ -249,7 +249,7 @@ func TestAccProjectServices_pagination(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccProjectAssociateServicesBasic_withBilling(services, pid, pname, org, billingId), Check: resource.ComposeTestCheckFunc( testProjectServicesMatch(services, pid), diff --git a/google/resource_google_project_test.go b/google/resource_google_project_test.go index 89e69940..6801e0e6 100644 --- a/google/resource_google_project_test.go +++ b/google/resource_google_project_test.go @@ -35,7 +35,7 @@ func TestAccProject_createWithoutOrg(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // This step creates a new project - resource.TestStep{ + { Config: testAccProject_createWithoutOrg(pid, pname), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectExists("google_project.acceptance", pid), @@ -57,7 +57,7 @@ func TestAccProject_create(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // This step creates a new project - resource.TestStep{ + { Config: testAccProject_create(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectExists("google_project.acceptance", pid), @@ -81,27 +81,27 @@ func TestAccProject_billing(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // This step creates a new project with a billing account - resource.TestStep{ + { Config: testAccProject_createBilling(pid, pname, org, billingId), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectHasBillingAccount("google_project.acceptance", pid, billingId), ), }, // Make sure import supports billing account - resource.TestStep{ + { ResourceName: "google_project.acceptance", ImportState: true, ImportStateVerify: true, }, // Update to a different billing account - resource.TestStep{ + { Config: testAccProject_createBilling(pid, pname, org, billingId2), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectHasBillingAccount("google_project.acceptance", pid, billingId2), ), }, // Unlink the billing account - resource.TestStep{ + { Config: testAccProject_create(pid, pname, org), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleProjectHasBillingAccount("google_project.acceptance", pid, ""), diff --git a/google/resource_google_service_account.go b/google/resource_google_service_account.go index 2c6672d1..3e4a82ae 100644 --- a/google/resource_google_service_account.go +++ b/google/resource_google_service_account.go @@ -18,35 +18,35 @@ func resourceGoogleServiceAccount() *schema.Resource { State: resourceGoogleServiceAccountImport, }, Schema: map[string]*schema.Schema{ - "email": &schema.Schema{ + "email": { Type: schema.TypeString, Computed: true, }, - "unique_id": &schema.Schema{ + "unique_id": { Type: schema.TypeString, Computed: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, }, - "account_id": &schema.Schema{ + "account_id": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateRFC1035Name(6, 30), }, - "display_name": &schema.Schema{ + "display_name": { Type: schema.TypeString, Optional: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Computed: true, Optional: true, ForceNew: true, }, - "policy_data": &schema.Schema{ + "policy_data": { Type: schema.TypeString, Optional: true, Removed: "Use the 'google_service_account_iam_policy' resource to define policies for a service account", @@ -150,7 +150,7 @@ func saRolesToMembersBinding(m map[string]map[string]bool) []*iam.Binding { Role: role, Members: make([]string, 0), } - for m, _ := range members { + for m := range members { b.Members = append(b.Members, m) } bindings = append(bindings, &b) @@ -186,7 +186,7 @@ func saMergeBindings(bindings []*iam.Binding) []*iam.Binding { var b iam.Binding b.Role = role b.Members = make([]string, 0) - for m, _ := range members { + for m := range members { b.Members = append(b.Members, m) } rb = append(rb, &b) diff --git a/google/resource_google_service_account_key.go b/google/resource_google_service_account_key.go index 92be5a23..887271b8 100644 --- a/google/resource_google_service_account_key.go +++ b/google/resource_google_service_account_key.go @@ -17,13 +17,13 @@ func resourceGoogleServiceAccountKey() *schema.Resource { Delete: resourceGoogleServiceAccountKeyDelete, Schema: map[string]*schema.Schema{ // Required - "service_account_id": &schema.Schema{ + "service_account_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, // Optional - "key_algorithm": &schema.Schema{ + "key_algorithm": { Type: schema.TypeString, Default: "KEY_ALG_RSA_2048", Optional: true, @@ -35,14 +35,14 @@ func resourceGoogleServiceAccountKey() *schema.Resource { Optional: true, ForceNew: true, }, - "private_key_type": &schema.Schema{ + "private_key_type": { Type: schema.TypeString, Default: "TYPE_GOOGLE_CREDENTIALS_FILE", Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"TYPE_UNSPECIFIED", "TYPE_PKCS12_FILE", "TYPE_GOOGLE_CREDENTIALS_FILE"}, false), }, - "public_key_type": &schema.Schema{ + "public_key_type": { Type: schema.TypeString, Default: "TYPE_X509_PEM_FILE", Optional: true, @@ -50,7 +50,7 @@ func resourceGoogleServiceAccountKey() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"TYPE_NONE", "TYPE_X509_PEM_FILE", "TYPE_RAW_PUBLIC_KEY"}, false), }, // Computed - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -60,16 +60,16 @@ func resourceGoogleServiceAccountKey() *schema.Resource { Computed: true, ForceNew: true, }, - "private_key": &schema.Schema{ + "private_key": { Type: schema.TypeString, Computed: true, Sensitive: true, }, - "valid_after": &schema.Schema{ + "valid_after": { Type: schema.TypeString, Computed: true, }, - "valid_before": &schema.Schema{ + "valid_before": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_google_service_account_key_test.go b/google/resource_google_service_account_key_test.go index 66d1c77b..0c8e67e4 100644 --- a/google/resource_google_service_account_key_test.go +++ b/google/resource_google_service_account_key_test.go @@ -20,7 +20,7 @@ func TestAccServiceAccountKey_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccServiceAccountKey(accountID, displayName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleServiceAccountKeyExists(resourceName), @@ -44,7 +44,7 @@ func TestAccServiceAccountKey_fromEmail(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccServiceAccountKey_fromEmail(accountID, displayName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleServiceAccountKeyExists(resourceName), @@ -67,7 +67,7 @@ func TestAccServiceAccountKey_pgp(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccServiceAccountKey_pgp(accountID, displayName, testKeyPairPubKey1), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleServiceAccountKeyExists(resourceName), diff --git a/google/resource_google_service_account_test.go b/google/resource_google_service_account_test.go index 251b261a..658c2a10 100644 --- a/google/resource_google_service_account_test.go +++ b/google/resource_google_service_account_test.go @@ -24,33 +24,33 @@ func TestAccServiceAccount_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ // The first step creates a basic service account - resource.TestStep{ + { Config: testAccServiceAccountBasic(accountId, displayName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "google_service_account.acceptance", "project", project), ), }, - resource.TestStep{ + { ResourceName: "google_service_account.acceptance", ImportStateId: fmt.Sprintf("projects/%s/serviceAccounts/%s", project, expectedEmail), ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_service_account.acceptance", ImportStateId: fmt.Sprintf("%s/%s", project, expectedEmail), ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_service_account.acceptance", ImportStateId: expectedEmail, ImportState: true, ImportStateVerify: true, }, // The second step updates the service account - resource.TestStep{ + { Config: testAccServiceAccountBasic(accountId, displayName2), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( @@ -58,14 +58,14 @@ func TestAccServiceAccount_basic(t *testing.T) { testAccStoreServiceAccountUniqueId(&uniqueId), ), }, - resource.TestStep{ + { ResourceName: "google_service_account.acceptance", ImportState: true, ImportStateVerify: true, }, // The third step explicitely adds the same default project to the service account configuration // and ensure the service account is not recreated by comparing the value of its unique_id with the one from the previous step - resource.TestStep{ + { Config: testAccServiceAccountWithProject(project, accountId, displayName2), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( @@ -74,7 +74,7 @@ func TestAccServiceAccount_basic(t *testing.T) { "google_service_account.acceptance", "unique_id", &uniqueId), ), }, - resource.TestStep{ + { ResourceName: "google_service_account.acceptance", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_kms_crypto_key.go b/google/resource_kms_crypto_key.go index abc8e676..25aa3800 100644 --- a/google/resource_kms_crypto_key.go +++ b/google/resource_kms_crypto_key.go @@ -23,23 +23,23 @@ func resourceKmsCryptoKey() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "key_ring": &schema.Schema{ + "key_ring": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: kmsCryptoKeyRingsEquivalent, }, - "rotation_period": &schema.Schema{ + "rotation_period": { Type: schema.TypeString, Optional: true, ValidateFunc: validateKmsCryptoKeyRotationPeriod, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_kms_crypto_key_test.go b/google/resource_kms_crypto_key_test.go index b4986f13..dd23a03d 100644 --- a/google/resource_kms_crypto_key_test.go +++ b/google/resource_kms_crypto_key_test.go @@ -123,16 +123,16 @@ func TestAccKmsCryptoKey_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleKmsCryptoKey_basic(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), }, - resource.TestStep{ + { ResourceName: "google_kms_crypto_key.crypto_key", ImportState: true, ImportStateVerify: true, }, // Use a separate TestStep rather than a CheckDestroy because we need the project to still exist. - resource.TestStep{ + { Config: testGoogleKmsCryptoKey_removed(projectId, projectOrg, projectBillingAccount, keyRingName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleKmsCryptoKeyWasRemovedFromState("google_kms_crypto_key.crypto_key"), @@ -159,32 +159,32 @@ func TestAccKmsCryptoKey_rotation(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleKmsCryptoKey_rotation(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName, rotationPeriod), }, - resource.TestStep{ + { ResourceName: "google_kms_crypto_key.crypto_key", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testGoogleKmsCryptoKey_rotation(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName, updatedRotationPeriod), }, - resource.TestStep{ + { ResourceName: "google_kms_crypto_key.crypto_key", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testGoogleKmsCryptoKey_rotationRemoved(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName), }, - resource.TestStep{ + { ResourceName: "google_kms_crypto_key.crypto_key", ImportState: true, ImportStateVerify: true, }, // Use a separate TestStep rather than a CheckDestroy because we need the project to still exist. - resource.TestStep{ + { Config: testGoogleKmsCryptoKey_removed(projectId, projectOrg, projectBillingAccount, keyRingName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleKmsCryptoKeyWasRemovedFromState("google_kms_crypto_key.crypto_key"), diff --git a/google/resource_kms_key_ring.go b/google/resource_kms_key_ring.go index 1d86b4de..8f6de6b0 100644 --- a/google/resource_kms_key_ring.go +++ b/google/resource_kms_key_ring.go @@ -21,23 +21,23 @@ func resourceKmsKeyRing() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_kms_key_ring_test.go b/google/resource_kms_key_ring_test.go index 8f6a4538..b8e22aa8 100644 --- a/google/resource_kms_key_ring_test.go +++ b/google/resource_kms_key_ring_test.go @@ -82,15 +82,15 @@ func TestAccKmsKeyRing_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckGoogleKmsKeyRingWasRemovedFromState("google_kms_key_ring.key_ring"), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleKmsKeyRing_basic(projectId, projectOrg, projectBillingAccount, keyRingName), }, - resource.TestStep{ + { ResourceName: "google_kms_key_ring.key_ring", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testGoogleKmsKeyRing_removed(projectId, projectOrg, projectBillingAccount), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleKmsKeyRingWasRemovedFromState("google_kms_key_ring.key_ring"), diff --git a/google/resource_monitoring_alert_policy_test.go b/google/resource_monitoring_alert_policy_test.go index 65d635de..66ab1dfe 100644 --- a/google/resource_monitoring_alert_policy_test.go +++ b/google/resource_monitoring_alert_policy_test.go @@ -23,10 +23,10 @@ func TestAccMonitoringAlertPolicy_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAlertPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccMonitoringAlertPolicy_basic(alertName, conditionName, "ALIGN_RATE", filter), }, - resource.TestStep{ + { ResourceName: "google_monitoring_alert_policy.basic", ImportState: true, ImportStateVerify: true, @@ -49,18 +49,18 @@ func TestAccMonitoringAlertPolicy_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAlertPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccMonitoringAlertPolicy_basic(alertName, conditionName, aligner1, filter1), }, - resource.TestStep{ + { ResourceName: "google_monitoring_alert_policy.basic", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccMonitoringAlertPolicy_basic(alertName, conditionName, aligner2, filter2), }, - resource.TestStep{ + { ResourceName: "google_monitoring_alert_policy.basic", ImportState: true, ImportStateVerify: true, @@ -80,10 +80,10 @@ func TestAccMonitoringAlertPolicy_full(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAlertPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccMonitoringAlertPolicy_full(alertName, conditionName1, conditionName2), }, - resource.TestStep{ + { ResourceName: "google_monitoring_alert_policy.full", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_pubsub_subscription.go b/google/resource_pubsub_subscription.go index f4731a3f..5ed68893 100644 --- a/google/resource_pubsub_subscription.go +++ b/google/resource_pubsub_subscription.go @@ -20,51 +20,51 @@ func resourcePubsubSubscription() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "topic": &schema.Schema{ + "topic": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "ack_deadline_seconds": &schema.Schema{ + "ack_deadline_seconds": { Type: schema.TypeInt, Optional: true, Computed: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "path": &schema.Schema{ + "path": { Type: schema.TypeString, Computed: true, }, - "push_config": &schema.Schema{ + "push_config": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attributes": &schema.Schema{ + "attributes": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "push_endpoint": &schema.Schema{ + "push_endpoint": { Type: schema.TypeString, Required: true, }, diff --git a/google/resource_pubsub_subscription_test.go b/google/resource_pubsub_subscription_test.go index d813680b..3d0d9767 100644 --- a/google/resource_pubsub_subscription_test.go +++ b/google/resource_pubsub_subscription_test.go @@ -23,7 +23,7 @@ func TestAccPubsubSubscription_basic(t *testing.T) { { Config: testAccPubsubSubscription_basic(topic, subscription), }, - resource.TestStep{ + { ResourceName: "google_pubsub_subscription.foo", ImportStateId: subscription, ImportState: true, @@ -82,12 +82,12 @@ func TestGetComputedTopicName(t *testing.T) { } var testCases = []testData{ - testData{ + { project: "my-project", topic: "my-topic", expected: "projects/my-project/topics/my-topic", }, - testData{ + { project: "my-project", topic: "projects/another-project/topics/my-topic", expected: "projects/another-project/topics/my-topic", diff --git a/google/resource_pubsub_topic.go b/google/resource_pubsub_topic.go index 8d44a3b0..41c64a89 100644 --- a/google/resource_pubsub_topic.go +++ b/google/resource_pubsub_topic.go @@ -19,14 +19,14 @@ func resourcePubsubTopic() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: linkDiffSuppress, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_pubsub_topic_test.go b/google/resource_pubsub_topic_test.go index 7fd62ba5..e309d745 100644 --- a/google/resource_pubsub_topic_test.go +++ b/google/resource_pubsub_topic_test.go @@ -19,11 +19,11 @@ func TestAccPubsubTopic_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckPubsubTopicDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccPubsubTopic_basic(topicName), }, // Check importing with just the topic name - resource.TestStep{ + { ResourceName: "google_pubsub_topic.foo", ImportStateId: topicName, ImportState: true, @@ -31,7 +31,7 @@ func TestAccPubsubTopic_basic(t *testing.T) { ImportStateVerifyIgnore: []string{"force_destroy"}, }, // Check importing with the full resource id - resource.TestStep{ + { ResourceName: "google_pubsub_topic.foo", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_redis_instance_test.go b/google/resource_redis_instance_test.go index 0415e9be..be030d02 100644 --- a/google/resource_redis_instance_test.go +++ b/google/resource_redis_instance_test.go @@ -18,10 +18,10 @@ func TestAccRedisInstance_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckRedisInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRedisInstance_basic(name), }, - resource.TestStep{ + { ResourceName: "google_redis_instance.test", ImportState: true, ImportStateVerify: true, @@ -40,18 +40,18 @@ func TestAccRedisInstance_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckRedisInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRedisInstance_update(name), }, - resource.TestStep{ + { ResourceName: "google_redis_instance.test", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: testAccRedisInstance_update2(name), }, - resource.TestStep{ + { ResourceName: "google_redis_instance.test", ImportState: true, ImportStateVerify: true, @@ -71,10 +71,10 @@ func TestAccRedisInstance_full(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckRedisInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRedisInstance_full(name, network), }, - resource.TestStep{ + { ResourceName: "google_redis_instance.test", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_resourcemanager_lien_test.go b/google/resource_resourcemanager_lien_test.go index 8e8ff2c9..fcb486cc 100644 --- a/google/resource_resourcemanager_lien_test.go +++ b/google/resource_resourcemanager_lien_test.go @@ -23,14 +23,14 @@ func TestAccResourceManagerLien_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckResourceManagerLienDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccResourceManagerLien_basic(projectName, org), Check: resource.ComposeTestCheckFunc( testAccCheckResourceManagerLienExists( "google_resource_manager_lien.lien", projectName, &lien), ), }, - resource.TestStep{ + { ResourceName: "google_resource_manager_lien.lien", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_runtimeconfig_config_test.go b/google/resource_runtimeconfig_config_test.go index 57ccbdfa..26eab056 100644 --- a/google/resource_runtimeconfig_config_test.go +++ b/google/resource_runtimeconfig_config_test.go @@ -30,7 +30,7 @@ func TestAccRuntimeconfigConfig_basic(t *testing.T) { testAccCheckRuntimeConfigDescription(&runtimeConfig, description), ), }, - resource.TestStep{ + { ResourceName: "google_runtimeconfig_config.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_runtimeconfig_variable_test.go b/google/resource_runtimeconfig_variable_test.go index b2e83e27..69361971 100644 --- a/google/resource_runtimeconfig_variable_test.go +++ b/google/resource_runtimeconfig_variable_test.go @@ -34,7 +34,7 @@ func TestAccRuntimeconfigVariable_basic(t *testing.T) { testAccCheckRuntimeconfigVariableUpdateTime("google_runtimeconfig_variable.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_runtimeconfig_variable.foobar", ImportState: true, ImportStateVerify: true, @@ -99,7 +99,7 @@ func TestAccRuntimeconfigVariable_basicValue(t *testing.T) { testAccCheckRuntimeconfigVariableUpdateTime("google_runtimeconfig_variable.foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_runtimeconfig_variable.foobar", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_source_repos_repository.go b/google/resource_source_repos_repository.go index de228dcd..bf37b02a 100644 --- a/google/resource_source_repos_repository.go +++ b/google/resource_source_repos_repository.go @@ -19,25 +19,25 @@ func resourceSourceRepoRepository() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "size": &schema.Schema{ + "size": { Type: schema.TypeInt, Computed: true, }, - "url": &schema.Schema{ + "url": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_source_repos_repository_test.go b/google/resource_source_repos_repository_test.go index ad1e74b6..9de7dbe7 100644 --- a/google/resource_source_repos_repository_test.go +++ b/google/resource_source_repos_repository_test.go @@ -18,14 +18,14 @@ func TestAccSourceRepoRepository_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckSourceRepoRepositoryDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccSourceRepoRepository_basic(repositoryName), Check: resource.ComposeTestCheckFunc( testAccCheckSourceRepoRepositoryExists( "google_sourcerepo_repository.acceptance", repositoryName), ), }, - resource.TestStep{ + { ResourceName: "google_sourcerepo_repository.acceptance", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_spanner_database.go b/google/resource_spanner_database.go index d1130c4c..07a50ab6 100644 --- a/google/resource_spanner_database.go +++ b/google/resource_spanner_database.go @@ -25,13 +25,13 @@ func resourceSpannerDatabase() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "instance": &schema.Schema{ + "instance": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -45,7 +45,7 @@ func resourceSpannerDatabase() *schema.Resource { ForceNew: true, }, - "ddl": &schema.Schema{ + "ddl": { Type: schema.TypeList, Optional: true, ForceNew: true, diff --git a/google/resource_spanner_database_iam_test.go b/google/resource_spanner_database_iam_test.go index 058997db..65167c67 100644 --- a/google/resource_spanner_database_iam_test.go +++ b/google/resource_spanner_database_iam_test.go @@ -24,7 +24,7 @@ func TestAccSpannerDatabaseIamBinding(t *testing.T) { { Config: testAccSpannerDatabaseIamBinding_basic(account, instance, database, role), }, - resource.TestStep{ + { ResourceName: "google_spanner_database_iam_binding.foo", ImportStateId: fmt.Sprintf("%s %s", spannerDatabaseId{ Project: project, @@ -38,7 +38,7 @@ func TestAccSpannerDatabaseIamBinding(t *testing.T) { // Test Iam Binding update Config: testAccSpannerDatabaseIamBinding_update(account, instance, database, role), }, - resource.TestStep{ + { ResourceName: "google_spanner_database_iam_binding.foo", ImportStateId: fmt.Sprintf("%s %s", spannerDatabaseId{ Project: project, @@ -69,7 +69,7 @@ func TestAccSpannerDatabaseIamMember(t *testing.T) { // Test Iam Member creation (no update for member, no need to test) Config: testAccSpannerDatabaseIamMember_basic(account, instance, database, role), }, - resource.TestStep{ + { ResourceName: "google_spanner_database_iam_member.foo", ImportStateId: fmt.Sprintf("%s %s serviceAccount:%s@%s.iam.gserviceaccount.com", spannerDatabaseId{ Instance: instance, @@ -100,7 +100,7 @@ func TestAccSpannerDatabaseIamPolicy(t *testing.T) { Config: testAccSpannerDatabaseIamPolicy_basic(account, instance, database, role), }, // Test a few import formats - resource.TestStep{ + { ResourceName: "google_spanner_database_iam_policy.foo", ImportStateId: fmt.Sprintf("%s", spannerDatabaseId{ Instance: instance, diff --git a/google/resource_spanner_instance.go b/google/resource_spanner_instance.go index 7efd896b..cd052f09 100644 --- a/google/resource_spanner_instance.go +++ b/google/resource_spanner_instance.go @@ -26,13 +26,13 @@ func resourceSpannerInstance() *schema.Resource { Schema: map[string]*schema.Schema{ - "config": &schema.Schema{ + "config": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, Computed: true, @@ -60,7 +60,7 @@ func resourceSpannerInstance() *schema.Resource { }, }, - "display_name": &schema.Schema{ + "display_name": { Type: schema.TypeString, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { @@ -74,7 +74,7 @@ func resourceSpannerInstance() *schema.Resource { }, }, - "num_nodes": &schema.Schema{ + "num_nodes": { Type: schema.TypeInt, Optional: true, Default: 1, diff --git a/google/resource_spanner_instance_iam_test.go b/google/resource_spanner_instance_iam_test.go index 0609c8fc..e6534d91 100644 --- a/google/resource_spanner_instance_iam_test.go +++ b/google/resource_spanner_instance_iam_test.go @@ -23,7 +23,7 @@ func TestAccSpannerInstanceIamBinding(t *testing.T) { { Config: testAccSpannerInstanceIamBinding_basic(account, instance, role), }, - resource.TestStep{ + { ResourceName: "google_spanner_instance_iam_binding.foo", ImportStateId: fmt.Sprintf("%s %s", spannerInstanceId{ Project: project, @@ -36,7 +36,7 @@ func TestAccSpannerInstanceIamBinding(t *testing.T) { // Test Iam Binding update Config: testAccSpannerInstanceIamBinding_update(account, instance, role), }, - resource.TestStep{ + { ResourceName: "google_spanner_instance_iam_binding.foo", ImportStateId: fmt.Sprintf("%s %s", spannerInstanceId{ Project: project, @@ -65,7 +65,7 @@ func TestAccSpannerInstanceIamMember(t *testing.T) { // Test Iam Member creation (no update for member, no need to test) Config: testAccSpannerInstanceIamMember_basic(account, instance, role), }, - resource.TestStep{ + { ResourceName: "google_spanner_instance_iam_member.foo", ImportStateId: fmt.Sprintf("%s %s serviceAccount:%s@%s.iam.gserviceaccount.com", spannerInstanceId{ Instance: instance, @@ -94,7 +94,7 @@ func TestAccSpannerInstanceIamPolicy(t *testing.T) { Config: testAccSpannerInstanceIamPolicy_basic(account, instance, role), }, // Test a few import formats - resource.TestStep{ + { ResourceName: "google_spanner_instance_iam_policy.foo", ImportStateId: fmt.Sprintf("%s", spannerInstanceId{ Instance: instance, diff --git a/google/resource_sql_database.go b/google/resource_sql_database.go index 5079c1c5..ffaf48cc 100644 --- a/google/resource_sql_database.go +++ b/google/resource_sql_database.go @@ -21,37 +21,37 @@ func resourceSqlDatabase() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "instance": &schema.Schema{ + "instance": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "charset": &schema.Schema{ + "charset": { Type: schema.TypeString, Optional: true, Computed: true, }, - "collation": &schema.Schema{ + "collation": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_sql_database_instance.go b/google/resource_sql_database_instance.go index 32e1a9f9..3fe25d9c 100644 --- a/google/resource_sql_database_instance.go +++ b/google/resource_sql_database_instance.go @@ -20,15 +20,15 @@ const privateNetworkLinkRegex = "projects/(" + ProjectRegex + ")/global/networks var sqlDatabaseAuthorizedNetWorkSchemaElem *schema.Resource = &schema.Resource{ Schema: map[string]*schema.Schema{ - "expiration_time": &schema.Schema{ + "expiration_time": { Type: schema.TypeString, Optional: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, }, - "value": &schema.Schema{ + "value": { Type: schema.TypeString, Optional: true, }, @@ -55,39 +55,39 @@ func resourceSqlDatabaseInstance() *schema.Resource { customdiff.ForceNewIfChange("settings.0.disk_size", isDiskShrinkage)), Schema: map[string]*schema.Schema{ - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "settings": &schema.Schema{ + "settings": { Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "version": &schema.Schema{ + "version": { Type: schema.TypeInt, Computed: true, }, - "tier": &schema.Schema{ + "tier": { Type: schema.TypeString, Required: true, }, - "activation_policy": &schema.Schema{ + "activation_policy": { Type: schema.TypeString, Optional: true, // Defaults differ between first and second gen instances Computed: true, }, - "authorized_gae_applications": &schema.Schema{ + "authorized_gae_applications": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "availability_type": &schema.Schema{ + "availability_type": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: suppressFirstGen, @@ -97,22 +97,22 @@ func resourceSqlDatabaseInstance() *schema.Resource { Computed: true, ValidateFunc: validation.StringInSlice([]string{"REGIONAL", "ZONAL"}, false), }, - "backup_configuration": &schema.Schema{ + "backup_configuration": { Type: schema.TypeList, Optional: true, Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "binary_log_enabled": &schema.Schema{ + "binary_log_enabled": { Type: schema.TypeBool, Optional: true, }, - "enabled": &schema.Schema{ + "enabled": { Type: schema.TypeBool, Optional: true, }, - "start_time": &schema.Schema{ + "start_time": { Type: schema.TypeString, Optional: true, // start_time is randomly assigned if not set @@ -121,69 +121,69 @@ func resourceSqlDatabaseInstance() *schema.Resource { }, }, }, - "crash_safe_replication": &schema.Schema{ + "crash_safe_replication": { Type: schema.TypeBool, Optional: true, Computed: true, }, - "database_flags": &schema.Schema{ + "database_flags": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "value": &schema.Schema{ + "value": { Type: schema.TypeString, Optional: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, }, }, }, }, - "disk_autoresize": &schema.Schema{ + "disk_autoresize": { Type: schema.TypeBool, Optional: true, Default: true, DiffSuppressFunc: suppressFirstGen, }, - "disk_size": &schema.Schema{ + "disk_size": { Type: schema.TypeInt, Optional: true, // Defaults differ between first and second gen instances Computed: true, }, - "disk_type": &schema.Schema{ + "disk_type": { Type: schema.TypeString, Optional: true, // Set computed instead of default because this property is for second-gen only. Computed: true, }, - "ip_configuration": &schema.Schema{ + "ip_configuration": { Type: schema.TypeList, Optional: true, Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "authorized_networks": &schema.Schema{ + "authorized_networks": { Type: schema.TypeSet, Optional: true, Set: schema.HashResource(sqlDatabaseAuthorizedNetWorkSchemaElem), Elem: sqlDatabaseAuthorizedNetWorkSchemaElem, }, - "ipv4_enabled": &schema.Schema{ + "ipv4_enabled": { Type: schema.TypeBool, Optional: true, // Defaults differ between first and second gen instances Computed: true, }, - "require_ssl": &schema.Schema{ + "require_ssl": { Type: schema.TypeBool, Optional: true, }, - "private_network": &schema.Schema{ + "private_network": { Type: schema.TypeString, Optional: true, ValidateFunc: validateRegexp(privateNetworkLinkRegex), @@ -192,58 +192,58 @@ func resourceSqlDatabaseInstance() *schema.Resource { }, }, }, - "location_preference": &schema.Schema{ + "location_preference": { Type: schema.TypeList, Optional: true, MaxItems: 1, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "follow_gae_application": &schema.Schema{ + "follow_gae_application": { Type: schema.TypeString, Optional: true, }, - "zone": &schema.Schema{ + "zone": { Type: schema.TypeString, Optional: true, }, }, }, }, - "maintenance_window": &schema.Schema{ + "maintenance_window": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "day": &schema.Schema{ + "day": { Type: schema.TypeInt, Optional: true, ValidateFunc: validation.IntBetween(1, 7), }, - "hour": &schema.Schema{ + "hour": { Type: schema.TypeInt, Optional: true, ValidateFunc: validation.IntBetween(0, 23), }, - "update_track": &schema.Schema{ + "update_track": { Type: schema.TypeString, Optional: true, }, }, }, }, - "pricing_plan": &schema.Schema{ + "pricing_plan": { Type: schema.TypeString, Optional: true, Default: "PER_USE", }, - "replication_type": &schema.Schema{ + "replication_type": { Type: schema.TypeString, Optional: true, Default: "SYNCHRONOUS", }, - "user_labels": &schema.Schema{ + "user_labels": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -253,32 +253,32 @@ func resourceSqlDatabaseInstance() *schema.Resource { }, }, - "connection_name": &schema.Schema{ + "connection_name": { Type: schema.TypeString, Computed: true, }, - "database_version": &schema.Schema{ + "database_version": { Type: schema.TypeString, Optional: true, Default: "MYSQL_5_6", ForceNew: true, }, - "ip_address": &schema.Schema{ + "ip_address": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ip_address": &schema.Schema{ + "ip_address": { Type: schema.TypeString, Computed: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Computed: true, }, - "time_to_retire": &schema.Schema{ + "time_to_retire": { Type: schema.TypeString, Optional: true, Computed: true, @@ -287,33 +287,33 @@ func resourceSqlDatabaseInstance() *schema.Resource { }, }, - "first_ip_address": &schema.Schema{ + "first_ip_address": { Type: schema.TypeString, Computed: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "master_instance_name": &schema.Schema{ + "master_instance_name": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "replica_configuration": &schema.Schema{ + "replica_configuration": { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -321,58 +321,58 @@ func resourceSqlDatabaseInstance() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ca_certificate": &schema.Schema{ + "ca_certificate": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "client_certificate": &schema.Schema{ + "client_certificate": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "client_key": &schema.Schema{ + "client_key": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "connect_retry_interval": &schema.Schema{ + "connect_retry_interval": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "dump_file_path": &schema.Schema{ + "dump_file_path": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "failover_target": &schema.Schema{ + "failover_target": { Type: schema.TypeBool, Optional: true, ForceNew: true, }, - "master_heartbeat_period": &schema.Schema{ + "master_heartbeat_period": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "password": &schema.Schema{ + "password": { Type: schema.TypeString, Optional: true, ForceNew: true, Sensitive: true, }, - "ssl_cipher": &schema.Schema{ + "ssl_cipher": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "username": &schema.Schema{ + "username": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "verify_server_certificate": &schema.Schema{ + "verify_server_certificate": { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -380,40 +380,40 @@ func resourceSqlDatabaseInstance() *schema.Resource { }, }, }, - "server_ca_cert": &schema.Schema{ + "server_ca_cert": { Type: schema.TypeList, Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "cert": &schema.Schema{ + "cert": { Type: schema.TypeString, Computed: true, }, - "common_name": &schema.Schema{ + "common_name": { Type: schema.TypeString, Computed: true, }, - "create_time": &schema.Schema{ + "create_time": { Type: schema.TypeString, Computed: true, }, - "expiration_time": &schema.Schema{ + "expiration_time": { Type: schema.TypeString, Computed: true, }, - "sha1_fingerprint": &schema.Schema{ + "sha1_fingerprint": { Type: schema.TypeString, Computed: true, }, }, }, }, - "service_account_email_address": &schema.Schema{ + "service_account_email_address": { Type: schema.TypeString, Computed: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_sql_database_instance_test.go b/google/resource_sql_database_instance_test.go index 7dd072ff..2da50af1 100644 --- a/google/resource_sql_database_instance_test.go +++ b/google/resource_sql_database_instance_test.go @@ -158,21 +158,21 @@ func TestAccSqlDatabaseInstance_basicFirstGen(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf(testGoogleSqlDatabaseInstance_basic, instanceID), }, - resource.TestStep{ + { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: resourceName, ImportStateId: fmt.Sprintf("projects/%s/instances/%s", getTestProjectFromEnv(), instanceName), ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: resourceName, ImportStateId: fmt.Sprintf("%s/%s", getTestProjectFromEnv(), instanceName), ImportState: true, @@ -190,10 +190,10 @@ func TestAccSqlDatabaseInstance_basicInferredName(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleSqlDatabaseInstance_basic2, }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -212,12 +212,12 @@ func TestAccSqlDatabaseInstance_basicSecondGen(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_basic3, databaseName), Check: testAccCheckGoogleSqlDatabaseRootUserDoesNotExist(databaseName), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -240,15 +240,15 @@ func TestAccSqlDatabaseInstance_dontDeleteDefaultUserOnReplica(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleSqlDatabaseInstanceConfig_withoutReplica(databaseName), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { PreConfig: func() { // Add a root user config := testAccProvider.Meta().(*Config) @@ -284,11 +284,11 @@ func TestAccSqlDatabaseInstance_settings_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_settings, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -307,22 +307,22 @@ func TestAccSqlDatabaseInstance_replica(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_replica, databaseID, databaseID, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance_master", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.replica1", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: ignoredReplicaConfigurationFields, }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.replica2", ImportState: true, ImportStateVerify: true, @@ -343,16 +343,16 @@ func TestAccSqlDatabaseInstance_slave(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_slave, masterID, slaveID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance_master", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance_slave", ImportState: true, ImportStateVerify: true, @@ -371,11 +371,11 @@ func TestAccSqlDatabaseInstance_highAvailability(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_highAvailability, instanceID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -394,11 +394,11 @@ func TestAccSqlDatabaseInstance_diskspecs(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_diskspecs, masterID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -417,11 +417,11 @@ func TestAccSqlDatabaseInstance_maintenance(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_maintenance, masterID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -440,20 +440,20 @@ func TestAccSqlDatabaseInstance_settings_upgrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_basic, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_settings, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -472,20 +472,20 @@ func TestAccSqlDatabaseInstance_settingsDowngrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_settings, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_basic, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -505,29 +505,29 @@ func TestAccSqlDatabaseInstance_authNets(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_authNets_step1, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_authNets_step2, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_authNets_step1, databaseID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -548,11 +548,11 @@ func TestAccSqlDatabaseInstance_multipleOperations(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_multipleOperations, databaseID, instanceID, userID), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, @@ -571,21 +571,21 @@ func TestAccSqlDatabaseInstance_basic_with_user_labels(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseInstanceDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_basic_with_user_labels, databaseName), Check: testAccCheckGoogleSqlDatabaseRootUserDoesNotExist(databaseName), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabaseInstance_basic_with_user_labels_update, databaseName), }, - resource.TestStep{ + { ResourceName: "google_sql_database_instance.instance", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_sql_database_test.go b/google/resource_sql_database_test.go index 6e5f9c6c..eb995691 100644 --- a/google/resource_sql_database_test.go +++ b/google/resource_sql_database_test.go @@ -25,38 +25,38 @@ func TestAccSqlDatabase_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf(testGoogleSqlDatabase_basic, instanceName, dbName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleSqlDatabaseExists(resourceName, &database), testAccCheckGoogleSqlDatabaseEquals(resourceName, &database), ), }, - resource.TestStep{ + { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: resourceName, ImportStateId: fmt.Sprintf("%s/%s", instanceName, dbName), ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: resourceName, ImportStateId: fmt.Sprintf("instances/%s/databases/%s", instanceName, dbName), ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: resourceName, ImportStateId: fmt.Sprintf("%s/%s/%s", getTestProjectFromEnv(), instanceName, dbName), ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: resourceName, ImportStateId: fmt.Sprintf("projects/%s/instances/%s/databases/%s", getTestProjectFromEnv(), instanceName, dbName), ImportState: true, @@ -79,7 +79,7 @@ func TestAccSqlDatabase_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlDatabaseDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabase_basic, instance_name, database_name), Check: resource.ComposeTestCheckFunc( @@ -89,7 +89,7 @@ func TestAccSqlDatabase_update(t *testing.T) { "google_sql_database.database", &database), ), }, - resource.TestStep{ + { Config: fmt.Sprintf( testGoogleSqlDatabase_latin1, instance_name, database_name), Check: resource.ComposeTestCheckFunc( diff --git a/google/resource_sql_ssl_cert.go b/google/resource_sql_ssl_cert.go index 7337b3fb..2e6d040c 100644 --- a/google/resource_sql_ssl_cert.go +++ b/google/resource_sql_ssl_cert.go @@ -17,50 +17,50 @@ func resourceSqlSslCert() *schema.Resource { SchemaVersion: 1, Schema: map[string]*schema.Schema{ - "common_name": &schema.Schema{ + "common_name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "instance": &schema.Schema{ + "instance": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "cert": &schema.Schema{ + "cert": { Type: schema.TypeString, Computed: true, }, - "cert_serial_number": &schema.Schema{ + "cert_serial_number": { Type: schema.TypeString, Computed: true, }, - "create_time": &schema.Schema{ + "create_time": { Type: schema.TypeString, Computed: true, }, - "expiration_time": &schema.Schema{ + "expiration_time": { Type: schema.TypeString, Computed: true, }, - "private_key": &schema.Schema{ + "private_key": { Type: schema.TypeString, Computed: true, Sensitive: true, }, - "server_ca_cert": &schema.Schema{ + "server_ca_cert": { Type: schema.TypeString, Computed: true, }, - "sha1_fingerprint": &schema.Schema{ + "sha1_fingerprint": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_sql_ssl_cert_test.go b/google/resource_sql_ssl_cert_test.go index 90df41e0..7d605f87 100644 --- a/google/resource_sql_ssl_cert_test.go +++ b/google/resource_sql_ssl_cert_test.go @@ -18,7 +18,7 @@ func TestAccSqlClientCert_mysql(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlClientCertDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleSqlClientCert_mysql(instance), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleSqlClientCertExists("google_sql_ssl_cert.cert1"), @@ -38,7 +38,7 @@ func TestAccSqlClientCert_postgres(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlClientCertDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleSqlClientCert_postgres(instance), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleSqlClientCertExists("google_sql_ssl_cert.cert"), diff --git a/google/resource_sql_user.go b/google/resource_sql_user.go index bbc869e2..d11702c5 100644 --- a/google/resource_sql_user.go +++ b/google/resource_sql_user.go @@ -23,31 +23,31 @@ func resourceSqlUser() *schema.Resource { MigrateState: resourceSqlUserMigrateState, Schema: map[string]*schema.Schema{ - "host": &schema.Schema{ + "host": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "instance": &schema.Schema{ + "instance": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "password": &schema.Schema{ + "password": { Type: schema.TypeString, Optional: true, Sensitive: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_sql_user_test.go b/google/resource_sql_user_test.go index d7869b59..e061921a 100644 --- a/google/resource_sql_user_test.go +++ b/google/resource_sql_user_test.go @@ -18,14 +18,14 @@ func TestAccSqlUser_mysql(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlUserDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleSqlUser_mysql(instance, "password"), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleSqlUserExists("google_sql_user.user1"), testAccCheckGoogleSqlUserExists("google_sql_user.user2"), ), }, - resource.TestStep{ + { // Update password Config: testGoogleSqlUser_mysql(instance, "new_password"), Check: resource.ComposeTestCheckFunc( @@ -33,7 +33,7 @@ func TestAccSqlUser_mysql(t *testing.T) { testAccCheckGoogleSqlUserExists("google_sql_user.user2"), ), }, - resource.TestStep{ + { ResourceName: "google_sql_user.user2", ImportStateId: instance + "/gmail.com/admin", ImportState: true, @@ -53,20 +53,20 @@ func TestAccSqlUser_postgres(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccSqlUserDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleSqlUser_postgres(instance, "password"), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleSqlUserExists("google_sql_user.user"), ), }, - resource.TestStep{ + { // Update password Config: testGoogleSqlUser_postgres(instance, "new_password"), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleSqlUserExists("google_sql_user.user"), ), }, - resource.TestStep{ + { ResourceName: "google_sql_user.user", ImportStateId: instance + "/admin", ImportState: true, diff --git a/google/resource_storage_bucket.go b/google/resource_storage_bucket.go index 6cf86073..34d6e559 100644 --- a/google/resource_storage_bucket.go +++ b/google/resource_storage_bucket.go @@ -28,19 +28,19 @@ func resourceStorageBucket() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "encryption": &schema.Schema{ + "encryption": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "default_kms_key_name": &schema.Schema{ + "default_kms_key_name": { Type: schema.TypeString, Required: true, }, @@ -48,24 +48,24 @@ func resourceStorageBucket() *schema.Resource { }, }, - "requester_pays": &schema.Schema{ + "requester_pays": { Type: schema.TypeBool, Optional: true, }, - "force_destroy": &schema.Schema{ + "force_destroy": { Type: schema.TypeBool, Optional: true, Default: false, }, - "labels": &schema.Schema{ + "labels": { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Default: "US", Optional: true, @@ -75,31 +75,31 @@ func resourceStorageBucket() *schema.Resource { }, }, - "predefined_acl": &schema.Schema{ + "predefined_acl": { Type: schema.TypeString, Removed: "Please use resource \"storage_bucket_acl.predefined_acl\" instead.", Optional: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, - "url": &schema.Schema{ + "url": { Type: schema.TypeString, Computed: true, }, - "storage_class": &schema.Schema{ + "storage_class": { Type: schema.TypeString, Optional: true, Default: "STANDARD", @@ -168,7 +168,7 @@ func resourceStorageBucket() *schema.Resource { }, }, - "versioning": &schema.Schema{ + "versioning": { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -183,16 +183,16 @@ func resourceStorageBucket() *schema.Resource { }, }, - "website": &schema.Schema{ + "website": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "main_page_suffix": &schema.Schema{ + "main_page_suffix": { Type: schema.TypeString, Optional: true, }, - "not_found_page": &schema.Schema{ + "not_found_page": { Type: schema.TypeString, Optional: true, }, @@ -200,50 +200,50 @@ func resourceStorageBucket() *schema.Resource { }, }, - "cors": &schema.Schema{ + "cors": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "origin": &schema.Schema{ + "origin": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "method": &schema.Schema{ + "method": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "response_header": &schema.Schema{ + "response_header": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "max_age_seconds": &schema.Schema{ + "max_age_seconds": { Type: schema.TypeInt, Optional: true, }, }, }, }, - "logging": &schema.Schema{ + "logging": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "log_bucket": &schema.Schema{ + "log_bucket": { Type: schema.TypeString, Required: true, }, - "log_object_prefix": &schema.Schema{ + "log_object_prefix": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_storage_bucket_acl.go b/google/resource_storage_bucket_acl.go index e260607a..20a2e780 100644 --- a/google/resource_storage_bucket_acl.go +++ b/google/resource_storage_bucket_acl.go @@ -20,25 +20,25 @@ func resourceStorageBucketAcl() *schema.Resource { CustomizeDiff: resourceStorageRoleEntityCustomizeDiff, Schema: map[string]*schema.Schema{ - "bucket": &schema.Schema{ + "bucket": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "default_acl": &schema.Schema{ + "default_acl": { Type: schema.TypeString, Optional: true, }, - "predefined_acl": &schema.Schema{ + "predefined_acl": { Type: schema.TypeString, Optional: true, ForceNew: true, ConflictsWith: []string{"role_entity"}, }, - "role_entity": &schema.Schema{ + "role_entity": { Type: schema.TypeList, Optional: true, Computed: true, @@ -68,7 +68,7 @@ func resourceStorageRoleEntityCustomizeDiff(diff *schema.ResourceDiff, meta inte if len(state) != len(conf) { return nil } - for k, _ := range state { + for k := range state { if _, ok := conf[k]; !ok { return nil } diff --git a/google/resource_storage_bucket_acl_test.go b/google/resource_storage_bucket_acl_test.go index 53885ffb..ed2a58e7 100644 --- a/google/resource_storage_bucket_acl_test.go +++ b/google/resource_storage_bucket_acl_test.go @@ -35,7 +35,7 @@ func TestAccStorageBucketAcl_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsAclBasic1(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageBucketAcl(bucketName, roleEntityBasic1), @@ -56,7 +56,7 @@ func TestAccStorageBucketAcl_upgrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsAclBasic1(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageBucketAcl(bucketName, roleEntityBasic1), @@ -64,7 +64,7 @@ func TestAccStorageBucketAcl_upgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageBucketsAclBasic2(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageBucketAcl(bucketName, roleEntityBasic2), @@ -72,7 +72,7 @@ func TestAccStorageBucketAcl_upgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageBucketsAclBasicDelete(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageBucketAclDelete(bucketName, roleEntityBasic1), @@ -94,7 +94,7 @@ func TestAccStorageBucketAcl_downgrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsAclBasic2(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageBucketAcl(bucketName, roleEntityBasic2), @@ -102,7 +102,7 @@ func TestAccStorageBucketAcl_downgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageBucketsAclBasic3(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageBucketAcl(bucketName, roleEntityBasic2), @@ -110,7 +110,7 @@ func TestAccStorageBucketAcl_downgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageBucketsAclBasicDelete(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageBucketAclDelete(bucketName, roleEntityBasic1), @@ -131,7 +131,7 @@ func TestAccStorageBucketAcl_predefined(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsAclPredefined(bucketName), }, }, @@ -149,7 +149,7 @@ func TestAccStorageBucketAcl_unordered(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsAclUnordered(bucketName), }, }, diff --git a/google/resource_storage_bucket_object.go b/google/resource_storage_bucket_object.go index 77289efd..e183e442 100644 --- a/google/resource_storage_bucket_object.go +++ b/google/resource_storage_bucket_object.go @@ -24,74 +24,74 @@ func resourceStorageBucketObject() *schema.Resource { Delete: resourceStorageBucketObjectDelete, Schema: map[string]*schema.Schema{ - "bucket": &schema.Schema{ + "bucket": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "cache_control": &schema.Schema{ + "cache_control": { Type: schema.TypeString, ForceNew: true, Optional: true, }, - "content_disposition": &schema.Schema{ + "content_disposition": { Type: schema.TypeString, ForceNew: true, Optional: true, }, - "content_encoding": &schema.Schema{ + "content_encoding": { Type: schema.TypeString, ForceNew: true, Optional: true, }, - "content_language": &schema.Schema{ + "content_language": { Type: schema.TypeString, ForceNew: true, Optional: true, }, - "content_type": &schema.Schema{ + "content_type": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "content": &schema.Schema{ + "content": { Type: schema.TypeString, Optional: true, ForceNew: true, ConflictsWith: []string{"source"}, }, - "crc32c": &schema.Schema{ + "crc32c": { Type: schema.TypeString, Computed: true, }, - "md5hash": &schema.Schema{ + "md5hash": { Type: schema.TypeString, Computed: true, }, - "predefined_acl": &schema.Schema{ + "predefined_acl": { Type: schema.TypeString, Removed: "Please use resource \"storage_object_acl.predefined_acl\" instead.", Optional: true, ForceNew: true, }, - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -99,7 +99,7 @@ func resourceStorageBucketObject() *schema.Resource { }, // Detect changes to local file or changes made outside of Terraform to the file stored on the server. - "detect_md5hash": &schema.Schema{ + "detect_md5hash": { Type: schema.TypeString, // This field is not Computed because it needs to trigger a diff. Optional: true, @@ -138,7 +138,7 @@ func resourceStorageBucketObject() *schema.Resource { }, }, - "storage_class": &schema.Schema{ + "storage_class": { Type: schema.TypeString, Optional: true, ForceNew: true, diff --git a/google/resource_storage_bucket_object_test.go b/google/resource_storage_bucket_object_test.go index b7df23aa..0204d052 100644 --- a/google/resource_storage_bucket_object_test.go +++ b/google/resource_storage_bucket_object_test.go @@ -36,7 +36,7 @@ func TestAccStorageObject_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsObjectBasic(bucketName, testFile.Name()), Check: testAccCheckGoogleStorageObject(bucketName, objectName, data_md5), }, @@ -67,11 +67,11 @@ func TestAccStorageObject_recreate(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsObjectBasic(bucketName, testFile.Name()), Check: testAccCheckGoogleStorageObject(bucketName, objectName, data_md5), }, - resource.TestStep{ + { PreConfig: func() { err := os.Rename(updatedName, testFile.Name()) if err != nil { @@ -101,7 +101,7 @@ func TestAccStorageObject_content(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsObjectContent(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObject(bucketName, objectName, data_md5), @@ -132,7 +132,7 @@ func TestAccStorageObject_withContentCharacteristics(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsObject_optionalContentFields( bucketName, disposition, encoding, language, content_type), Check: resource.ComposeTestCheckFunc( @@ -159,7 +159,7 @@ func TestAccStorageObject_dynamicContent(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsObjectDynamicContent(testBucketName()), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( @@ -189,7 +189,7 @@ func TestAccStorageObject_cacheControl(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsObject_cacheControl(bucketName, testFile.Name(), cacheControl), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObject(bucketName, objectName, data_md5), @@ -218,7 +218,7 @@ func TestAccStorageObject_storageClass(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsObject_storageClass(bucketName, storageClass), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObject(bucketName, objectName, data_md5), diff --git a/google/resource_storage_bucket_test.go b/google/resource_storage_bucket_test.go index 0786f9e5..962c29ed 100644 --- a/google/resource_storage_bucket_test.go +++ b/google/resource_storage_bucket_test.go @@ -25,7 +25,7 @@ func TestAccStorageBucket_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_basic(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -38,7 +38,7 @@ func TestAccStorageBucket_basic(t *testing.T) { "google_storage_bucket.bucket", "project", getTestProjectFromEnv()), ), }, - resource.TestStep{ + { ResourceName: "google_storage_bucket.bucket", ImportState: true, ImportStateVerify: true, @@ -58,7 +58,7 @@ func TestAccStorageBucket_requesterPays(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_requesterPays(bucketName, true), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -67,7 +67,7 @@ func TestAccStorageBucket_requesterPays(t *testing.T) { "google_storage_bucket.bucket", "requester_pays", "true"), ), }, - resource.TestStep{ + { ResourceName: "google_storage_bucket.bucket", ImportState: true, ImportStateVerify: true, @@ -87,7 +87,7 @@ func TestAccStorageBucket_lowercaseLocation(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_lowercaseLocation(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -109,7 +109,7 @@ func TestAccStorageBucket_customAttributes(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -143,7 +143,7 @@ func TestAccStorageBucket_lifecycleRules(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_lifecycleRules(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -172,7 +172,7 @@ func TestAccStorageBucket_lifecycleRules(t *testing.T) { "google_storage_bucket.bucket", fmt.Sprintf("lifecycle_rule.1.condition.%d.age", hash_step0_lc1_condition), "10"), ), }, - resource.TestStep{ + { ResourceName: "google_storage_bucket.bucket", ImportState: true, ImportStateVerify: true, @@ -246,7 +246,7 @@ func TestAccStorageBucket_update_requesterPays(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_requesterPays(bucketName, true), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -255,7 +255,7 @@ func TestAccStorageBucket_update_requesterPays(t *testing.T) { "google_storage_bucket.bucket", "requester_pays", "true"), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_requesterPays(bucketName, false), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -288,7 +288,7 @@ func TestAccStorageBucket_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_basic(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -301,7 +301,7 @@ func TestAccStorageBucket_update(t *testing.T) { "google_storage_bucket.bucket", "force_destroy", "false"), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -314,7 +314,7 @@ func TestAccStorageBucket_update(t *testing.T) { "google_storage_bucket.bucket", "force_destroy", "true"), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes_withLifecycle1(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -337,7 +337,7 @@ func TestAccStorageBucket_update(t *testing.T) { "google_storage_bucket.bucket", fmt.Sprintf("lifecycle_rule.0.condition.%d.age", hash_step2_lc0_condition), "10"), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes_withLifecycle2(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -370,7 +370,7 @@ func TestAccStorageBucket_update(t *testing.T) { "google_storage_bucket.bucket", fmt.Sprintf("lifecycle_rule.1.condition.%d.num_newer_versions", hash_step3_lc1_condition), "2"), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -398,20 +398,20 @@ func TestAccStorageBucket_forceDestroy(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( "google_storage_bucket.bucket", bucketName, &bucket), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketPutItem(bucketName), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_customAttributes(acctest.RandomWithPrefix("tf-test-acl-bucket")), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketMissing(bucketName), @@ -432,20 +432,20 @@ func TestAccStorageBucket_forceDestroyWithVersioning(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_forceDestroyWithVersioning(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( "google_storage_bucket.bucket", bucketName, &bucket), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_forceDestroyWithVersioning(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketPutItem(bucketName), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_forceDestroyWithVersioning(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketPutItem(bucketName), @@ -466,7 +466,7 @@ func TestAccStorageBucket_versioning(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_versioning(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -477,7 +477,7 @@ func TestAccStorageBucket_versioning(t *testing.T) { "google_storage_bucket.bucket", "versioning.0.enabled", "true"), ), }, - resource.TestStep{ + { ResourceName: "google_storage_bucket.bucket", ImportState: true, ImportStateVerify: true, @@ -497,7 +497,7 @@ func TestAccStorageBucket_logging(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_logging(bucketName, "log-bucket"), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -510,7 +510,7 @@ func TestAccStorageBucket_logging(t *testing.T) { "google_storage_bucket.bucket", "logging.0.log_object_prefix", bucketName), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_loggingWithPrefix(bucketName, "another-log-bucket", "object-prefix"), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -523,7 +523,7 @@ func TestAccStorageBucket_logging(t *testing.T) { "google_storage_bucket.bucket", "logging.0.log_object_prefix", "object-prefix"), ), }, - resource.TestStep{ + { Config: testAccStorageBucket_basic(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -547,7 +547,7 @@ func TestAccStorageBucket_cors(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageBucketsCors(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -623,7 +623,7 @@ func TestAccStorageBucket_encryption(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccStorageBucket_encryption(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName, bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -646,7 +646,7 @@ func TestAccStorageBucket_labels(t *testing.T) { CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ // Going from two labels - resource.TestStep{ + { Config: testAccStorageBucket_updateLabels(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -655,13 +655,13 @@ func TestAccStorageBucket_labels(t *testing.T) { testAccCheckStorageBucketHasLabel(&bucket, "a-new-label", "a-new-label-value"), ), }, - resource.TestStep{ + { ResourceName: "google_storage_bucket.bucket", ImportState: true, ImportStateVerify: true, }, // Down to only one label (test single label deletion) - resource.TestStep{ + { Config: testAccStorageBucket_labels(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -669,13 +669,13 @@ func TestAccStorageBucket_labels(t *testing.T) { testAccCheckStorageBucketHasLabel(&bucket, "my-label", "my-label-value"), ), }, - resource.TestStep{ + { ResourceName: "google_storage_bucket.bucket", ImportState: true, ImportStateVerify: true, }, // And make sure deleting all labels work - resource.TestStep{ + { Config: testAccStorageBucket_basic(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( @@ -683,7 +683,7 @@ func TestAccStorageBucket_labels(t *testing.T) { testAccCheckStorageBucketHasNoLabels(&bucket), ), }, - resource.TestStep{ + { ResourceName: "google_storage_bucket.bucket", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_storage_default_object_acl_test.go b/google/resource_storage_default_object_acl_test.go index f0688149..14ba37dd 100644 --- a/google/resource_storage_default_object_acl_test.go +++ b/google/resource_storage_default_object_acl_test.go @@ -17,7 +17,7 @@ func TestAccStorageDefaultObjectAcl_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageDefaultObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclBasic(bucketName, roleEntityBasic1, roleEntityBasic2), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageDefaultObjectAcl(bucketName, roleEntityBasic1), @@ -37,7 +37,7 @@ func TestAccStorageDefaultObjectAcl_noRoleEntity(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageDefaultObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclNoRoleEntity(bucketName), }, }, @@ -54,7 +54,7 @@ func TestAccStorageDefaultObjectAcl_upgrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageDefaultObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclBasic(bucketName, roleEntityBasic1, roleEntityBasic2), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageDefaultObjectAcl(bucketName, roleEntityBasic1), @@ -62,7 +62,7 @@ func TestAccStorageDefaultObjectAcl_upgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclBasic(bucketName, roleEntityBasic2, roleEntityBasic3_owner), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageDefaultObjectAcl(bucketName, roleEntityBasic2), @@ -70,7 +70,7 @@ func TestAccStorageDefaultObjectAcl_upgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclBasicDelete(bucketName, roleEntityBasic1), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageDefaultObjectAcl(bucketName, roleEntityBasic1), @@ -92,7 +92,7 @@ func TestAccStorageDefaultObjectAcl_downgrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageDefaultObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclBasic(bucketName, roleEntityBasic2, roleEntityBasic3_owner), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageDefaultObjectAcl(bucketName, roleEntityBasic2), @@ -100,7 +100,7 @@ func TestAccStorageDefaultObjectAcl_downgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclBasic(bucketName, roleEntityBasic2, roleEntityBasic3_reader), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageDefaultObjectAcl(bucketName, roleEntityBasic2), @@ -108,7 +108,7 @@ func TestAccStorageDefaultObjectAcl_downgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectsAclBasicDelete(bucketName, roleEntityBasic1), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageDefaultObjectAcl(bucketName, roleEntityBasic1), @@ -131,7 +131,7 @@ func TestAccStorageDefaultObjectAcl_unordered(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageDefaultObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageDefaultObjectAclUnordered(bucketName), }, }, diff --git a/google/resource_storage_notification.go b/google/resource_storage_notification.go index 7dfef0d5..2e37cfd4 100644 --- a/google/resource_storage_notification.go +++ b/google/resource_storage_notification.go @@ -19,27 +19,27 @@ func resourceStorageNotification() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "bucket": &schema.Schema{ + "bucket": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "payload_format": &schema.Schema{ + "payload_format": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"JSON_API_V1", "NONE"}, false), }, - "topic": &schema.Schema{ + "topic": { Type: schema.TypeString, Required: true, ForceNew: true, DiffSuppressFunc: compareSelfLinkOrResourceName, }, - "custom_attributes": &schema.Schema{ + "custom_attributes": { Type: schema.TypeMap, Optional: true, ForceNew: true, @@ -48,7 +48,7 @@ func resourceStorageNotification() *schema.Resource { }, }, - "event_types": &schema.Schema{ + "event_types": { Type: schema.TypeSet, Optional: true, ForceNew: true, @@ -60,13 +60,13 @@ func resourceStorageNotification() *schema.Resource { }, }, - "object_name_prefix": &schema.Schema{ + "object_name_prefix": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "self_link": &schema.Schema{ + "self_link": { Type: schema.TypeString, Computed: true, }, diff --git a/google/resource_storage_notification_test.go b/google/resource_storage_notification_test.go index 6a6b8f11..3498b56b 100644 --- a/google/resource_storage_notification_test.go +++ b/google/resource_storage_notification_test.go @@ -31,7 +31,7 @@ func TestAccStorageNotification_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageNotificationDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageNotificationBasic(bucketName, topicName, topic), Check: resource.ComposeTestCheckFunc( testAccCheckStorageNotificationExists( @@ -46,12 +46,12 @@ func TestAccStorageNotification_basic(t *testing.T) { "google_storage_notification.notification_with_prefix", "object_name_prefix", "foobar"), ), }, - resource.TestStep{ + { ResourceName: "google_storage_notification.notification", ImportState: true, ImportStateVerify: true, }, - resource.TestStep{ + { ResourceName: "google_storage_notification.notification_with_prefix", ImportState: true, ImportStateVerify: true, @@ -77,7 +77,7 @@ func TestAccStorageNotification_withEventsAndAttributes(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageNotificationDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageNotificationOptionalEventsAttributes(bucketName, topicName, topic, eventType1, eventType2), Check: resource.ComposeTestCheckFunc( testAccCheckStorageNotificationExists( @@ -94,7 +94,7 @@ func TestAccStorageNotification_withEventsAndAttributes(t *testing.T) { ¬ification, "new-attribute", "new-attribute-value"), ), }, - resource.TestStep{ + { ResourceName: "google_storage_notification.notification", ImportState: true, ImportStateVerify: true, diff --git a/google/resource_storage_object_acl_test.go b/google/resource_storage_object_acl_test.go index a9199b10..2aae84d0 100644 --- a/google/resource_storage_object_acl_test.go +++ b/google/resource_storage_object_acl_test.go @@ -35,7 +35,7 @@ func TestAccStorageObjectAcl_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasic1(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAcl(bucketName, @@ -65,7 +65,7 @@ func TestAccStorageObjectAcl_upgrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasic1(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAcl(bucketName, @@ -75,7 +75,7 @@ func TestAccStorageObjectAcl_upgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasic2(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAcl(bucketName, @@ -85,7 +85,7 @@ func TestAccStorageObjectAcl_upgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasicDelete(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAclDelete(bucketName, @@ -117,7 +117,7 @@ func TestAccStorageObjectAcl_downgrade(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasic2(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAcl(bucketName, @@ -127,7 +127,7 @@ func TestAccStorageObjectAcl_downgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasic3(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAcl(bucketName, @@ -137,7 +137,7 @@ func TestAccStorageObjectAcl_downgrade(t *testing.T) { ), }, - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasicDelete(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAclDelete(bucketName, @@ -169,7 +169,7 @@ func TestAccStorageObjectAcl_predefined(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageObjectsAclPredefined(bucketName, objectName), }, }, @@ -193,10 +193,10 @@ func TestAccStorageObjectAcl_predefinedToExplicit(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageObjectsAclPredefined(bucketName, objectName), }, - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasic1(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAcl(bucketName, @@ -226,7 +226,7 @@ func TestAccStorageObjectAcl_explicitToPredefined(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageObjectsAclBasic1(bucketName, objectName), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObjectAcl(bucketName, @@ -235,7 +235,7 @@ func TestAccStorageObjectAcl_explicitToPredefined(t *testing.T) { objectName, roleEntityBasic2), ), }, - resource.TestStep{ + { Config: testGoogleStorageObjectsAclPredefined(bucketName, objectName), }, }, @@ -260,7 +260,7 @@ func TestAccStorageObjectAcl_unordered(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageObjectAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testGoogleStorageObjectAclUnordered(bucketName, objectName), }, }, diff --git a/google/resource_usage_export_bucket.go b/google/resource_usage_export_bucket.go index 7e87e426..3d7d6a55 100644 --- a/google/resource_usage_export_bucket.go +++ b/google/resource_usage_export_bucket.go @@ -18,17 +18,17 @@ func resourceProjectUsageBucket() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "bucket_name": &schema.Schema{ + "bucket_name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "prefix": &schema.Schema{ + "prefix": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "project": &schema.Schema{ + "project": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/google/resource_usage_export_bucket_test.go b/google/resource_usage_export_bucket_test.go index 4a5b86c1..85721eda 100644 --- a/google/resource_usage_export_bucket_test.go +++ b/google/resource_usage_export_bucket_test.go @@ -18,11 +18,11 @@ func TestAccComputeResourceUsageExportBucket(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccResourceUsageExportBucket(baseProject, org, billingId), }, // Test import. - resource.TestStep{ + { ResourceName: "google_project_usage_export_bucket.ueb", ImportState: true, ImportStateVerify: true,