diff --git a/google/data_source_google_active_folder_test.go b/google/data_source_google_active_folder_test.go index 6a209a91e20..b887ccbde83 100644 --- a/google/data_source_google_active_folder_test.go +++ b/google/data_source_google_active_folder_test.go @@ -90,5 +90,6 @@ data "google_active_folder" "my_folder" { parent = google_folder.foobar.parent display_name = google_folder.foobar.display_name } + `, parent, displayName) } diff --git a/google/data_source_google_compute_router_test.go b/google/data_source_google_compute_router_test.go index 020a0c62757..4d88a53386c 100644 --- a/google/data_source_google_compute_router_test.go +++ b/google/data_source_google_compute_router_test.go @@ -31,21 +31,19 @@ func TestAccDataSourceComputeRouter(t *testing.T) { func testAccDataSourceComputeRouterConfig(name string) string { return fmt.Sprintf(` resource "google_compute_network" "foobar" { - name = "%s" - auto_create_subnetworks = false + name = "%s" + auto_create_subnetworks = false } - resource "google_compute_router" "foobar" { - name = "%s" - network = google_compute_network.foobar.name - bgp { - asn = 64514 - } + name = "%s" + network = "${google_compute_network.foobar.name}" + bgp { + asn = 64514 + } } - data "google_compute_router" "myrouter" { - name = google_compute_router.foobar.name - network = google_compute_network.foobar.name + name = "${google_compute_router.foobar.name}" + network = "${google_compute_network.foobar.name}" } `, name, name) } diff --git a/google/data_source_google_iam_policy.go b/google/data_source_google_iam_policy.go index 637d77526d5..760f629670c 100644 --- a/google/data_source_google_iam_policy.go +++ b/google/data_source_google_iam_policy.go @@ -2,11 +2,13 @@ package google import ( "encoding/json" + "regexp" "sort" "strconv" "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "google.golang.org/api/cloudresourcemanager/v1" ) @@ -38,8 +40,11 @@ func dataSourceGoogleIamPolicy() *schema.Resource { "members": { Type: schema.TypeSet, Required: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringDoesNotMatch(regexp.MustCompile("^deleted:"), "Terraform does not support IAM policies for deleted principals"), + }, + Set: schema.HashString, }, }, }, diff --git a/google/data_source_storage_object_signed_url_test.go b/google/data_source_storage_object_signed_url_test.go index 1dce1f6ef1f..3b4ececefc8 100644 --- a/google/data_source_storage_object_signed_url_test.go +++ b/google/data_source_storage_object_signed_url_test.go @@ -28,8 +28,7 @@ const fakeCredentials = `{ "token_uri": "https://accounts.google.com/o/oauth2/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/user%40gcp-project.iam.gserviceaccount.com" -} -` +}` // The following values are derived from the output of the `gsutil signurl` command. // i.e. diff --git a/google/resource_access_context_manager_service_perimeter_test.go b/google/resource_access_context_manager_service_perimeter_test.go index e018b95ea23..9039a1540e3 100644 --- a/google/resource_access_context_manager_service_perimeter_test.go +++ b/google/resource_access_context_manager_service_perimeter_test.go @@ -139,7 +139,7 @@ resource "google_access_context_manager_service_perimeter" "test-access" { perimeter_type = "PERIMETER_TYPE_REGULAR" status { restricted_services = ["bigquery.googleapis.com"] - access_levels = [google_access_context_manager_access_level.test-access.name] + access_levels = ["${google_access_context_manager_access_level.test-access.name}"] } } `, org, policyTitle, levelTitleName, levelTitleName, perimeterTitleName, perimeterTitleName) diff --git a/google/resource_app_engine_application_test.go b/google/resource_app_engine_application_test.go index 39a5e811c66..81074342b71 100644 --- a/google/resource_app_engine_application_test.go +++ b/google/resource_app_engine_application_test.go @@ -53,12 +53,11 @@ resource "google_project" "acceptance" { } resource "google_app_engine_application" "acceptance" { - project = google_project.acceptance.project_id - auth_domain = "hashicorptest.com" - location_id = "us-central" - serving_status = "SERVING" -} -`, pid, pid, org) + project = "${google_project.acceptance.project_id}" + auth_domain = "hashicorptest.com" + location_id = "us-central" + serving_status = "SERVING" +}`, pid, pid, org) } func testAccAppEngineApplication_update(pid, org string) string { @@ -70,10 +69,9 @@ resource "google_project" "acceptance" { } resource "google_app_engine_application" "acceptance" { - project = google_project.acceptance.project_id - auth_domain = "tf-test.club" - location_id = "us-central" - serving_status = "USER_DISABLED" -} -`, pid, pid, org) + project = "${google_project.acceptance.project_id}" + auth_domain = "tf-test.club" + location_id = "us-central" + serving_status = "USER_DISABLED" +}`, pid, pid, org) } diff --git a/google/resource_app_engine_domain_mapping_test.go b/google/resource_app_engine_domain_mapping_test.go index 206b468ecef..078a6be7717 100644 --- a/google/resource_app_engine_domain_mapping_test.go +++ b/google/resource_app_engine_domain_mapping_test.go @@ -44,23 +44,21 @@ func testAccAppEngineDomainMapping_basic(domainName string) string { return fmt.Sprintf(` resource "google_app_engine_domain_mapping" "domain_mapping" { domain_name = "%s.gcp.tfacc.hashicorptest.com" - + ssl_settings { ssl_management_type = "AUTOMATIC" } -} -`, domainName) +}`, domainName) } func testAccAppEngineDomainMapping_update(domainName string) string { return fmt.Sprintf(` resource "google_app_engine_domain_mapping" "domain_mapping" { domain_name = "%s.gcp.tfacc.hashicorptest.com" - + ssl_settings { - certificate_id = "" + certificate_id = "" ssl_management_type = "MANUAL" } -} -`, domainName) +}`, domainName) } diff --git a/google/resource_big_query_dataset_test.go b/google/resource_big_query_dataset_test.go index 418f62ecc7f..ac3ffe802c9 100644 --- a/google/resource_big_query_dataset_test.go +++ b/google/resource_big_query_dataset_test.go @@ -180,56 +180,53 @@ func testAccAddTable(datasetID string, tableID string) resource.TestCheckFunc { func testAccBigQueryDataset(datasetID string) string { return fmt.Sprintf(` resource "google_bigquery_dataset" "test" { - dataset_id = "%s" - friendly_name = "foo" - description = "This is a foo description" - location = "EU" + dataset_id = "%s" + friendly_name = "foo" + description = "This is a foo description" + location = "EU" default_partition_expiration_ms = 3600000 - default_table_expiration_ms = 3600000 + default_table_expiration_ms = 3600000 labels = { env = "foo" default_table_expiration_ms = 3600000 } -} -`, datasetID) +}`, datasetID) } func testAccBigQueryDatasetUpdated(datasetID string) string { return fmt.Sprintf(` resource "google_bigquery_dataset" "test" { - dataset_id = "%s" - friendly_name = "bar" - description = "This is a bar description" - location = "EU" + dataset_id = "%s" + friendly_name = "bar" + description = "This is a bar description" + location = "EU" default_partition_expiration_ms = 7200000 - default_table_expiration_ms = 7200000 + default_table_expiration_ms = 7200000 labels = { env = "bar" default_table_expiration_ms = 7200000 } -} -`, datasetID) +}`, datasetID) } func testAccBigQueryDatasetDeleteContents(datasetID string) string { return fmt.Sprintf(` resource "google_bigquery_dataset" "contents_test" { - dataset_id = "%s" - friendly_name = "foo" - description = "This is a foo description" - location = "EU" + dataset_id = "%s" + friendly_name = "foo" + description = "This is a foo description" + location = "EU" default_partition_expiration_ms = 3600000 - default_table_expiration_ms = 3600000 - delete_contents_on_destroy = true + default_table_expiration_ms = 3600000 + delete_contents_on_destroy = true labels = { env = "foo" default_table_expiration_ms = 3600000 } -} -`, datasetID) +}`, datasetID) } func testAccBigQueryRegionalDataset(datasetID string, location string) string { @@ -245,8 +242,7 @@ resource "google_bigquery_dataset" "test" { env = "foo" default_table_expiration_ms = 3600000 } -} -`, datasetID, location) +}`, datasetID, location) } func testAccBigQueryDatasetWithOneAccess(datasetID string) string { @@ -263,8 +259,7 @@ resource "google_bigquery_dataset" "access_test" { env = "foo" default_table_expiration_ms = 3600000 } -} -`, datasetID) +}`, datasetID) } func testAccBigQueryDatasetWithTwoAccess(datasetID string) string { @@ -285,8 +280,7 @@ resource "google_bigquery_dataset" "access_test" { env = "foo" default_table_expiration_ms = 3600000 } -} -`, datasetID) +}`, datasetID) } func testAccBigQueryDatasetWithViewAccess(datasetID, otherDatasetID, otherTableID string) string { @@ -299,14 +293,14 @@ resource "google_bigquery_dataset" "other_dataset" { resource "google_bigquery_table" "table_with_view" { table_id = "%s" - dataset_id = google_bigquery_dataset.other_dataset.dataset_id + dataset_id = "${google_bigquery_dataset.other_dataset.dataset_id}" time_partitioning { type = "DAY" } view { - query = "SELECT state FROM [lookerdata:cdc.project_tycho_reports]" + query = "SELECT state FROM [lookerdata:cdc.project_tycho_reports]" use_legacy_sql = true } } @@ -320,9 +314,9 @@ resource "google_bigquery_dataset" "access_test" { } access { view { - project_id = google_bigquery_dataset.other_dataset.project - dataset_id = google_bigquery_dataset.other_dataset.dataset_id - table_id = google_bigquery_table.table_with_view.table_id + project_id = "${google_bigquery_dataset.other_dataset.project}" + dataset_id = "${google_bigquery_dataset.other_dataset.dataset_id}" + table_id = "${google_bigquery_table.table_with_view.table_id}" } } @@ -330,8 +324,7 @@ resource "google_bigquery_dataset" "access_test" { env = "foo" default_table_expiration_ms = 3600000 } -} -`, otherDatasetID, otherTableID, datasetID) +}`, otherDatasetID, otherTableID, datasetID) } func testAccBigQueryDataset_cmek(pid, datasetID, kmsKey string) string { @@ -341,7 +334,7 @@ data "google_project" "project" { } resource "google_project_iam_member" "kms-project-binding" { - project = data.google_project.project.project_id + project = "${data.google_project.project.project_id}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:bq-${data.google_project.project.number}@bigquery-encryption.iam.gserviceaccount.com" } @@ -357,7 +350,7 @@ resource "google_bigquery_dataset" "test" { kms_key_name = "%s" } - project = google_project_iam_member.kms-project-binding.project + project = "${google_project_iam_member.kms-project-binding.project}" } `, pid, datasetID, kmsKey) } diff --git a/google/resource_bigquery_data_transfer_config_test.go b/google/resource_bigquery_data_transfer_config_test.go index ebaa3eb9f48..8d4c31e0549 100644 --- a/google/resource_bigquery_data_transfer_config_test.go +++ b/google/resource_bigquery_data_transfer_config_test.go @@ -127,7 +127,7 @@ func testAccBigqueryDataTransferConfig_scheduledQuery(random_suffix, schedule, l data "google_project" "project" {} resource "google_project_iam_member" "permissions" { - role = "roles/iam.serviceAccountShortTermTokenMinter" + role = "roles/iam.serviceAccountShortTermTokenMinter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-bigquerydatatransfer.iam.gserviceaccount.com" } @@ -135,24 +135,24 @@ resource "google_project_iam_member" "permissions" { resource "google_bigquery_dataset" "my_dataset" { depends_on = [google_project_iam_member.permissions] - dataset_id = "my_dataset%s" + dataset_id = "my_dataset%s" friendly_name = "foo" - description = "bar" - location = "asia-northeast1" + description = "bar" + location = "asia-northeast1" } resource "google_bigquery_data_transfer_config" "query_config" { depends_on = [google_project_iam_member.permissions] - display_name = "my-query-%s" - location = "asia-northeast1" - data_source_id = "scheduled_query" - schedule = "%s sunday of quarter 00:00" + display_name = "my-query-%s" + location = "asia-northeast1" + data_source_id = "scheduled_query" + schedule = "%s sunday of quarter 00:00" destination_dataset_id = google_bigquery_dataset.my_dataset.dataset_id params = { destination_table_name_template = "my-table" - write_disposition = "WRITE_APPEND" - query = "SELECT name FROM tabl WHERE x = '%s'" + write_disposition = "WRITE_APPEND" + query = "SELECT name FROM tabl WHERE x = '%s'" } } `, random_suffix, random_suffix, schedule, letter) @@ -163,26 +163,26 @@ func testAccBigqueryDataTransferConfig_booleanParam(random_suffix string) string data "google_project" "project" {} resource "google_project_iam_member" "permissions" { - role = "roles/iam.serviceAccountShortTermTokenMinter" + role = "roles/iam.serviceAccountShortTermTokenMinter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-bigquerydatatransfer.iam.gserviceaccount.com" } resource "google_bigquery_dataset" "source_dataset" { depends_on = [google_project_iam_member.permissions] - dataset_id = "source_%s" + dataset_id = "source_%s" friendly_name = "foo" - description = "bar" - location = "asia-northeast1" + description = "bar" + location = "asia-northeast1" } resource "google_bigquery_dataset" "destination_dataset" { depends_on = [google_project_iam_member.permissions] - dataset_id = "destination_%s" + dataset_id = "destination_%s" friendly_name = "foo" - description = "bar" - location = "asia-northeast1" + description = "bar" + location = "asia-northeast1" } resource "google_bigquery_data_transfer_config" "copy_config" { @@ -190,13 +190,13 @@ resource "google_bigquery_data_transfer_config" "copy_config" { location = "asia-northeast1" - display_name = "Copy test %s" - data_source_id = "cross_region_copy" + display_name = "Copy test %s" + data_source_id = "cross_region_copy" destination_dataset_id = google_bigquery_dataset.destination_dataset.dataset_id params = { overwrite_destination_table = "true" - source_dataset_id = google_bigquery_dataset.source_dataset.dataset_id - source_project_id = data.google_project.project.project_id + source_dataset_id = google_bigquery_dataset.source_dataset.dataset_id + source_project_id = data.google_project.project.project_id } } `, random_suffix, random_suffix, random_suffix) diff --git a/google/resource_bigquery_table_test.go b/google/resource_bigquery_table_test.go index 7d1a9e9388c..31442d6f131 100644 --- a/google/resource_bigquery_table_test.go +++ b/google/resource_bigquery_table_test.go @@ -172,15 +172,15 @@ resource "google_bigquery_dataset" "test" { resource "google_bigquery_table" "test" { table_id = "%s" - dataset_id = google_bigquery_dataset.test.dataset_id + dataset_id = "${google_bigquery_dataset.test.dataset_id}" time_partitioning { - type = "DAY" - field = "ts" + type = "DAY" + field = "ts" require_partition_filter = true } - clustering = ["some_int", "some_string"] - schema = <> /tmp/%s gsutil cp /tmp/%s ${google_storage_bucket.init_bucket.url} @@ -1025,77 +1023,76 @@ EOL } resource "google_dataproc_cluster" "with_init_action" { - name = "dproc-cluster-test-%s" - region = "us-central1" - - cluster_config { - # Keep the costs down with smallest config we can get away with - software_config { - override_properties = { - "dataproc:dataproc.allow.zero.workers" = "true" - } - } - - master_config { - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - - initialization_action { - script = "${google_storage_bucket.init_bucket.url}/${google_storage_bucket_object.init_script.name}" - timeout_sec = 500 - } - initialization_action { - script = "${google_storage_bucket.init_bucket.url}/${google_storage_bucket_object.init_script.name}" - } - } -} -`, bucket, rnd, objName, objName, rnd) + name = "dproc-cluster-test-%s" + region = "us-central1" + + cluster_config { + # Keep the costs down with smallest config we can get away with + software_config { + override_properties = { + "dataproc:dataproc.allow.zero.workers" = "true" + } + } + + master_config { + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + + initialization_action { + script = "${google_storage_bucket.init_bucket.url}/${google_storage_bucket_object.init_script.name}" + timeout_sec = 500 + } + initialization_action { + script = "${google_storage_bucket.init_bucket.url}/${google_storage_bucket_object.init_script.name}" + } + } +}`, bucket, rnd, objName, objName, rnd) } func testAccDataprocCluster_updatable(rnd string, w, p int) string { return fmt.Sprintf(` resource "google_dataproc_cluster" "updatable" { - name = "dproc-cluster-test-%s" - region = "us-central1" - - cluster_config { - master_config { - num_instances = "1" - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - - worker_config { - num_instances = "%d" - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - - preemptible_worker_config { - num_instances = "%d" - disk_config { - boot_disk_size_gb = 15 - } - } - } -} -`, rnd, w, p) + name = "dproc-cluster-test-%s" + region = "us-central1" + + cluster_config { + + master_config { + num_instances = "1" + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + + worker_config { + num_instances = "%d" + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + + preemptible_worker_config { + num_instances = "%d" + disk_config { + boot_disk_size_gb = 15 + } + } + } + +}`, rnd, w, p) } func testAccDataprocCluster_withStagingBucketOnly(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - force_destroy = "true" -} -`, bucketName) + name = "%s" + force_destroy = "true" +}`, bucketName) } func testAccDataprocCluster_withStagingBucketAndCluster(clusterName, bucketName string) string { @@ -1103,136 +1100,132 @@ func testAccDataprocCluster_withStagingBucketAndCluster(clusterName, bucketName %s resource "google_dataproc_cluster" "with_bucket" { - name = "%s" - region = "us-central1" - - cluster_config { - staging_bucket = google_storage_bucket.bucket.name - - # Keep the costs down with smallest config we can get away with - software_config { - override_properties = { - "dataproc:dataproc.allow.zero.workers" = "true" - } - } - - master_config { - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - } -} -`, testAccDataprocCluster_withStagingBucketOnly(bucketName), clusterName) + name = "%s" + region = "us-central1" + + cluster_config { + staging_bucket = "${google_storage_bucket.bucket.name}" + + # Keep the costs down with smallest config we can get away with + software_config { + override_properties = { + "dataproc:dataproc.allow.zero.workers" = "true" + } + } + + master_config { + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + } +}`, testAccDataprocCluster_withStagingBucketOnly(bucketName), clusterName) } func testAccDataprocCluster_withLabels(rnd string) string { return fmt.Sprintf(` resource "google_dataproc_cluster" "with_labels" { - name = "dproc-cluster-test-%s" - region = "us-central1" + name = "dproc-cluster-test-%s" + region = "us-central1" - labels = { - key1 = "value1" - } + labels = { + key1 = "value1" + } - # This is because GCP automatically adds its own labels as well. - # In this case we just want to test our newly added label is there - lifecycle { - ignore_changes = [labels] - } -} -`, rnd) + # This is because GCP automatically adds its own labels as well. + # In this case we just want to test our newly added label is there + lifecycle { + ignore_changes = ["labels"] + } + +}`, rnd) } func testAccDataprocCluster_withImageVersion(rnd string) string { return fmt.Sprintf(` resource "google_dataproc_cluster" "with_image_version" { - name = "dproc-cluster-test-%s" - region = "us-central1" + name = "dproc-cluster-test-%s" + region = "us-central1" - cluster_config { - software_config { - image_version = "1.3.7-deb9" - } - } -} -`, rnd) + cluster_config { + software_config { + image_version = "1.3.7-deb9" + } + } +}`, rnd) } func testAccDataprocCluster_withOptionalComponents(rnd string) string { return fmt.Sprintf(` resource "google_dataproc_cluster" "with_opt_components" { - name = "dproc-cluster-test-%s" - region = "us-central1" + name = "dproc-cluster-test-%s" + region = "us-central1" - cluster_config { - software_config { - optional_components = ["ANACONDA", "ZOOKEEPER"] - } - } -} -`, rnd) + cluster_config { + software_config { + optional_components = ["ANACONDA", "ZOOKEEPER"] + } + } +}`, rnd) } func testAccDataprocCluster_withServiceAcc(sa string, rnd string) string { return fmt.Sprintf(` resource "google_service_account" "service_account" { - account_id = "%s" + account_id = "%s" } resource "google_project_iam_member" "service_account" { - role = "roles/dataproc.worker" - member = "serviceAccount:${google_service_account.service_account.email}" + role = "roles/dataproc.worker" + member = "serviceAccount:${google_service_account.service_account.email}" } resource "google_dataproc_cluster" "with_service_account" { - name = "dproc-cluster-test-%s" - region = "us-central1" - - cluster_config { - # Keep the costs down with smallest config we can get away with - software_config { - override_properties = { - "dataproc:dataproc.allow.zero.workers" = "true" - } - } - - master_config { - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - - gce_cluster_config { - service_account = google_service_account.service_account.email - service_account_scopes = [ - # User supplied scopes - "https://www.googleapis.com/auth/monitoring", - # The following scopes necessary for the cluster to function properly are - # always added, even if not explicitly specified: - # useraccounts-ro: https://www.googleapis.com/auth/cloud.useraccounts.readonly - # storage-rw: https://www.googleapis.com/auth/devstorage.read_write - # logging-write: https://www.googleapis.com/auth/logging.write - "useraccounts-ro", - "storage-rw", - "logging-write", - ] - } - } + name = "dproc-cluster-test-%s" + region = "us-central1" + + cluster_config { + # Keep the costs down with smallest config we can get away with + software_config { + override_properties = { + "dataproc:dataproc.allow.zero.workers" = "true" + } + } - depends_on = [google_project_iam_member.service_account] -} -`, sa, rnd) + master_config { + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + + gce_cluster_config { + service_account = "${google_service_account.service_account.email}" + service_account_scopes = [ + # User supplied scopes + "https://www.googleapis.com/auth/monitoring", + + # The following scopes necessary for the cluster to function properly are + # always added, even if not explicitly specified: + # useraccounts-ro: https://www.googleapis.com/auth/cloud.useraccounts.readonly + # storage-rw: https://www.googleapis.com/auth/devstorage.read_write + # logging-write: https://www.googleapis.com/auth/logging.write + "useraccounts-ro","storage-rw","logging-write" + ] + } + } + + depends_on = ["google_project_iam_member.service_account"] + +}`, sa, rnd) } func testAccDataprocCluster_withNetworkRefs(rnd, netName string) string { return fmt.Sprintf(` resource "google_compute_network" "dataproc_network" { - name = "%s" - auto_create_subnetworks = true + name = "%s" + auto_create_subnetworks = true } # @@ -1243,103 +1236,103 @@ resource "google_compute_network" "dataproc_network" { # internally as part of their configuration or this will just hang. # resource "google_compute_firewall" "dataproc_network_firewall" { - name = "dproc-cluster-test-%s-allow-internal" - description = "Firewall rules for dataproc Terraform acceptance testing" - network = google_compute_network.dataproc_network.name - source_ranges = ["192.168.0.0/16"] + name = "dproc-cluster-test-%s-allow-internal" + description = "Firewall rules for dataproc Terraform acceptance testing" + network = "${google_compute_network.dataproc_network.name}" + source_ranges = ["192.168.0.0/16"] - allow { - protocol = "icmp" - } + allow { + protocol = "icmp" + } - allow { - protocol = "tcp" - ports = ["0-65535"] - } + allow { + protocol = "tcp" + ports = ["0-65535"] + } - allow { - protocol = "udp" - ports = ["0-65535"] - } + allow { + protocol = "udp" + ports = ["0-65535"] + } } resource "google_dataproc_cluster" "with_net_ref_by_name" { - name = "dproc-cluster-test-%s-name" - region = "us-central1" - depends_on = [google_compute_firewall.dataproc_network_firewall] - - cluster_config { - # Keep the costs down with smallest config we can get away with - software_config { - override_properties = { - "dataproc:dataproc.allow.zero.workers" = "true" - } - } - - master_config { - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - - gce_cluster_config { - network = google_compute_network.dataproc_network.name - } - } + name = "dproc-cluster-test-%s-name" + region = "us-central1" + depends_on = ["google_compute_firewall.dataproc_network_firewall"] + + cluster_config { + # Keep the costs down with smallest config we can get away with + software_config { + override_properties = { + "dataproc:dataproc.allow.zero.workers" = "true" + } + } + + master_config { + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + + gce_cluster_config { + network = "${google_compute_network.dataproc_network.name}" + } + } } resource "google_dataproc_cluster" "with_net_ref_by_url" { - name = "dproc-cluster-test-%s-url" - region = "us-central1" - depends_on = [google_compute_firewall.dataproc_network_firewall] - - cluster_config { - # Keep the costs down with smallest config we can get away with - software_config { - override_properties = { - "dataproc:dataproc.allow.zero.workers" = "true" - } - } - - master_config { - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - - gce_cluster_config { - network = google_compute_network.dataproc_network.self_link - } - } + name = "dproc-cluster-test-%s-url" + region = "us-central1" + depends_on = ["google_compute_firewall.dataproc_network_firewall"] + + cluster_config { + # Keep the costs down with smallest config we can get away with + software_config { + override_properties = { + "dataproc:dataproc.allow.zero.workers" = "true" + } + } + + master_config { + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + + gce_cluster_config { + network = "${google_compute_network.dataproc_network.self_link}" + } + } } + `, netName, rnd, rnd, rnd) } func testAccDataprocCluster_KMS(pid, rnd, kmsKey string) string { return fmt.Sprintf(` data "google_project" "project" { - project_id = "%s" + project_id = "%s" } resource "google_project_iam_member" "kms-project-binding" { - project = data.google_project.project.project_id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:service-${data.google_project.project.number}@compute-system.iam.gserviceaccount.com" + project = "${data.google_project.project.project_id}" + role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" + member = "serviceAccount:service-${data.google_project.project.number}@compute-system.iam.gserviceaccount.com" } resource "google_dataproc_cluster" "kms" { - depends_on = [google_project_iam_member.kms-project-binding] + depends_on = [google_project_iam_member.kms-project-binding] - name = "dproc-cluster-test-%s" - region = "us-central1" + name = "dproc-cluster-test-%s" + region = "us-central1" - cluster_config { - encryption_config { - kms_key_name = "%s" - } - } -} -`, pid, rnd, kmsKey) + cluster_config { + encryption_config { + kms_key_name = "%s" + } + } +}`, pid, rnd, kmsKey) } diff --git a/google/resource_dataproc_job_iam_test.go b/google/resource_dataproc_job_iam_test.go index 98821d272ea..b1920ed9b2c 100644 --- a/google/resource_dataproc_job_iam_test.go +++ b/google/resource_dataproc_job_iam_test.go @@ -111,29 +111,29 @@ func TestAccDataprocJobIamPolicy(t *testing.T) { var testDataprocIamJobConfig = testDataprocIamSingleNodeCluster + ` resource "google_dataproc_job" "pyspark" { - region = google_dataproc_cluster.cluster.region - - placement { - cluster_name = google_dataproc_cluster.cluster.name - } - - reference { - job_id = "%s" - } - - force_delete = true - - pyspark_config { - main_python_file_uri = "gs://dataproc-examples-2f10d78d114f6aaec76462e3c310f31f/src/pyspark/hello-world/hello-world.py" - properties = { - "spark.logConf" = "true" - } - logging_config { - driver_log_levels = { - "root" = "INFO" - } - } - } + region = "${google_dataproc_cluster.cluster.region}" + + placement { + cluster_name = "${google_dataproc_cluster.cluster.name}" + } + + reference { + job_id = "%s" + } + + force_delete = true + + pyspark_config { + main_python_file_uri = "gs://dataproc-examples-2f10d78d114f6aaec76462e3c310f31f/src/pyspark/hello-world/hello-world.py" + properties = { + "spark.logConf" = "true" + } + logging_config { + driver_log_levels = { + "root" = "INFO" + } + } + } } ` @@ -150,13 +150,14 @@ resource "google_service_account" "test-account2" { } resource "google_dataproc_job_iam_binding" "binding" { - job_id = google_dataproc_job.pyspark.reference[0].job_id - region = "us-central1" - role = "%s" - members = [ + job_id = "${google_dataproc_job.pyspark.reference.0.job_id}" + region = "us-central1" + role = "%s" + members = [ "serviceAccount:${google_service_account.test-account1.email}", ] } + `, cluster, job, account, account, role) } @@ -173,10 +174,10 @@ resource "google_service_account" "test-account2" { } resource "google_dataproc_job_iam_binding" "binding" { - job_id = google_dataproc_job.pyspark.reference[0].job_id - region = "us-central1" - role = "%s" - members = [ + job_id = "${google_dataproc_job.pyspark.reference.0.job_id}" + region = "us-central1" + role = "%s" + members = [ "serviceAccount:${google_service_account.test-account1.email}", "serviceAccount:${google_service_account.test-account2.email}", ] @@ -192,9 +193,9 @@ resource "google_service_account" "test-account" { } resource "google_dataproc_job_iam_member" "member" { - job_id = google_dataproc_job.pyspark.reference[0].job_id - role = "%s" - member = "serviceAccount:${google_service_account.test-account.email}" + job_id = "${google_dataproc_job.pyspark.reference.0.job_id}" + role = "%s" + member = "serviceAccount:${google_service_account.test-account.email}" } `, cluster, job, account, role) } @@ -207,16 +208,16 @@ resource "google_service_account" "test-account" { } data "google_iam_policy" "policy" { - binding { - role = "%s" - members = ["serviceAccount:${google_service_account.test-account.email}"] - } + binding { + role = "%s" + members = ["serviceAccount:${google_service_account.test-account.email}"] + } } resource "google_dataproc_job_iam_policy" "policy" { - job_id = google_dataproc_job.pyspark.reference[0].job_id - region = "us-central1" - policy_data = data.google_iam_policy.policy.policy_data + job_id = "${google_dataproc_job.pyspark.reference.0.job_id}" + region = "us-central1" + policy_data = "${data.google_iam_policy.policy.policy_data}" } `, cluster, job, account, role) } diff --git a/google/resource_dataproc_job_test.go b/google/resource_dataproc_job_test.go index 4fdb85cf081..b9f8bb04dff 100644 --- a/google/resource_dataproc_job_test.go +++ b/google/resource_dataproc_job_test.go @@ -487,45 +487,47 @@ func testAccCheckDataprocJobAttrMatch(n, jobType string, job *dataproc.Job) reso var singleNodeClusterConfig = ` resource "google_dataproc_cluster" "basic" { - name = "dproc-job-test-%s" - region = "us-central1" - - cluster_config { - # Keep the costs down with smallest config we can get away with - software_config { - override_properties = { - "dataproc:dataproc.allow.zero.workers" = "true" - } - } - - master_config { - num_instances = 1 - machine_type = "n1-standard-1" - disk_config { - boot_disk_size_gb = 15 - } - } - } + name = "dproc-job-test-%s" + region = "us-central1" + + cluster_config { + # Keep the costs down with smallest config we can get away with + software_config { + override_properties = { + "dataproc:dataproc.allow.zero.workers" = "true" + } + } + + master_config { + num_instances = 1 + machine_type = "n1-standard-1" + disk_config { + boot_disk_size_gb = 15 + } + } + } } ` func testAccDataprocJob_updatable(rnd, jobId, del string) string { return fmt.Sprintf( singleNodeClusterConfig+` + resource "google_dataproc_job" "updatable" { - placement { - cluster_name = google_dataproc_cluster.basic.name - } - reference { - job_id = "%s" - } - - region = google_dataproc_cluster.basic.region - force_delete = %s - - pyspark_config { - main_python_file_uri = "gs://dataproc-examples-2f10d78d114f6aaec76462e3c310f31f/src/pyspark/hello-world/hello-world.py" - } + + placement { + cluster_name = "${google_dataproc_cluster.basic.name}" + } + reference { + job_id = "%s" + } + + region = "${google_dataproc_cluster.basic.region}" + force_delete = %s + + pyspark_config { + main_python_file_uri = "gs://dataproc-examples-2f10d78d114f6aaec76462e3c310f31f/src/pyspark/hello-world/hello-world.py" + } } `, rnd, jobId, del) } @@ -533,36 +535,38 @@ resource "google_dataproc_job" "updatable" { func testAccDataprocJob_pySpark(rnd string) string { return fmt.Sprintf( singleNodeClusterConfig+` + resource "google_dataproc_job" "pyspark" { - placement { - cluster_name = google_dataproc_cluster.basic.name - } - reference { - job_id = "dproc-custom-job-id-%s" - } - - region = google_dataproc_cluster.basic.region - force_delete = true - - pyspark_config { - main_python_file_uri = "gs://dataproc-examples-2f10d78d114f6aaec76462e3c310f31f/src/pyspark/hello-world/hello-world.py" - properties = { - "spark.logConf" = "true" - } - logging_config { - driver_log_levels = { - "root" = "INFO" - } - } - } - - scheduling { - max_failures_per_hour = 1 - } - - labels = { - one = "1" - } + + placement { + cluster_name = "${google_dataproc_cluster.basic.name}" + } + reference { + job_id = "dproc-custom-job-id-%s" + } + + region = "${google_dataproc_cluster.basic.region}" + force_delete = true + + pyspark_config { + main_python_file_uri = "gs://dataproc-examples-2f10d78d114f6aaec76462e3c310f31f/src/pyspark/hello-world/hello-world.py" + properties = { + "spark.logConf" = "true" + } + logging_config { + driver_log_levels = { + "root" = "INFO" + } + } + } + + scheduling { + max_failures_per_hour = 1 + } + + labels = { + one = "1" + } } `, rnd, rnd) } @@ -570,113 +574,125 @@ resource "google_dataproc_job" "pyspark" { func testAccDataprocJob_spark(rnd string) string { return fmt.Sprintf( singleNodeClusterConfig+` -resource "google_dataproc_job" "spark" { - region = google_dataproc_cluster.basic.region - force_delete = true - placement { - cluster_name = google_dataproc_cluster.basic.name - } - - spark_config { - main_class = "org.apache.spark.examples.SparkPi" - jar_file_uris = ["file:///usr/lib/spark/examples/jars/spark-examples.jar"] - args = ["1000"] - properties = { - "spark.logConf" = "true" - } - } -} -`, rnd) + + resource "google_dataproc_job" "spark" { + + region = "${google_dataproc_cluster.basic.region}" + force_delete = true + placement { + cluster_name = "${google_dataproc_cluster.basic.name}" + } + + spark_config { + main_class = "org.apache.spark.examples.SparkPi" + jar_file_uris = ["file:///usr/lib/spark/examples/jars/spark-examples.jar"] + args = ["1000"] + properties = { + "spark.logConf" = "true" + } + } + } + `, rnd) } func testAccDataprocJob_hadoop(rnd string) string { return fmt.Sprintf( singleNodeClusterConfig+` -resource "google_dataproc_job" "hadoop" { - region = google_dataproc_cluster.basic.region - force_delete = true - placement { - cluster_name = google_dataproc_cluster.basic.name - } - - hadoop_config { - main_jar_file_uri = "file:///usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar" - args = [ - "wordcount", - "file:///usr/lib/spark/NOTICE", - "gs://${google_dataproc_cluster.basic.cluster_config[0].bucket}/hadoopjob_output_%s", - ] - } -} -`, rnd, rnd) + + resource "google_dataproc_job" "hadoop" { + + region = "${google_dataproc_cluster.basic.region}" + force_delete = true + placement { + cluster_name = "${google_dataproc_cluster.basic.name}" + } + + hadoop_config { + main_jar_file_uri = "file:///usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar" + args = [ + "wordcount", + "file:///usr/lib/spark/NOTICE", + "gs://${google_dataproc_cluster.basic.cluster_config.0.bucket}/hadoopjob_output_%s" + ] + } + + } + `, rnd, rnd) } func testAccDataprocJob_hive(rnd string) string { return fmt.Sprintf( singleNodeClusterConfig+` -resource "google_dataproc_job" "hive" { - region = google_dataproc_cluster.basic.region - force_delete = true - placement { - cluster_name = google_dataproc_cluster.basic.name - } - - hive_config { - query_list = [ - "DROP TABLE IF EXISTS dprocjob_test", - "CREATE EXTERNAL TABLE dprocjob_test(bar int) LOCATION 'gs://${google_dataproc_cluster.basic.cluster_config[0].bucket}/hive_dprocjob_test/'", - "SELECT * FROM dprocjob_test WHERE bar > 2", - ] - } -} -`, rnd) + + resource "google_dataproc_job" "hive" { + + region = "${google_dataproc_cluster.basic.region}" + force_delete = true + placement { + cluster_name = "${google_dataproc_cluster.basic.name}" + } + + hive_config { + query_list = [ + "DROP TABLE IF EXISTS dprocjob_test", + "CREATE EXTERNAL TABLE dprocjob_test(bar int) LOCATION 'gs://${google_dataproc_cluster.basic.cluster_config.0.bucket}/hive_dprocjob_test/'", + "SELECT * FROM dprocjob_test WHERE bar > 2", + ] + } + + } + `, rnd) } func testAccDataprocJob_pig(rnd string) string { return fmt.Sprintf( singleNodeClusterConfig+` -resource "google_dataproc_job" "pig" { - region = google_dataproc_cluster.basic.region - force_delete = true - placement { - cluster_name = google_dataproc_cluster.basic.name - } - - pig_config { - query_list = [ - "LNS = LOAD 'file:///usr/lib/pig/LICENSE.txt ' AS (line)", - "WORDS = FOREACH LNS GENERATE FLATTEN(TOKENIZE(line)) AS word", - "GROUPS = GROUP WORDS BY word", - "WORD_COUNTS = FOREACH GROUPS GENERATE group, COUNT(WORDS)", - "DUMP WORD_COUNTS", - ] - } -} -`, rnd) + + resource "google_dataproc_job" "pig" { + + region = "${google_dataproc_cluster.basic.region}" + force_delete = true + placement { + cluster_name = "${google_dataproc_cluster.basic.name}" + } + + pig_config { + query_list = [ + "LNS = LOAD 'file:///usr/lib/pig/LICENSE.txt ' AS (line)", + "WORDS = FOREACH LNS GENERATE FLATTEN(TOKENIZE(line)) AS word", + "GROUPS = GROUP WORDS BY word", + "WORD_COUNTS = FOREACH GROUPS GENERATE group, COUNT(WORDS)", + "DUMP WORD_COUNTS" + ] + } + } + `, rnd) } func testAccDataprocJob_sparksql(rnd string) string { return fmt.Sprintf( singleNodeClusterConfig+` -resource "google_dataproc_job" "sparksql" { - region = google_dataproc_cluster.basic.region - force_delete = true - placement { - cluster_name = google_dataproc_cluster.basic.name - } - - sparksql_config { - query_list = [ - "DROP TABLE IF EXISTS dprocjob_test", - "CREATE TABLE dprocjob_test(bar int)", - "SELECT * FROM dprocjob_test WHERE bar > 2", - ] - } -} -`, rnd) + + resource "google_dataproc_job" "sparksql" { + + region = "${google_dataproc_cluster.basic.region}" + force_delete = true + placement { + cluster_name = "${google_dataproc_cluster.basic.name}" + } + + sparksql_config { + query_list = [ + "DROP TABLE IF EXISTS dprocjob_test", + "CREATE TABLE dprocjob_test(bar int)", + "SELECT * FROM dprocjob_test WHERE bar > 2", + ] + } + } + `, rnd) } diff --git a/google/resource_dns_managed_zone_test.go b/google/resource_dns_managed_zone_test.go index a944e25068f..38633c72b82 100644 --- a/google/resource_dns_managed_zone_test.go +++ b/google/resource_dns_managed_zone_test.go @@ -115,16 +115,15 @@ func TestAccDNSManagedZone_dnssec_off(t *testing.T) { func testAccDnsManagedZone_basic(suffix, description string) string { return fmt.Sprintf(` resource "google_dns_managed_zone" "foobar" { - name = "mzone-test-%s" - dns_name = "tf-acctest-%s.hashicorptest.com." - description = "%s" - labels = { - foo = "bar" - } + name = "mzone-test-%s" + dns_name = "tf-acctest-%s.hashicorptest.com." + description = "%s" + labels = { + foo = "bar" + } - visibility = "public" -} -`, suffix, suffix, description) + visibility = "public" +}`, suffix, suffix, description) } func testAccDnsManagedZone_dnssec_on(suffix string) string { @@ -146,8 +145,7 @@ resource "google_dns_managed_zone" "foobar" { key_type = "keySigning" } } -} -`, suffix, suffix) +}`, suffix, suffix) } func testAccDnsManagedZone_dnssec_off(suffix string) string { @@ -159,42 +157,40 @@ resource "google_dns_managed_zone" "foobar" { dnssec_config { state = "off" } -} -`, suffix, suffix) +}`, suffix, suffix) } func testAccDnsManagedZone_privateUpdate(suffix, first_network, second_network string) string { return fmt.Sprintf(` resource "google_dns_managed_zone" "private" { - name = "private-zone-%s" - dns_name = "private.example.com." + name = "private-zone-%s" + dns_name = "private.example.com." description = "Example private DNS zone" - visibility = "private" + visibility = "private" private_visibility_config { networks { - network_url = google_compute_network.%s.self_link + network_url = "${google_compute_network.%s.self_link}" } networks { - network_url = google_compute_network.%s.self_link + network_url = "${google_compute_network.%s.self_link}" } } } resource "google_compute_network" "network-1" { - name = "network-1-%s" + name = "network-1-%s" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - name = "network-2-%s" + name = "network-2-%s" auto_create_subnetworks = false } resource "google_compute_network" "network-3" { - name = "network-3-%s" + name = "network-3-%s" auto_create_subnetworks = false -} -`, suffix, first_network, second_network, suffix, suffix, suffix) +}`, suffix, first_network, second_network, suffix, suffix, suffix) } func TestDnsManagedZoneImport_parseImportId(t *testing.T) { @@ -300,10 +296,9 @@ func TestAccDNSManagedZone_importWithProject(t *testing.T) { func testAccDnsManagedZone_basicWithProject(suffix, description, project string) string { return fmt.Sprintf(` resource "google_dns_managed_zone" "foobar" { - name = "mzone-test-%s" - dns_name = "tf-acctest-%s.hashicorptest.com." - description = "%s" - project = "%s" -} -`, suffix, suffix, description, project) + name = "mzone-test-%s" + dns_name = "tf-acctest-%s.hashicorptest.com." + description = "%s" + project = "%s" +}`, suffix, suffix, description, project) } diff --git a/google/resource_dns_record_set_test.go b/google/resource_dns_record_set_test.go index dab0d63916f..26e0df71b2e 100644 --- a/google/resource_dns_record_set_test.go +++ b/google/resource_dns_record_set_test.go @@ -266,114 +266,108 @@ func testAccCheckDnsRecordSetExists(resourceType, resourceName string) resource. func testAccDnsRecordSet_basic(zoneName string, addr2 string, ttl int) string { return fmt.Sprintf(` -resource "google_dns_managed_zone" "parent-zone" { - name = "%s" - dns_name = "%s.hashicorptest.com." - description = "Test Description" -} - -resource "google_dns_record_set" "foobar" { - managed_zone = google_dns_managed_zone.parent-zone.name - name = "test-record.%s.hashicorptest.com." - type = "A" - rrdatas = ["127.0.0.1", "%s"] - ttl = %d -} -`, zoneName, zoneName, zoneName, addr2, ttl) + resource "google_dns_managed_zone" "parent-zone" { + name = "%s" + dns_name = "%s.hashicorptest.com." + description = "Test Description" + } + resource "google_dns_record_set" "foobar" { + managed_zone = "${google_dns_managed_zone.parent-zone.name}" + name = "test-record.%s.hashicorptest.com." + type = "A" + rrdatas = ["127.0.0.1", "%s"] + ttl = %d + } + `, zoneName, zoneName, zoneName, addr2, ttl) } func testAccDnsRecordSet_ns(name string, ttl int) string { return fmt.Sprintf(` -resource "google_dns_managed_zone" "parent-zone" { - name = "%s" - dns_name = "%s.hashicorptest.com." - description = "Test Description" -} - -resource "google_dns_record_set" "foobar" { - managed_zone = google_dns_managed_zone.parent-zone.name - name = "%s.hashicorptest.com." - type = "NS" - rrdatas = ["ns.hashicorp.services.", "ns2.hashicorp.services."] - ttl = %d -} -`, name, name, name, ttl) + resource "google_dns_managed_zone" "parent-zone" { + name = "%s" + dns_name = "%s.hashicorptest.com." + description = "Test Description" + } + resource "google_dns_record_set" "foobar" { + managed_zone = "${google_dns_managed_zone.parent-zone.name}" + name = "%s.hashicorptest.com." + type = "NS" + rrdatas = ["ns.hashicorp.services.", "ns2.hashicorp.services."] + ttl = %d + } + `, name, name, name, ttl) } func testAccDnsRecordSet_nestedNS(name string, ttl int) string { return fmt.Sprintf(` -resource "google_dns_managed_zone" "parent-zone" { - name = "%s" - dns_name = "%s.hashicorptest.com." - description = "Test Description" -} - -resource "google_dns_record_set" "foobar" { - managed_zone = google_dns_managed_zone.parent-zone.name - name = "nested.%s.hashicorptest.com." - type = "NS" - rrdatas = ["ns.hashicorp.services.", "ns2.hashicorp.services."] - ttl = %d -} -`, name, name, name, ttl) + resource "google_dns_managed_zone" "parent-zone" { + name = "%s" + dns_name = "%s.hashicorptest.com." + description = "Test Description" + } + resource "google_dns_record_set" "foobar" { + managed_zone = "${google_dns_managed_zone.parent-zone.name}" + name = "nested.%s.hashicorptest.com." + type = "NS" + rrdatas = ["ns.hashicorp.services.", "ns2.hashicorp.services."] + ttl = %d + } + `, name, name, name, ttl) } func testAccDnsRecordSet_bigChange(zoneName string, ttl int) string { return fmt.Sprintf(` -resource "google_dns_managed_zone" "parent-zone" { - name = "%s" - dns_name = "%s.hashicorptest.com." - description = "Test Description" -} - -resource "google_dns_record_set" "foobar" { - managed_zone = google_dns_managed_zone.parent-zone.name - name = "test-record.%s.hashicorptest.com." - type = "CNAME" - rrdatas = ["www.terraform.io."] - ttl = %d -} -`, zoneName, zoneName, zoneName, ttl) + resource "google_dns_managed_zone" "parent-zone" { + name = "%s" + dns_name = "%s.hashicorptest.com." + description = "Test Description" + } + resource "google_dns_record_set" "foobar" { + managed_zone = "${google_dns_managed_zone.parent-zone.name}" + name = "test-record.%s.hashicorptest.com." + type = "CNAME" + rrdatas = ["www.terraform.io."] + ttl = %d + } + `, zoneName, zoneName, zoneName, ttl) } func testAccDnsRecordSet_quotedTXT(name string, ttl int) string { return fmt.Sprintf(` -resource "google_dns_managed_zone" "parent-zone" { - name = "%s" - dns_name = "%s.hashicorptest.com." - description = "Test Description" -} - -resource "google_dns_record_set" "foobar" { - managed_zone = google_dns_managed_zone.parent-zone.name - name = "test-record.%s.hashicorptest.com." - type = "TXT" - rrdatas = ["test", "\"quoted test\""] - ttl = %d -} -`, name, name, name, ttl) + resource "google_dns_managed_zone" "parent-zone" { + name = "%s" + dns_name = "%s.hashicorptest.com." + description = "Test Description" + } + resource "google_dns_record_set" "foobar" { + managed_zone = "${google_dns_managed_zone.parent-zone.name}" + name = "test-record.%s.hashicorptest.com." + type = "TXT" + rrdatas = ["test", "\"quoted test\""] + ttl = %d + } + `, name, name, name, ttl) } func testAccDnsRecordSet_uppercaseMX(name string, ttl int) string { return fmt.Sprintf(` -resource "google_dns_managed_zone" "parent-zone" { - name = "%s" - dns_name = "%s.hashicorptest.com." - description = "Test Description" -} - -resource "google_dns_record_set" "foobar" { - managed_zone = google_dns_managed_zone.parent-zone.name - name = "test-record.%s.hashicorptest.com." - type = "MX" - rrdatas = [ - "1 ASPMX.L.GOOGLE.COM.", - "5 ALT1.ASPMX.L.GOOGLE.COM.", - "5 ALT2.ASPMX.L.GOOGLE.COM.", - "10 ASPMX2.GOOGLEMAIL.COM.", - "10 ASPMX3.GOOGLEMAIL.COM.", - ] - ttl = %d -} -`, name, name, name, ttl) + resource "google_dns_managed_zone" "parent-zone" { + name = "%s" + dns_name = "%s.hashicorptest.com." + description = "Test Description" + } + resource "google_dns_record_set" "foobar" { + managed_zone = "${google_dns_managed_zone.parent-zone.name}" + name = "test-record.%s.hashicorptest.com." + type = "MX" + rrdatas = [ + "1 ASPMX.L.GOOGLE.COM.", + "5 ALT1.ASPMX.L.GOOGLE.COM.", + "5 ALT2.ASPMX.L.GOOGLE.COM.", + "10 ASPMX2.GOOGLEMAIL.COM.", + "10 ASPMX3.GOOGLEMAIL.COM.", + ] + ttl = %d + } + `, name, name, name, ttl) } diff --git a/google/resource_endpoints_service_test.go b/google/resource_endpoints_service_test.go index eb7f612f7a5..05fc875d073 100644 --- a/google/resource_endpoints_service_test.go +++ b/google/resource_endpoints_service_test.go @@ -97,10 +97,9 @@ func TestEndpointsService_grpcMigrateState(t *testing.T) { } func testAccEndpointsService_basic(random_name string) string { - return fmt.Sprintf(` -resource "google_endpoints_service" "endpoints_service" { - service_name = "%s.endpoints.%s.cloud.goog" - project = "%s" + return fmt.Sprintf(`resource "google_endpoints_service" "endpoints_service" { + service_name = "%s.endpoints.%s.cloud.goog" + project = "%s" openapi_config = <=ERROR" + name = "%s" + billing_account = "%s" + description = "%s" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" } `, exclusionName, billingAccount, description, getTestProjectFromEnv()) } diff --git a/google/resource_logging_billing_account_sink_test.go b/google/resource_logging_billing_account_sink_test.go index 040f752738f..bc87af8bb9d 100644 --- a/google/resource_logging_billing_account_sink_test.go +++ b/google/resource_logging_billing_account_sink_test.go @@ -176,51 +176,48 @@ func testAccCheckLoggingBillingAccountSink(sink *logging.LogSink, n string) reso func testAccLoggingBillingAccountSink_basic(name, bucketName, billingAccount string) string { return fmt.Sprintf(` resource "google_logging_billing_account_sink" "basic" { - name = "%s" - billing_account = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + billing_account = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" } resource "google_storage_bucket" "log-bucket" { - name = "%s" -} -`, name, billingAccount, getTestProjectFromEnv(), bucketName) + name = "%s" +}`, name, billingAccount, getTestProjectFromEnv(), bucketName) } func testAccLoggingBillingAccountSink_update(name, bucketName, billingAccount string) string { return fmt.Sprintf(` resource "google_logging_billing_account_sink" "update" { - name = "%s" - billing_account = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + billing_account = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" } resource "google_storage_bucket" "log-bucket" { - name = "%s" -} -`, name, billingAccount, getTestProjectFromEnv(), bucketName) + name = "%s" +}`, name, billingAccount, getTestProjectFromEnv(), bucketName) } func testAccLoggingBillingAccountSink_heredoc(name, bucketName, billingAccount string) string { return fmt.Sprintf(` resource "google_logging_billing_account_sink" "heredoc" { - name = "%s" - billing_account = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = <=ERROR -EOS + EOS } resource "google_storage_bucket" "log-bucket" { - name = "%s" -} -`, name, billingAccount, getTestProjectFromEnv(), bucketName) + name = "%s" +}`, name, billingAccount, getTestProjectFromEnv(), bucketName) } diff --git a/google/resource_logging_folder_exclusion_test.go b/google/resource_logging_folder_exclusion_test.go index e268d699da5..2f5244cd057 100644 --- a/google/resource_logging_folder_exclusion_test.go +++ b/google/resource_logging_folder_exclusion_test.go @@ -185,33 +185,31 @@ func testAccCheckLoggingFolderExclusionDestroy(s *terraform.State) error { func testAccLoggingFolderExclusion_basicCfg(exclusionName, description, folderName, folderParent string) string { return fmt.Sprintf(` resource "google_logging_folder_exclusion" "basic" { - name = "%s" - folder = element(split("/", google_folder.my-folder.name), 1) - description = "%s" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + folder = "${element(split("/", google_folder.my-folder.name), 1)}" + description = "%s" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" } resource "google_folder" "my-folder" { - display_name = "%s" - parent = "%s" -} -`, exclusionName, description, getTestProjectFromEnv(), folderName, folderParent) + display_name = "%s" + parent = "%s" +}`, exclusionName, description, getTestProjectFromEnv(), folderName, folderParent) } func testAccLoggingFolderExclusion_withFullFolderPath(exclusionName, description, folderName, folderParent string) string { return fmt.Sprintf(` resource "google_logging_folder_exclusion" "full-folder" { - name = "%s" - folder = google_folder.my-folder.name - description = "%s" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + folder = "${google_folder.my-folder.name}" + description = "%s" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" } resource "google_folder" "my-folder" { - display_name = "%s" - parent = "%s" -} -`, exclusionName, description, getTestProjectFromEnv(), folderName, folderParent) + display_name = "%s" + parent = "%s" +}`, exclusionName, description, getTestProjectFromEnv(), folderName, folderParent) } func testAccLoggingFolderExclusion_multipleCfg(folderName, folderParent string) string { @@ -225,10 +223,10 @@ resource "google_folder" "my-folder" { for i := 0; i < 3; i++ { s += fmt.Sprintf(` resource "google_logging_folder_exclusion" "basic%d" { - name = "%s" - folder = element(split("/", google_folder.my-folder.name), 1) - description = "Basic Folder Logging Exclusion" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + folder = "${element(split("/", google_folder.my-folder.name), 1)}" + description = "Basic Folder Logging Exclusion" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" } `, i, "tf-test-exclusion-"+acctest.RandString(10), getTestProjectFromEnv()) } diff --git a/google/resource_logging_folder_sink_test.go b/google/resource_logging_folder_sink_test.go index ea5f5f06386..1af933da522 100644 --- a/google/resource_logging_folder_sink_test.go +++ b/google/resource_logging_folder_sink_test.go @@ -222,70 +222,66 @@ func testAccCheckLoggingFolderSink(sink *logging.LogSink, n string) resource.Tes func testAccLoggingFolderSink_basic(sinkName, bucketName, folderName, folderParent string) string { return fmt.Sprintf(` resource "google_logging_folder_sink" "basic" { - name = "%s" - folder = element(split("/", google_folder.my-folder.name), 1) - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" - include_children = true + name = "%s" + folder = "${element(split("/", google_folder.my-folder.name), 1)}" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + include_children = true } resource "google_storage_bucket" "log-bucket" { - name = "%s" + name = "%s" } resource "google_folder" "my-folder" { - display_name = "%s" - parent = "%s" -} -`, sinkName, getTestProjectFromEnv(), bucketName, folderName, folderParent) + display_name = "%s" + parent = "%s" +}`, sinkName, getTestProjectFromEnv(), bucketName, folderName, folderParent) } func testAccLoggingFolderSink_withFullFolderPath(sinkName, bucketName, folderName, folderParent string) string { return fmt.Sprintf(` resource "google_logging_folder_sink" "basic" { - name = "%s" - folder = google_folder.my-folder.name - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" - include_children = false + name = "%s" + folder = "${google_folder.my-folder.name}" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + include_children = false } resource "google_storage_bucket" "log-bucket" { - name = "%s" + name = "%s" } resource "google_folder" "my-folder" { - display_name = "%s" - parent = "%s" -} -`, sinkName, getTestProjectFromEnv(), bucketName, folderName, folderParent) + display_name = "%s" + parent = "%s" +}`, sinkName, getTestProjectFromEnv(), bucketName, folderName, folderParent) } func testAccLoggingFolderSink_heredoc(sinkName, bucketName, folderName, folderParent string) string { return fmt.Sprintf(` resource "google_logging_folder_sink" "heredoc" { - name = "%s" - folder = element(split("/", google_folder.my-folder.name), 1) - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = <=ERROR -EOS - - include_children = true + EOS + include_children = true } resource "google_storage_bucket" "log-bucket" { - name = "%s" + name = "%s" } resource "google_folder" "my-folder" { - display_name = "%s" - parent = "%s" -} -`, sinkName, getTestProjectFromEnv(), bucketName, folderName, folderParent) + display_name = "%s" + parent = "%s" +}`, sinkName, getTestProjectFromEnv(), bucketName, folderName, folderParent) } diff --git a/google/resource_logging_metric_test.go b/google/resource_logging_metric_test.go index 3c4c57c9e40..62bd5763757 100644 --- a/google/resource_logging_metric_test.go +++ b/google/resource_logging_metric_test.go @@ -66,21 +66,20 @@ func TestAccLoggingMetric_explicitBucket(t *testing.T) { func testAccLoggingMetric_update(suffix string, filter string) string { return fmt.Sprintf(` resource "google_logging_metric" "logging_metric" { - name = "my-custom-metric-%s" - filter = "%s" - metric_descriptor { - metric_kind = "DELTA" - value_type = "INT64" - display_name = "My metric" - } -} -`, suffix, filter) + name = "my-custom-metric-%s" + filter = "%s" + metric_descriptor { + metric_kind = "DELTA" + value_type = "INT64" + display_name = "My metric" + } +}`, suffix, filter) } func testAccLoggingMetric_explicitBucket(suffix string, filter string) string { return fmt.Sprintf(` resource "google_logging_metric" "logging_metric" { - name = "my-custom-metric-%s" + name = "my-custom-metric-%s" filter = "%s" metric_descriptor { @@ -92,9 +91,8 @@ resource "google_logging_metric" "logging_metric" { bucket_options { explicit_buckets { - bounds = [0, 1, 2, 3, 4.2] + bounds = [0,1,2,3,4.2] } } -} -`, suffix, filter) +}`, suffix, filter) } diff --git a/google/resource_logging_organization_exclusion_test.go b/google/resource_logging_organization_exclusion_test.go index 5d77fb2125b..ebaecc82b25 100644 --- a/google/resource_logging_organization_exclusion_test.go +++ b/google/resource_logging_organization_exclusion_test.go @@ -136,10 +136,10 @@ func testAccCheckLoggingOrganizationExclusionDestroy(s *terraform.State) error { func testAccLoggingOrganizationExclusion_basicCfg(exclusionName, description, orgId string) string { return fmt.Sprintf(` resource "google_logging_organization_exclusion" "basic" { - name = "%s" - org_id = "%s" - description = "%s" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + org_id = "%s" + description = "%s" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" } `, exclusionName, orgId, description, getTestProjectFromEnv()) } diff --git a/google/resource_logging_organization_sink_test.go b/google/resource_logging_organization_sink_test.go index 7d2d9688ed8..a4d44c255af 100644 --- a/google/resource_logging_organization_sink_test.go +++ b/google/resource_logging_organization_sink_test.go @@ -188,55 +188,51 @@ func testAccCheckLoggingOrganizationSink(sink *logging.LogSink, n string) resour func testAccLoggingOrganizationSink_basic(sinkName, bucketName, orgId string) string { return fmt.Sprintf(` resource "google_logging_organization_sink" "basic" { - name = "%s" - org_id = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" - include_children = true + name = "%s" + org_id = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + include_children = true } resource "google_storage_bucket" "log-bucket" { - name = "%s" -} -`, sinkName, orgId, getTestProjectFromEnv(), bucketName) + name = "%s" +}`, sinkName, orgId, getTestProjectFromEnv(), bucketName) } func testAccLoggingOrganizationSink_update(sinkName, bucketName, orgId string) string { return fmt.Sprintf(` resource "google_logging_organization_sink" "update" { - name = "%s" - org_id = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" - include_children = false + name = "%s" + org_id = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + include_children = false } resource "google_storage_bucket" "log-bucket" { - name = "%s" -} -`, sinkName, orgId, getTestProjectFromEnv(), bucketName) + name = "%s" +}`, sinkName, orgId, getTestProjectFromEnv(), bucketName) } func testAccLoggingOrganizationSink_heredoc(sinkName, bucketName, orgId string) string { return fmt.Sprintf(` resource "google_logging_organization_sink" "heredoc" { - name = "%s" - org_id = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = <=ERROR -EOS - - include_children = true + EOS + include_children = true } resource "google_storage_bucket" "log-bucket" { - name = "%s" -} -`, sinkName, orgId, getTestProjectFromEnv(), bucketName) + name = "%s" +}`, sinkName, orgId, getTestProjectFromEnv(), bucketName) } diff --git a/google/resource_logging_project_exclusion_test.go b/google/resource_logging_project_exclusion_test.go index a83a7e414a0..aac52ab0178 100644 --- a/google/resource_logging_project_exclusion_test.go +++ b/google/resource_logging_project_exclusion_test.go @@ -158,32 +158,29 @@ func testAccCheckLoggingProjectExclusionDestroy(s *terraform.State) error { func testAccLoggingProjectExclusion_basicCfg(name string) string { return fmt.Sprintf(` resource "google_logging_project_exclusion" "basic" { - name = "%s" - description = "Basic Project Logging Exclusion" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" -} -`, name, getTestProjectFromEnv()) + name = "%s" + description = "Basic Project Logging Exclusion" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" +}`, name, getTestProjectFromEnv()) } func testAccLoggingProjectExclusion_basicUpdated(name string) string { return fmt.Sprintf(` resource "google_logging_project_exclusion" "basic" { - name = "%s" - description = "Basic Project Logging Exclusion" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=INFO" -} -`, name, getTestProjectFromEnv()) + name = "%s" + description = "Basic Project Logging Exclusion" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=INFO" +}`, name, getTestProjectFromEnv()) } func testAccLoggingProjectExclusion_basicDisabled(name string) string { return fmt.Sprintf(` resource "google_logging_project_exclusion" "basic" { - name = "%s" - description = "" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" - disabled = true -} -`, name, getTestProjectFromEnv()) + name = "%s" + description = "" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + disabled = true +}`, name, getTestProjectFromEnv()) } func testAccLoggingProjectExclusion_multipleCfg() string { diff --git a/google/resource_logging_project_sink_test.go b/google/resource_logging_project_sink_test.go index 938f26741dc..99e7dc7cbb1 100644 --- a/google/resource_logging_project_sink_test.go +++ b/google/resource_logging_project_sink_test.go @@ -109,16 +109,16 @@ func testAccCheckLoggingProjectSinkDestroy(s *terraform.State) error { func testAccLoggingProjectSink_basic(name, project, bucketName string) string { return fmt.Sprintf(` resource "google_logging_project_sink" "basic" { - name = "%s" - project = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + project = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" - unique_writer_identity = false + unique_writer_identity = false } resource "google_storage_bucket" "log-bucket" { - name = "%s" + name = "%s" } `, name, project, project, bucketName) } @@ -126,15 +126,15 @@ resource "google_storage_bucket" "log-bucket" { func testAccLoggingProjectSink_uniqueWriter(name, bucketName string) string { return fmt.Sprintf(` resource "google_logging_project_sink" "unique_writer" { - name = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" + name = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR" - unique_writer_identity = true + unique_writer_identity = true } resource "google_storage_bucket" "log-bucket" { - name = "%s" + name = "%s" } `, name, getTestProjectFromEnv(), bucketName) } @@ -142,15 +142,15 @@ resource "google_storage_bucket" "log-bucket" { func testAccLoggingProjectSink_uniqueWriterUpdated(name, bucketName string) string { return fmt.Sprintf(` resource "google_logging_project_sink" "unique_writer" { - name = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=WARNING" + name = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=WARNING" - unique_writer_identity = true + unique_writer_identity = true } resource "google_storage_bucket" "log-bucket" { - name = "%s" + name = "%s" } `, name, getTestProjectFromEnv(), bucketName) } @@ -158,23 +158,22 @@ resource "google_storage_bucket" "log-bucket" { func testAccLoggingProjectSink_heredoc(name, project, bucketName string) string { return fmt.Sprintf(` resource "google_logging_project_sink" "heredoc" { - name = "%s" - project = "%s" - destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" + name = "%s" + project = "%s" + destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}" - filter = <=ERROR + EOS -EOS - - unique_writer_identity = false + unique_writer_identity = false } resource "google_storage_bucket" "log-bucket" { - name = "%s" + name = "%s" } `, name, project, project, bucketName) } diff --git a/google/resource_monitoring_notification_channel_test.go b/google/resource_monitoring_notification_channel_test.go index 5713cfa3f0b..c6aa24684a3 100644 --- a/google/resource_monitoring_notification_channel_test.go +++ b/google/resource_monitoring_notification_channel_test.go @@ -60,11 +60,10 @@ func testAccMonitoringNotificationChannel_update(channel, labels, enabled string return fmt.Sprintf(` resource "google_monitoring_notification_channel" "update" { display_name = "IntTest Notification Channel" - type = "%s" + type = "%s" labels = { %s } - enabled = "%s" } `, channel, labels, enabled, diff --git a/google/resource_monitoring_uptime_check_config_test.go b/google/resource_monitoring_uptime_check_config_test.go index 889eca06318..7f967216fdc 100644 --- a/google/resource_monitoring_uptime_check_config_test.go +++ b/google/resource_monitoring_uptime_check_config_test.go @@ -86,7 +86,7 @@ func testAccMonitoringUptimeCheckConfig_update(path, project, pwd, host string) return fmt.Sprintf(` resource "google_monitoring_uptime_check_config" "http" { display_name = "http-uptime-check-%s" - timeout = "60s" + timeout = "60s" http_check { path = "/%s" @@ -101,7 +101,7 @@ resource "google_monitoring_uptime_check_config" "http" { type = "uptime_url" labels = { project_id = "%s" - host = "%s" + host = "%s" } } diff --git a/google/resource_pubsub_subscription_iam_test.go b/google/resource_pubsub_subscription_iam_test.go index a2eeac38742..0145e5f1017 100644 --- a/google/resource_pubsub_subscription_iam_test.go +++ b/google/resource_pubsub_subscription_iam_test.go @@ -142,7 +142,7 @@ resource "google_pubsub_topic" "topic" { resource "google_pubsub_subscription" "subscription" { name = "%s" - topic = google_pubsub_topic.topic.id + topic = "${google_pubsub_topic.topic.id}" } resource "google_service_account" "test-account-1" { @@ -151,9 +151,9 @@ resource "google_service_account" "test-account-1" { } resource "google_pubsub_subscription_iam_binding" "foo" { - subscription = google_pubsub_subscription.subscription.id + subscription = "${google_pubsub_subscription.subscription.id}" role = "roles/pubsub.subscriber" - members = [ + members = [ "serviceAccount:${google_service_account.test-account-1.email}", ] } @@ -168,9 +168,10 @@ resource "google_pubsub_topic" "topic" { resource "google_pubsub_subscription" "subscription" { name = "%s" - topic = google_pubsub_topic.topic.id + topic = "${google_pubsub_topic.topic.id}" } + resource "google_service_account" "test-account-1" { account_id = "%s-1" display_name = "Pubsub Subscription Iam Testing Account" @@ -182,9 +183,9 @@ resource "google_service_account" "test-account-2" { } resource "google_pubsub_subscription_iam_binding" "foo" { - subscription = google_pubsub_subscription.subscription.id + subscription = "${google_pubsub_subscription.subscription.id}" role = "roles/pubsub.subscriber" - members = [ + members = [ "serviceAccount:${google_service_account.test-account-1.email}", "serviceAccount:${google_service_account.test-account-2.email}", ] @@ -200,16 +201,17 @@ resource "google_pubsub_topic" "topic" { resource "google_pubsub_subscription" "subscription" { name = "%s" - topic = google_pubsub_topic.topic.id + topic = "${google_pubsub_topic.topic.id}" } + resource "google_service_account" "test-account" { account_id = "%s" display_name = "Pubsub Subscription Iam Testing Account" } resource "google_pubsub_subscription_iam_member" "foo" { - subscription = google_pubsub_subscription.subscription.id + subscription = "${google_pubsub_subscription.subscription.id}" role = "roles/pubsub.subscriber" member = "serviceAccount:${google_service_account.test-account.email}" } @@ -224,24 +226,25 @@ resource "google_pubsub_topic" "topic" { resource "google_pubsub_subscription" "subscription" { name = "%s" - topic = google_pubsub_topic.topic.id + topic = "${google_pubsub_topic.topic.id}" } + resource "google_service_account" "test-account" { account_id = "%s" display_name = "Pubsub Subscription Iam Testing Account" } data "google_iam_policy" "foo" { - binding { - role = "%s" - members = ["serviceAccount:${google_service_account.test-account.email}"] - } + binding { + role = "%s" + members = ["serviceAccount:${google_service_account.test-account.email}"] + } } resource "google_pubsub_subscription_iam_policy" "foo" { - subscription = google_pubsub_subscription.subscription.id - policy_data = data.google_iam_policy.foo.policy_data + subscription = "${google_pubsub_subscription.subscription.id}" + policy_data = "${data.google_iam_policy.foo.policy_data}" } `, topic, subscription, account, role) } diff --git a/google/resource_pubsub_subscription_test.go b/google/resource_pubsub_subscription_test.go index 161e1e10886..d7c7e2d8a2b 100644 --- a/google/resource_pubsub_subscription_test.go +++ b/google/resource_pubsub_subscription_test.go @@ -120,27 +120,26 @@ func TestAccPubsubSubscription_push(t *testing.T) { func testAccPubsubSubscription_emptyTTL(topic, subscription string) string { return fmt.Sprintf(` resource "google_pubsub_topic" "foo" { - name = "%s" + name = "%s" } resource "google_pubsub_subscription" "foo" { - name = "%s" - topic = google_pubsub_topic.foo.id - - message_retention_duration = "1200s" - retain_acked_messages = true - ack_deadline_seconds = 20 - expiration_policy { - ttl = "" - } + name = "%s" + topic = "${google_pubsub_topic.foo.id}" + + message_retention_duration = "1200s" + retain_acked_messages = true + ack_deadline_seconds = 20 + expiration_policy { + ttl = "" + } } `, topic, subscription) } func testAccPubsubSubscription_push(topicFoo string, subscription string) string { return fmt.Sprintf(` -data "google_project" "project" { -} +data "google_project" "project" {} resource "google_service_account" "pub_sub_service_account" { account_id = "my-super-service" @@ -157,17 +156,17 @@ data "google_iam_policy" "admin" { } resource "google_pubsub_topic" "foo" { - name = "%s" + name = "%s" } resource "google_pubsub_subscription" "foo" { name = "%s" - topic = google_pubsub_topic.foo.name + topic = "${google_pubsub_topic.foo.name}" ack_deadline_seconds = 10 push_config { push_endpoint = "https://${data.google_project.project.project_id}.appspot.com" oidc_token { - service_account_email = google_service_account.pub_sub_service_account.email + service_account_email = "${google_service_account.pub_sub_service_account.email}" } } } @@ -177,16 +176,16 @@ resource "google_pubsub_subscription" "foo" { func testAccPubsubSubscription_basic(topic, subscription, label string, deadline int) string { return fmt.Sprintf(` resource "google_pubsub_topic" "foo" { - name = "%s" + name = "%s" } resource "google_pubsub_subscription" "foo" { - name = "%s" - topic = google_pubsub_topic.foo.id - labels = { - foo = "%s" - } - ack_deadline_seconds = %d + name = "%s" + topic = "${google_pubsub_topic.foo.id}" + labels = { + foo = "%s" + } + ack_deadline_seconds = %d } `, topic, subscription, label, deadline) } diff --git a/google/resource_pubsub_topic_iam_test.go b/google/resource_pubsub_topic_iam_test.go index 2032e1e72c7..0ce034ea957 100644 --- a/google/resource_pubsub_topic_iam_test.go +++ b/google/resource_pubsub_topic_iam_test.go @@ -172,7 +172,7 @@ resource "google_service_account" "test-account-1" { resource "google_pubsub_topic_iam_binding" "foo" { project = "%s" - topic = google_pubsub_topic.topic.name + topic = "${google_pubsub_topic.topic.name}" role = "roles/pubsub.publisher" members = [ "serviceAccount:${google_service_account.test-account-1.email}", @@ -194,8 +194,8 @@ resource "google_service_account" "test-account-1" { resource "google_pubsub_topic_iam_binding" "foo" { # use the id instead of the name because it's more compatible with import - topic = google_pubsub_topic.topic.id - role = "roles/pubsub.publisher" + topic = "${google_pubsub_topic.topic.id}" + role = "roles/pubsub.publisher" members = [ "serviceAccount:${google_service_account.test-account-1.email}", ] @@ -221,8 +221,8 @@ resource "google_service_account" "test-account-2" { resource "google_pubsub_topic_iam_binding" "foo" { # use the id instead of the name because it's more compatible with import - topic = google_pubsub_topic.topic.id - role = "roles/pubsub.publisher" + topic = "${google_pubsub_topic.topic.id}" + role = "roles/pubsub.publisher" members = [ "serviceAccount:${google_service_account.test-account-1.email}", "serviceAccount:${google_service_account.test-account-2.email}", @@ -243,8 +243,8 @@ resource "google_service_account" "test-account" { } resource "google_pubsub_topic_iam_member" "foo" { - topic = google_pubsub_topic.topic.id - role = "roles/pubsub.publisher" + topic = "${google_pubsub_topic.topic.id}" + role = "roles/pubsub.publisher" member = "serviceAccount:${google_service_account.test-account.email}" } `, topic, account) @@ -262,15 +262,15 @@ resource "google_service_account" "test-account" { } data "google_iam_policy" "foo" { - binding { - role = "%s" - members = ["serviceAccount:${google_service_account.test-account.email}"] - } + binding { + role = "%s" + members = ["serviceAccount:${google_service_account.test-account.email}"] + } } resource "google_pubsub_topic_iam_policy" "foo" { - topic = google_pubsub_topic.topic.id - policy_data = data.google_iam_policy.foo.policy_data + topic = "${google_pubsub_topic.topic.id}" + policy_data = "${data.google_iam_policy.foo.policy_data}" } `, topic, account, role) } diff --git a/google/resource_pubsub_topic_test.go b/google/resource_pubsub_topic_test.go index c1880660a20..d943681a9f7 100644 --- a/google/resource_pubsub_topic_test.go +++ b/google/resource_pubsub_topic_test.go @@ -66,10 +66,10 @@ func TestAccPubsubTopic_cmek(t *testing.T) { func testAccPubsubTopic_update(topic, key, value string) string { return fmt.Sprintf(` resource "google_pubsub_topic" "foo" { - name = "%s" - labels = { - %s = "%s" - } + name = "%s" + labels = { + %s = "%s" + } } `, topic, key, value) } @@ -77,16 +77,16 @@ resource "google_pubsub_topic" "foo" { func testAccPubsubTopic_updateWithRegion(topic, key, value, region string) string { return fmt.Sprintf(` resource "google_pubsub_topic" "foo" { - name = "%s" - labels = { - %s = "%s" - } + name = "%s" + labels = { + %s = "%s" + } - message_storage_policy { - allowed_persistence_regions = [ - "%s", - ] - } + message_storage_policy { + allowed_persistence_regions = [ + "%s", + ] + } } `, topic, key, value, region) } @@ -98,14 +98,14 @@ data "google_project" "project" { } resource "google_project_iam_member" "kms-project-binding" { - project = data.google_project.project.project_id + project = "${data.google_project.project.project_id}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-pubsub.iam.gserviceaccount.com" } resource "google_pubsub_topic" "topic" { name = "%s" - project = google_project_iam_member.kms-project-binding.project + project = "${google_project_iam_member.kms-project-binding.project}" kms_key_name = "%s" } `, pid, topicName, kmsKey) diff --git a/google/resource_redis_instance_test.go b/google/resource_redis_instance_test.go index 6b9c6895ae3..939af9d69da 100644 --- a/google/resource_redis_instance_test.go +++ b/google/resource_redis_instance_test.go @@ -73,50 +73,47 @@ func TestAccRedisInstance_regionFromLocation(t *testing.T) { func testAccRedisInstance_update(name string) string { return fmt.Sprintf(` resource "google_redis_instance" "test" { - name = "%s" - display_name = "pre-update" - memory_size_gb = 1 - region = "us-central1" - - labels = { - my_key = "my_val" - other_key = "other_val" - } - - redis_configs = { - maxmemory-policy = "allkeys-lru" - notify-keyspace-events = "KEA" - } -} -`, name) + name = "%s" + display_name = "pre-update" + memory_size_gb = 1 + region = "us-central1" + + labels = { + my_key = "my_val" + other_key = "other_val" + } + + redis_configs = { + maxmemory-policy = "allkeys-lru" + notify-keyspace-events = "KEA" + } +}`, name) } func testAccRedisInstance_update2(name string) string { return fmt.Sprintf(` resource "google_redis_instance" "test" { - name = "%s" - display_name = "post-update" - memory_size_gb = 1 - - labels = { - my_key = "my_val" - other_key = "new_val" - } - - redis_configs = { - maxmemory-policy = "noeviction" - notify-keyspace-events = "" - } -} -`, name) + name = "%s" + display_name = "post-update" + memory_size_gb = 1 + + labels = { + my_key = "my_val" + other_key = "new_val" + } + + redis_configs = { + maxmemory-policy = "noeviction" + notify-keyspace-events = "" + } +}`, name) } func testAccRedisInstance_regionFromLocation(name, zone string) string { return fmt.Sprintf(` resource "google_redis_instance" "test" { - name = "%s" - memory_size_gb = 1 - location_id = "%s" -} -`, name, zone) + name = "%s" + memory_size_gb = 1 + location_id = "%s" +}`, name, zone) } diff --git a/google/resource_resourcemanager_lien_test.go b/google/resource_resourcemanager_lien_test.go index c2975b03295..e89de32f17d 100644 --- a/google/resource_resourcemanager_lien_test.go +++ b/google/resource_resourcemanager_lien_test.go @@ -94,15 +94,15 @@ func testAccResourceManagerLien_basic(projectName, org string) string { return fmt.Sprintf(` resource "google_project" "project" { project_id = "%s" - name = "some test project" - org_id = "%s" + name = "some test project" + org_id = "%s" } resource "google_resource_manager_lien" "lien" { - parent = "projects/${google_project.project.project_id}" + parent = "projects/${google_project.project.project_id}" restrictions = ["resourcemanager.projects.delete"] - origin = "something" - reason = "something else" + origin = "something" + reason = "something else" } `, projectName, org) } diff --git a/google/resource_runtimeconfig_config_test.go b/google/resource_runtimeconfig_config_test.go index ee0f2bfc537..7f84f86606c 100644 --- a/google/resource_runtimeconfig_config_test.go +++ b/google/resource_runtimeconfig_config_test.go @@ -157,16 +157,14 @@ func testAccCheckRuntimeconfigConfigDestroy(s *terraform.State) error { func testAccRuntimeconfigConfig_basicDescription(name, description string) string { return fmt.Sprintf(` resource "google_runtimeconfig_config" "foobar" { - name = "%s" - description = "%s" -} -`, name, description) + name = "%s" + description = "%s" +}`, name, description) } func testAccRuntimeconfigConfig_emptyDescription(name string) string { return fmt.Sprintf(` resource "google_runtimeconfig_config" "foobar" { - name = "%s" -} -`, name) + name = "%s" +}`, name) } diff --git a/google/resource_runtimeconfig_variable_test.go b/google/resource_runtimeconfig_variable_test.go index e0cc4dfa47c..4ee12dd3b5e 100644 --- a/google/resource_runtimeconfig_variable_test.go +++ b/google/resource_runtimeconfig_variable_test.go @@ -227,69 +227,64 @@ func testAccCheckRuntimeconfigVariableDestroy(s *terraform.State) error { func testAccRuntimeconfigVariable_basicText(name, text string) string { return fmt.Sprintf(` resource "google_runtimeconfig_config" "foobar" { - name = "some-config-%s" + name = "some-config-%s" } resource "google_runtimeconfig_variable" "foobar" { - parent = google_runtimeconfig_config.foobar.name - name = "%s" - text = "%s" -} -`, acctest.RandString(10), name, text) + parent = "${google_runtimeconfig_config.foobar.name}" + name = "%s" + text = "%s" +}`, acctest.RandString(10), name, text) } func testAccRuntimeconfigVariable_basicTextUpdate(configName, name, text string) string { return fmt.Sprintf(` resource "google_runtimeconfig_config" "foobar" { - name = "%s" + name = "%s" } resource "google_runtimeconfig_variable" "foobar" { - parent = google_runtimeconfig_config.foobar.name - name = "%s" - text = "%s" -} -`, configName, name, text) + parent = "${google_runtimeconfig_config.foobar.name}" + name = "%s" + text = "%s" +}`, configName, name, text) } func testAccRuntimeconfigVariable_basicValue(name, value string) string { return fmt.Sprintf(` resource "google_runtimeconfig_config" "foobar" { - name = "some-config-%s" + name = "some-config-%s" } resource "google_runtimeconfig_variable" "foobar" { - parent = google_runtimeconfig_config.foobar.name - name = "%s" - value = "%s" -} -`, acctest.RandString(10), name, value) + parent = "${google_runtimeconfig_config.foobar.name}" + name = "%s" + value = "%s" +}`, acctest.RandString(10), name, value) } func testAccRuntimeconfigVariable_invalidBothTextValue() string { return fmt.Sprintf(` resource "google_runtimeconfig_config" "foobar" { - name = "some-config-%s" + name = "some-config-%s" } resource "google_runtimeconfig_variable" "foobar" { - parent = google_runtimeconfig_config.foobar.name - name = "%s" - text = "here's my value" - value = "Zm9vYmFyCg==" -} -`, acctest.RandString(10), acctest.RandString(10)) + parent = "${google_runtimeconfig_config.foobar.name}" + name = "%s" + text = "here's my value" + value = "Zm9vYmFyCg==" +}`, acctest.RandString(10), acctest.RandString(10)) } func testAccRuntimeconfigVariable_invalidMissingTextValue() string { return fmt.Sprintf(` resource "google_runtimeconfig_config" "foobar" { - name = "some-config-%s" + name = "some-config-%s" } resource "google_runtimeconfig_variable" "foobar" { - parent = google_runtimeconfig_config.foobar.name - name = "my-variable-namespace/%s" -} -`, acctest.RandString(10), acctest.RandString(10)) + parent = "${google_runtimeconfig_config.foobar.name}" + name = "my-variable-namespace/%s" +}`, acctest.RandString(10), acctest.RandString(10)) } diff --git a/google/resource_service_networking_connection_test.go b/google/resource_service_networking_connection_test.go index 65263055da9..cdec8d84f45 100644 --- a/google/resource_service_networking_connection_test.go +++ b/google/resource_service_networking_connection_test.go @@ -123,21 +123,21 @@ func testServiceNetworkingConnectionDestroy(parent, network, project string) res func testAccServiceNetworkingConnection(networkName, addressRangeName, serviceName string) string { return fmt.Sprintf(` resource "google_compute_network" "foobar" { - name = "%s" + name = "%s" } resource "google_compute_global_address" "foobar" { - name = "%s" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 16 - network = google_compute_network.foobar.self_link + name = "%s" + purpose = "VPC_PEERING" + address_type = "INTERNAL" + prefix_length = 16 + network = "${google_compute_network.foobar.self_link}" } resource "google_service_networking_connection" "foobar" { - network = google_compute_network.foobar.self_link - service = "%s" - reserved_peering_ranges = [google_compute_global_address.foobar.name] + network = "${google_compute_network.foobar.self_link}" + service = "%s" + reserved_peering_ranges = ["${google_compute_global_address.foobar.name}"] } `, networkName, addressRangeName, serviceName) } @@ -145,15 +145,15 @@ resource "google_service_networking_connection" "foobar" { func testAccServiceNetworkingConnectionDestroy(networkName, addressRangeName string) string { return fmt.Sprintf(` resource "google_compute_network" "foobar" { - name = "%s" + name = "%s" } resource "google_compute_global_address" "foobar" { - name = "%s" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 16 - network = google_compute_network.foobar.self_link + name = "%s" + purpose = "VPC_PEERING" + address_type = "INTERNAL" + prefix_length = 16 + network = "${google_compute_network.foobar.self_link}" } `, networkName, addressRangeName) } diff --git a/google/resource_sourcerepo_repository_test.go b/google/resource_sourcerepo_repository_test.go index cdb35bb6af4..cf799a06bc4 100644 --- a/google/resource_sourcerepo_repository_test.go +++ b/google/resource_sourcerepo_repository_test.go @@ -34,5 +34,5 @@ func testAccSourceRepoRepository_basic(repositoryName string) string { resource "google_sourcerepo_repository" "acceptance" { name = "%s" } -`, repositoryName) + `, repositoryName) } diff --git a/google/resource_spanner_database_iam_test.go b/google/resource_spanner_database_iam_test.go index 294fb9f835e..e1da8b0b297 100644 --- a/google/resource_spanner_database_iam_test.go +++ b/google/resource_spanner_database_iam_test.go @@ -129,16 +129,16 @@ resource "google_spanner_instance" "instance" { } resource "google_spanner_database" "database" { - instance = google_spanner_instance.instance.name + instance = "${google_spanner_instance.instance.name}" name = "%s" } resource "google_spanner_database_iam_binding" "foo" { - project = google_spanner_database.database.project - database = google_spanner_database.database.name - instance = google_spanner_database.database.instance - role = "%s" - members = ["serviceAccount:${google_service_account.test_account.email}"] + project = "${google_spanner_database.database.project}" + database = "${google_spanner_database.database.name}" + instance = "${google_spanner_database.database.instance}" + role = "%s" + members = ["serviceAccount:${google_service_account.test_account.email}"] } `, account, instance, instance, database, roleId) } @@ -163,18 +163,18 @@ resource "google_spanner_instance" "instance" { } resource "google_spanner_database" "database" { - instance = google_spanner_instance.instance.name + instance = "${google_spanner_instance.instance.name}" name = "%s" } resource "google_spanner_database_iam_binding" "foo" { - project = google_spanner_database.database.project - database = google_spanner_database.database.name - instance = google_spanner_database.database.instance - role = "%s" - members = [ + project = "${google_spanner_database.database.project}" + database = "${google_spanner_database.database.name}" + instance = "${google_spanner_database.database.instance}" + role = "%s" + members = [ "serviceAccount:${google_service_account.test_account.email}", - "serviceAccount:${google_service_account.test_account_2.email}", + "serviceAccount:${google_service_account.test_account_2.email}" ] } `, account, account, instance, instance, database, roleId) @@ -195,16 +195,16 @@ resource "google_spanner_instance" "instance" { } resource "google_spanner_database" "database" { - instance = google_spanner_instance.instance.name + instance = "${google_spanner_instance.instance.name}" name = "%s" } resource "google_spanner_database_iam_member" "foo" { - project = google_spanner_database.database.project - database = google_spanner_database.database.name - instance = google_spanner_database.database.instance - role = "%s" - member = "serviceAccount:${google_service_account.test_account.email}" + project = "${google_spanner_database.database.project}" + database = "${google_spanner_database.database.name}" + instance = "${google_spanner_database.database.instance}" + role = "%s" + member = "serviceAccount:${google_service_account.test_account.email}" } `, account, instance, instance, database, roleId) } @@ -224,23 +224,23 @@ resource "google_spanner_instance" "instance" { } resource "google_spanner_database" "database" { - instance = google_spanner_instance.instance.name + instance = "${google_spanner_instance.instance.name}" name = "%s" } data "google_iam_policy" "foo" { - binding { - role = "%s" + binding { + role = "%s" - members = ["serviceAccount:${google_service_account.test_account.email}"] - } + members = ["serviceAccount:${google_service_account.test_account.email}"] + } } resource "google_spanner_database_iam_policy" "foo" { - project = google_spanner_database.database.project - database = google_spanner_database.database.name - instance = google_spanner_database.database.instance - policy_data = data.google_iam_policy.foo.policy_data + project = "${google_spanner_database.database.project}" + database = "${google_spanner_database.database.name}" + instance = "${google_spanner_database.database.instance}" + policy_data = "${data.google_iam_policy.foo.policy_data}" } `, account, instance, instance, database, roleId) } diff --git a/google/resource_spanner_database_test.go b/google/resource_spanner_database_test.go index 530479a3413..a5fea593e6f 100644 --- a/google/resource_spanner_database_test.go +++ b/google/resource_spanner_database_test.go @@ -58,15 +58,15 @@ func TestAccSpannerDatabase_basic(t *testing.T) { func testAccSpannerDatabase_basic(instanceName, databaseName string) string { return fmt.Sprintf(` resource "google_spanner_instance" "basic" { - name = "%s" - config = "regional-us-central1" - display_name = "display-%s" - num_nodes = 1 + name = "%s" + config = "regional-us-central1" + display_name = "display-%s" + num_nodes = 1 } resource "google_spanner_database" "basic" { - instance = google_spanner_instance.basic.name - name = "%s" + instance = "${google_spanner_instance.basic.name}" + name = "%s" } `, instanceName, instanceName, databaseName) } diff --git a/google/resource_spanner_instance_iam_test.go b/google/resource_spanner_instance_iam_test.go index 854558b9f6d..753ab97d809 100644 --- a/google/resource_spanner_instance_iam_test.go +++ b/google/resource_spanner_instance_iam_test.go @@ -122,10 +122,10 @@ resource "google_spanner_instance" "instance" { } resource "google_spanner_instance_iam_binding" "foo" { - project = google_spanner_instance.instance.project - instance = google_spanner_instance.instance.name - role = "%s" - members = ["serviceAccount:${google_service_account.test_account.email}"] + project = "${google_spanner_instance.instance.project}" + instance = "${google_spanner_instance.instance.name}" + role = "%s" + members = ["serviceAccount:${google_service_account.test_account.email}"] } `, account, instance, instance, roleId) } @@ -150,12 +150,12 @@ resource "google_spanner_instance" "instance" { } resource "google_spanner_instance_iam_binding" "foo" { - project = google_spanner_instance.instance.project - instance = google_spanner_instance.instance.name - role = "%s" - members = [ + project = "${google_spanner_instance.instance.project}" + instance = "${google_spanner_instance.instance.name}" + role = "%s" + members = [ "serviceAccount:${google_service_account.test_account.email}", - "serviceAccount:${google_service_account.test_account_2.email}", + "serviceAccount:${google_service_account.test_account_2.email}" ] } `, account, account, instance, instance, roleId) @@ -176,10 +176,10 @@ resource "google_spanner_instance" "instance" { } resource "google_spanner_instance_iam_member" "foo" { - project = google_spanner_instance.instance.project - instance = google_spanner_instance.instance.name - role = "%s" - member = "serviceAccount:${google_service_account.test_account.email}" + project = "${google_spanner_instance.instance.project}" + instance = "${google_spanner_instance.instance.name}" + role = "%s" + member = "serviceAccount:${google_service_account.test_account.email}" } `, account, instance, instance, roleId) } @@ -199,17 +199,17 @@ resource "google_spanner_instance" "instance" { } data "google_iam_policy" "foo" { - binding { - role = "%s" + binding { + role = "%s" - members = ["serviceAccount:${google_service_account.test_account.email}"] - } + members = ["serviceAccount:${google_service_account.test_account.email}"] + } } resource "google_spanner_instance_iam_policy" "foo" { - project = google_spanner_instance.instance.project - instance = google_spanner_instance.instance.name - policy_data = data.google_iam_policy.foo.policy_data + project = "${google_spanner_instance.instance.project}" + instance = "${google_spanner_instance.instance.name}" + policy_data = "${data.google_iam_policy.foo.policy_data}" } `, account, instance, instance, roleId) } diff --git a/google/resource_spanner_instance_test.go b/google/resource_spanner_instance_test.go index e269036c351..a7b6de0dcea 100644 --- a/google/resource_spanner_instance_test.go +++ b/google/resource_spanner_instance_test.go @@ -129,10 +129,10 @@ func TestAccSpannerInstance_update(t *testing.T) { func testAccSpannerInstance_basic(name string) string { return fmt.Sprintf(` resource "google_spanner_instance" "basic" { - name = "%s" - config = "regional-us-central1" - display_name = "%s-dname" - num_nodes = 1 + name = "%s" + config = "regional-us-central1" + display_name = "%s-dname" + num_nodes = 1 } `, name, name) } @@ -140,9 +140,9 @@ resource "google_spanner_instance" "basic" { func testAccSpannerInstance_basicWithAutogenName(name string) string { return fmt.Sprintf(` resource "google_spanner_instance" "basic" { - config = "regional-us-central1" - display_name = "%s" - num_nodes = 1 + config = "regional-us-central1" + display_name = "%s" + num_nodes = 1 } `, name) } @@ -154,13 +154,13 @@ func testAccSpannerInstance_update(name string, nodes int, addLabel bool) string } return fmt.Sprintf(` resource "google_spanner_instance" "updater" { - config = "regional-us-central1" - display_name = "%s" - num_nodes = %d + config = "regional-us-central1" + display_name = "%s" + num_nodes = %d labels = { - "key1" = "value1" - %s + "key1" = "value1" + %s } } `, name, nodes, extraLabel) diff --git a/google/resource_sql_database_instance_test.go b/google/resource_sql_database_instance_test.go index 435660d4986..2472b54148e 100644 --- a/google/resource_sql_database_instance_test.go +++ b/google/resource_sql_database_instance_test.go @@ -632,84 +632,82 @@ func testAccCheckGoogleSqlDatabaseRootUserDoesNotExist(instance string) resource var testGoogleSqlDatabaseInstance_basic = ` resource "google_sql_database_instance" "instance" { - name = "tf-lw-%d" - region = "us-central" - settings { - tier = "D0" - crash_safe_replication = false - } + name = "tf-lw-%d" + region = "us-central" + settings { + tier = "D0" + crash_safe_replication = false + } } ` var testGoogleSqlDatabaseInstance_basic2 = ` resource "google_sql_database_instance" "instance" { - region = "us-central" - settings { - tier = "D0" - crash_safe_replication = false - } + region = "us-central" + settings { + tier = "D0" + crash_safe_replication = false + } } ` var testGoogleSqlDatabaseInstance_basic3 = ` resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central1" - settings { - tier = "db-f1-micro" - } + name = "%s" + region = "us-central1" + settings { + tier = "db-f1-micro" + } } ` func testGoogleSqlDatabaseInstanceConfig_withoutReplica(instanceName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central1" - database_version = "MYSQL_5_7" + return fmt.Sprintf(`resource "google_sql_database_instance" "instance" { + name = "%s" + region = "us-central1" + database_version = "MYSQL_5_7" settings { - tier = "db-n1-standard-1" + tier = "db-n1-standard-1" backup_configuration { - binary_log_enabled = "true" - enabled = "true" - start_time = "18:00" + binary_log_enabled = "true" + enabled = "true" + start_time = "18:00" } } -} -`, instanceName) +}`, instanceName) } func testGoogleSqlDatabaseInstanceConfig_withReplica(instanceName, failoverName string) string { return fmt.Sprintf(` resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central1" - database_version = "MYSQL_5_7" + name = "%s" + region = "us-central1" + database_version = "MYSQL_5_7" settings { - tier = "db-n1-standard-1" + tier = "db-n1-standard-1" backup_configuration { - binary_log_enabled = "true" - enabled = "true" - start_time = "18:00" + binary_log_enabled = "true" + enabled = "true" + start_time = "18:00" } } } resource "google_sql_database_instance" "instance-failover" { - name = "%s" - region = "us-central1" - database_version = "MYSQL_5_7" - master_instance_name = google_sql_database_instance.instance.name + name = "%s" + region = "us-central1" + database_version = "MYSQL_5_7" + master_instance_name = "${google_sql_database_instance.instance.name}" replica_configuration { - failover_target = "true" + failover_target = "true" } settings { - tier = "db-n1-standard-1" + tier = "db-n1-standard-1" } } `, instanceName, failoverName) @@ -717,252 +715,252 @@ resource "google_sql_database_instance" "instance-failover" { var testGoogleSqlDatabaseInstance_settings = ` resource "google_sql_database_instance" "instance" { - name = "tf-lw-%d" - region = "us-central" - settings { - tier = "D0" - crash_safe_replication = false - replication_type = "ASYNCHRONOUS" - location_preference { - zone = "us-central1-f" - } + name = "tf-lw-%d" + region = "us-central" + settings { + tier = "D0" + crash_safe_replication = false + replication_type = "ASYNCHRONOUS" + location_preference { + zone = "us-central1-f" + } - ip_configuration { - ipv4_enabled = "true" - authorized_networks { - value = "108.12.12.12" - name = "misc" - expiration_time = "2050-11-15T16:19:00.094Z" - } - } + ip_configuration { + ipv4_enabled = "true" + authorized_networks { + value = "108.12.12.12" + name = "misc" + expiration_time = "2050-11-15T16:19:00.094Z" + } + } - backup_configuration { - enabled = "true" - start_time = "19:19" - } + backup_configuration { + enabled = "true" + start_time = "19:19" + } - activation_policy = "ON_DEMAND" - } + activation_policy = "ON_DEMAND" + } } ` var testGoogleSqlDatabaseInstance_replica = ` resource "google_sql_database_instance" "instance_master" { - name = "tf-lw-%d" - database_version = "MYSQL_5_6" - region = "us-central1" + name = "tf-lw-%d" + database_version = "MYSQL_5_6" + region = "us-central1" - settings { - tier = "db-n1-standard-1" + settings { + tier = "db-n1-standard-1" - backup_configuration { - enabled = true - start_time = "00:00" - binary_log_enabled = true - } - } + backup_configuration { + enabled = true + start_time = "00:00" + binary_log_enabled = true + } + } } resource "google_sql_database_instance" "replica1" { - name = "tf-lw-%d-1" - database_version = "MYSQL_5_6" - region = "us-central1" + name = "tf-lw-%d-1" + database_version = "MYSQL_5_6" + region = "us-central1" - settings { - tier = "db-n1-standard-1" - } + settings { + tier = "db-n1-standard-1" + } - master_instance_name = google_sql_database_instance.instance_master.name + master_instance_name = "${google_sql_database_instance.instance_master.name}" - replica_configuration { - connect_retry_interval = 100 - master_heartbeat_period = 10000 - password = "password" - username = "username" - ssl_cipher = "ALL" - verify_server_certificate = false - } + replica_configuration { + connect_retry_interval = 100 + master_heartbeat_period = 10000 + password = "password" + username = "username" + ssl_cipher = "ALL" + verify_server_certificate = false + } } resource "google_sql_database_instance" "replica2" { - name = "tf-lw-%d-2" - database_version = "MYSQL_5_6" - region = "us-central1" + name = "tf-lw-%d-2" + database_version = "MYSQL_5_6" + region = "us-central1" - settings { - tier = "db-n1-standard-1" - } + settings { + tier = "db-n1-standard-1" + } - master_instance_name = google_sql_database_instance.instance_master.name + master_instance_name = "${google_sql_database_instance.instance_master.name}" - replica_configuration { - connect_retry_interval = 100 - master_heartbeat_period = 10000 - password = "password" - username = "username" - ssl_cipher = "ALL" - verify_server_certificate = false - } + replica_configuration { + connect_retry_interval = 100 + master_heartbeat_period = 10000 + password = "password" + username = "username" + ssl_cipher = "ALL" + verify_server_certificate = false + } } ` var testGoogleSqlDatabaseInstance_slave = ` resource "google_sql_database_instance" "instance_master" { - name = "tf-lw-%d" - region = "us-central1" + name = "tf-lw-%d" + region = "us-central1" - settings { - tier = "db-f1-micro" + settings { + tier = "db-f1-micro" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } + backup_configuration { + enabled = true + binary_log_enabled = true + } + } } resource "google_sql_database_instance" "instance_slave" { - name = "tf-lw-%d" - region = "us-central1" + name = "tf-lw-%d" + region = "us-central1" - master_instance_name = google_sql_database_instance.instance_master.name + master_instance_name = "${google_sql_database_instance.instance_master.name}" - settings { - tier = "db-f1-micro" - } + settings { + tier = "db-f1-micro" + } } ` var testGoogleSqlDatabaseInstance_highAvailability = ` resource "google_sql_database_instance" "instance" { - name = "tf-lw-%d" - region = "us-central1" - database_version = "POSTGRES_9_6" + name = "tf-lw-%d" + region = "us-central1" + database_version = "POSTGRES_9_6" - settings { - tier = "db-f1-micro" + settings { + tier = "db-f1-micro" - availability_type = "REGIONAL" + availability_type = "REGIONAL" - backup_configuration { - enabled = true - location = "us" - } - } + backup_configuration { + enabled = true + location = "us" + } + } } ` var testGoogleSqlDatabaseInstance_diskspecs = ` resource "google_sql_database_instance" "instance" { - name = "tf-lw-%d" - region = "us-central1" - - settings { - tier = "db-f1-micro" - disk_autoresize = true - disk_size = 15 - disk_type = "PD_HDD" - } + name = "tf-lw-%d" + region = "us-central1" + + settings { + tier = "db-f1-micro" + disk_autoresize = true + disk_size = 15 + disk_type = "PD_HDD" + } } ` var testGoogleSqlDatabaseInstance_maintenance = ` resource "google_sql_database_instance" "instance" { - name = "tf-lw-%d" - region = "us-central1" + name = "tf-lw-%d" + region = "us-central1" - settings { - tier = "db-f1-micro" + settings { + tier = "db-f1-micro" - maintenance_window { - day = 7 - hour = 3 - update_track = "canary" - } - } + maintenance_window { + day = 7 + hour = 3 + update_track = "canary" + } + } } ` var testGoogleSqlDatabaseInstance_authNets_step1 = ` resource "google_sql_database_instance" "instance" { - name = "tf-lw-%d" - region = "us-central" - settings { - tier = "D0" - crash_safe_replication = false - - ip_configuration { - ipv4_enabled = "true" - authorized_networks { - value = "108.12.12.12" - name = "misc" - expiration_time = "2050-11-15T16:19:00.094Z" - } - } - } + name = "tf-lw-%d" + region = "us-central" + settings { + tier = "D0" + crash_safe_replication = false + + ip_configuration { + ipv4_enabled = "true" + authorized_networks { + value = "108.12.12.12" + name = "misc" + expiration_time = "2050-11-15T16:19:00.094Z" + } + } + } } ` var testGoogleSqlDatabaseInstance_authNets_step2 = ` resource "google_sql_database_instance" "instance" { - name = "tf-lw-%d" - region = "us-central" - settings { - tier = "D0" - crash_safe_replication = false - - ip_configuration { - ipv4_enabled = "true" - } - } + name = "tf-lw-%d" + region = "us-central" + settings { + tier = "D0" + crash_safe_replication = false + + ip_configuration { + ipv4_enabled = "true" + } + } } ` var testGoogleSqlDatabaseInstance_multipleOperations = ` resource "google_sql_database_instance" "instance" { - name = "tf-test-%s" - region = "us-central" - settings { - tier = "D0" - crash_safe_replication = false - } + name = "tf-test-%s" + region = "us-central" + settings { + tier = "D0" + crash_safe_replication = false + } } resource "google_sql_database" "database" { - name = "tf-test-%s" - instance = google_sql_database_instance.instance.name + name = "tf-test-%s" + instance = "${google_sql_database_instance.instance.name}" } resource "google_sql_user" "user" { - name = "tf-test-%s" - instance = google_sql_database_instance.instance.name - host = "google.com" - password = "hunter2" + name = "tf-test-%s" + instance = "${google_sql_database_instance.instance.name}" + host = "google.com" + password = "hunter2" } ` var testGoogleSqlDatabaseInstance_basic_with_user_labels = ` resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central1" - settings { - tier = "db-f1-micro" - user_labels = { - track = "production" - location = "western-division" - } - } + name = "%s" + region = "us-central1" + settings { + tier = "db-f1-micro" + user_labels = { + track = "production" + location = "western-division" + } + } } ` var testGoogleSqlDatabaseInstance_basic_with_user_labels_update = ` resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central1" - settings { - tier = "db-f1-micro" - user_labels = { - track = "production" - } - } + name = "%s" + region = "us-central1" + settings { + tier = "db-f1-micro" + user_labels = { + track = "production" + } + } } ` diff --git a/google/resource_sql_database_test.go b/google/resource_sql_database_test.go index 9f21cbda03f..54ae79d727b 100644 --- a/google/resource_sql_database_test.go +++ b/google/resource_sql_database_test.go @@ -182,31 +182,31 @@ func testAccSqlDatabaseDestroy(s *terraform.State) error { var testGoogleSqlDatabase_basic = ` resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central" - settings { - tier = "D0" - } + name = "%s" + region = "us-central" + settings { + tier = "D0" + } } resource "google_sql_database" "database" { - name = "%s" - instance = google_sql_database_instance.instance.name + name = "%s" + instance = "${google_sql_database_instance.instance.name}" } ` var testGoogleSqlDatabase_latin1 = ` resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central" - settings { - tier = "D0" - } + name = "%s" + region = "us-central" + settings { + tier = "D0" + } } resource "google_sql_database" "database" { - name = "%s" - instance = google_sql_database_instance.instance.name - charset = "latin1" - collation = "latin1_swedish_ci" + name = "%s" + instance = "${google_sql_database_instance.instance.name}" + charset = "latin1" + collation = "latin1_swedish_ci" } ` diff --git a/google/resource_sql_user_test.go b/google/resource_sql_user_test.go index 5f837dd7793..8bdc74fb4da 100644 --- a/google/resource_sql_user_test.go +++ b/google/resource_sql_user_test.go @@ -132,46 +132,46 @@ func testAccSqlUserDestroy(s *terraform.State) error { func testGoogleSqlUser_mysql(instance, password string) string { return fmt.Sprintf(` -resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central" - settings { - tier = "D0" - } -} + resource "google_sql_database_instance" "instance" { + name = "%s" + region = "us-central" + settings { + tier = "D0" + } + } -resource "google_sql_user" "user1" { - name = "admin" - instance = google_sql_database_instance.instance.name - host = "google.com" - password = "%s" -} + resource "google_sql_user" "user1" { + name = "admin" + instance = "${google_sql_database_instance.instance.name}" + host = "google.com" + password = "%s" + } -resource "google_sql_user" "user2" { - name = "admin" - instance = google_sql_database_instance.instance.name - host = "gmail.com" - password = "hunter2" -} -`, instance, password) + resource "google_sql_user" "user2" { + name = "admin" + instance = "${google_sql_database_instance.instance.name}" + host = "gmail.com" + password = "hunter2" + } + `, instance, password) } func testGoogleSqlUser_postgres(instance, password string) string { return fmt.Sprintf(` -resource "google_sql_database_instance" "instance" { - name = "%s" - region = "us-central1" - database_version = "POSTGRES_9_6" - - settings { - tier = "db-f1-micro" - } -} + resource "google_sql_database_instance" "instance" { + name = "%s" + region = "us-central1" + database_version = "POSTGRES_9_6" -resource "google_sql_user" "user" { - name = "admin" - instance = google_sql_database_instance.instance.name - password = "%s" -} -`, instance, password) + settings { + tier = "db-f1-micro" + } + } + + resource "google_sql_user" "user" { + name = "admin" + instance = "${google_sql_database_instance.instance.name}" + password = "%s" + } + `, instance, password) } diff --git a/google/resource_storage_bucket_acl_test.go b/google/resource_storage_bucket_acl_test.go index 3c268b2506c..6d3cfb04af4 100644 --- a/google/resource_storage_bucket_acl_test.go +++ b/google/resource_storage_bucket_acl_test.go @@ -208,12 +208,12 @@ func testAccStorageBucketAclDestroy(s *terraform.State) error { func testGoogleStorageBucketsAclBasic1(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_acl" "acl" { - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s", "%s", "%s", "%s"] + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s", "%s", "%s", "%s"] } `, bucketName, roleEntityOwners, roleEntityEditors, roleEntityViewers, roleEntityBasic1, roleEntityBasic2) } @@ -221,12 +221,12 @@ resource "google_storage_bucket_acl" "acl" { func testGoogleStorageBucketsAclBasic2(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_acl" "acl" { - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s", "%s", "%s", "%s"] + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s", "%s", "%s", "%s"] } `, bucketName, roleEntityOwners, roleEntityEditors, roleEntityViewers, roleEntityBasic2, roleEntityBasic3_owner) } @@ -234,12 +234,12 @@ resource "google_storage_bucket_acl" "acl" { func testGoogleStorageBucketsAclBasicDelete(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_acl" "acl" { - bucket = google_storage_bucket.bucket.name - role_entity = [] + bucket = "${google_storage_bucket.bucket.name}" + role_entity = [] } `, bucketName) } @@ -247,12 +247,12 @@ resource "google_storage_bucket_acl" "acl" { func testGoogleStorageBucketsAclBasic3(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_acl" "acl" { - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s", "%s", "%s", "%s"] + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s", "%s", "%s", "%s"] } `, bucketName, roleEntityOwners, roleEntityEditors, roleEntityViewers, roleEntityBasic2, roleEntityBasic3_reader) } @@ -264,7 +264,7 @@ resource "google_storage_bucket" "bucket" { } resource "google_storage_bucket_acl" "acl" { - bucket = google_storage_bucket.bucket.name + bucket = "${google_storage_bucket.bucket.name}" role_entity = ["%s", "%s", "%s", "%s", "%s"] } `, bucketName, roleEntityBasic1, roleEntityViewers, roleEntityOwners, roleEntityBasic2, roleEntityEditors) @@ -273,13 +273,13 @@ resource "google_storage_bucket_acl" "acl" { func testGoogleStorageBucketsAclPredefined(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_acl" "acl" { - bucket = google_storage_bucket.bucket.name - predefined_acl = "projectPrivate" - default_acl = "projectPrivate" + bucket = "${google_storage_bucket.bucket.name}" + predefined_acl = "projectPrivate" + default_acl = "projectPrivate" } `, bucketName) } diff --git a/google/resource_storage_bucket_iam_test.go b/google/resource_storage_bucket_iam_test.go index 2148003a137..1888be7b872 100644 --- a/google/resource_storage_bucket_iam_test.go +++ b/google/resource_storage_bucket_iam_test.go @@ -138,95 +138,101 @@ func testAccCheckGoogleStorageBucketIam(bucket, role string, members []string) r func testAccStorageBucketIamPolicy_update(bucket, account, serviceAcct string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_service_account" "test-account-1" { - account_id = "%s-1" - display_name = "Storage Bucket Iam Testing Account" + account_id = "%s-1" + display_name = "Storage Bucket Iam Testing Account" } resource "google_service_account" "test-account-2" { - account_id = "%s-2" - display_name = "Storage Bucket Iam Testing Account" + account_id = "%s-2" + display_name = "Storage Bucket Iam Testing Account" } + data "google_iam_policy" "foo-policy" { - binding { - role = "roles/storage.objectViewer" - - members = [ - "serviceAccount:${google_service_account.test-account-1.email}", - "serviceAccount:${google_service_account.test-account-2.email}", - ] - } - - binding { - role = "roles/storage.admin" - members = [ - "serviceAccount:%s", - ] - } + binding { + role = "roles/storage.objectViewer" + + members = [ + "serviceAccount:${google_service_account.test-account-1.email}", + "serviceAccount:${google_service_account.test-account-2.email}", + ] + } + + binding { + role = "roles/storage.admin" + members = [ + "serviceAccount:%s", + ] + } } resource "google_storage_bucket_iam_policy" "bucket-binding" { - bucket = google_storage_bucket.bucket.name - policy_data = data.google_iam_policy.foo-policy.policy_data + bucket = "${google_storage_bucket.bucket.name}" + policy_data = "${data.google_iam_policy.foo-policy.policy_data}" } + `, bucket, account, account, serviceAcct) } func testAccStorageBucketIamPolicy_basic(bucket, account, serviceAcct string) string { return fmt.Sprintf(` + resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_service_account" "test-account-1" { - account_id = "%s-1" - display_name = "Storage Bucket Iam Testing Account" + account_id = "%s-1" + display_name = "Storage Bucket Iam Testing Account" } + data "google_iam_policy" "foo-policy" { - binding { - role = "roles/storage.objectViewer" - members = [ - "serviceAccount:${google_service_account.test-account-1.email}", - ] - } - - binding { - role = "roles/storage.admin" - members = [ - "serviceAccount:%s", - ] - } + binding { + role = "roles/storage.objectViewer" + members = [ + "serviceAccount:${google_service_account.test-account-1.email}", + ] + } + + binding { + role = "roles/storage.admin" + members = [ + "serviceAccount:%s", + ] + } } resource "google_storage_bucket_iam_policy" "bucket-binding" { - bucket = google_storage_bucket.bucket.name - policy_data = data.google_iam_policy.foo-policy.policy_data + bucket = "${google_storage_bucket.bucket.name}" + policy_data = "${data.google_iam_policy.foo-policy.policy_data}" } + + `, bucket, account, serviceAcct) } func testAccStorageBucketIamBinding_basic(bucket, account, role string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_service_account" "test-account-1" { - account_id = "%s-1" - display_name = "Storage Bucket Iam Testing Account" + account_id = "%s-1" + display_name = "Storage Bucket Iam Testing Account" } resource "google_storage_bucket_iam_binding" "foo" { - bucket = google_storage_bucket.bucket.name - role = "%s" - members = [ - "serviceAccount:${google_service_account.test-account-1.email}", - ] + bucket = "${google_storage_bucket.bucket.name}" + role = "%s" + members = [ + "serviceAccount:${google_service_account.test-account-1.email}", + ] } `, bucket, account, role) } @@ -234,26 +240,26 @@ resource "google_storage_bucket_iam_binding" "foo" { func testAccStorageBucketIamBinding_update(bucket, account, role string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_service_account" "test-account-1" { - account_id = "%s-1" - display_name = "Storage Bucket Iam Testing Account" + account_id = "%s-1" + display_name = "Storage Bucket Iam Testing Account" } resource "google_service_account" "test-account-2" { - account_id = "%s-2" - display_name = "Storage Bucket Iam Testing Account" + account_id = "%s-2" + display_name = "Storage Bucket Iam Testing Account" } resource "google_storage_bucket_iam_binding" "foo" { - bucket = google_storage_bucket.bucket.name - role = "%s" - members = [ - "serviceAccount:${google_service_account.test-account-1.email}", - "serviceAccount:${google_service_account.test-account-2.email}", - ] + bucket = "${google_storage_bucket.bucket.name}" + role = "%s" + members = [ + "serviceAccount:${google_service_account.test-account-1.email}", + "serviceAccount:${google_service_account.test-account-2.email}", + ] } `, bucket, account, account, role) } @@ -261,18 +267,18 @@ resource "google_storage_bucket_iam_binding" "foo" { func testAccStorageBucketIamMember_basic(bucket, account, role string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_service_account" "test-account-1" { - account_id = "%s-1" - display_name = "Storage Bucket Iam Testing Account" + account_id = "%s-1" + display_name = "Storage Bucket Iam Testing Account" } resource "google_storage_bucket_iam_member" "foo" { - bucket = google_storage_bucket.bucket.name - role = "%s" - member = "serviceAccount:${google_service_account.test-account-1.email}" + bucket = "${google_storage_bucket.bucket.name}" + role = "%s" + member = "serviceAccount:${google_service_account.test-account-1.email}" } `, bucket, account, role) } diff --git a/google/resource_storage_bucket_object_test.go b/google/resource_storage_bucket_object_test.go index 714002f3c2b..ce93132fcea 100644 --- a/google/resource_storage_bucket_object_test.go +++ b/google/resource_storage_bucket_object_test.go @@ -302,13 +302,13 @@ func testAccStorageObjectDestroy(s *terraform.State) error { func testGoogleStorageBucketsObjectContent(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - content = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + content = "%s" } `, bucketName, objectName, content) } @@ -316,13 +316,13 @@ resource "google_storage_bucket_object" "object" { func testGoogleStorageBucketsObjectDynamicContent(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - content = google_storage_bucket.bucket.project + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + content = "${google_storage_bucket.bucket.project}" } `, bucketName, objectName) } @@ -330,13 +330,13 @@ resource "google_storage_bucket_object" "object" { func testGoogleStorageBucketsObjectBasic(bucketName, sourceFilename string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } `, bucketName, objectName, sourceFilename) } @@ -345,17 +345,17 @@ func testGoogleStorageBucketsObject_optionalContentFields( bucketName, disposition, encoding, language, content_type string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - content = "%s" - content_disposition = "%s" - content_encoding = "%s" - content_language = "%s" - content_type = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + content = "%s" + content_disposition = "%s" + content_encoding = "%s" + content_language = "%s" + content_type = "%s" } `, bucketName, objectName, content, disposition, encoding, language, content_type) } @@ -363,14 +363,14 @@ resource "google_storage_bucket_object" "object" { func testGoogleStorageBucketsObject_cacheControl(bucketName, sourceFilename, cacheControl string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" - cache_control = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" + cache_control = "%s" } `, bucketName, objectName, sourceFilename, cacheControl) } @@ -378,14 +378,14 @@ resource "google_storage_bucket_object" "object" { func testGoogleStorageBucketsObject_storageClass(bucketName string, storageClass string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - content = "%s" - storage_class = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + content = "%s" + storage_class = "%s" } `, bucketName, objectName, content, storageClass) } diff --git a/google/resource_storage_bucket_test.go b/google/resource_storage_bucket_test.go index e6d8eb1e11d..56663df3776 100644 --- a/google/resource_storage_bucket_test.go +++ b/google/resource_storage_bucket_test.go @@ -1057,7 +1057,7 @@ func testAccStorageBucketDestroy(s *terraform.State) error { func testAccStorageBucket_basic(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } `, bucketName) } @@ -1065,8 +1065,8 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_requesterPays(bucketName string, pays bool) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - requester_pays = %t + name = "%s" + requester_pays = %t } `, bucketName, pays) } @@ -1074,8 +1074,8 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_lowercaseLocation(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - location = "eu" + name = "%s" + location = "eu" } `, bucketName) } @@ -1083,9 +1083,9 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_customAttributes(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - location = "EU" - force_destroy = "true" + name = "%s" + location = "EU" + force_destroy = "true" } `, bucketName) } @@ -1093,17 +1093,17 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_customAttributes_withLifecycle1(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - location = "EU" - force_destroy = "true" - lifecycle_rule { - action { - type = "Delete" - } - condition { - age = 10 - } - } + name = "%s" + location = "EU" + force_destroy = "true" + lifecycle_rule { + action { + type = "Delete" + } + condition { + age = 10 + } + } } `, bucketName) } @@ -1111,27 +1111,27 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_customAttributes_withLifecycle2(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - location = "EU" - force_destroy = "true" - lifecycle_rule { - action { - type = "SetStorageClass" - storage_class = "NEARLINE" - } - condition { - age = 2 - } - } - lifecycle_rule { - action { - type = "Delete" - } - condition { - age = 10 - num_newer_versions = 2 - } - } + name = "%s" + location = "EU" + force_destroy = "true" + lifecycle_rule { + action { + type = "SetStorageClass" + storage_class = "NEARLINE" + } + condition { + age = 2 + } + } + lifecycle_rule { + action { + type = "Delete" + } + condition { + age = 10 + num_newer_versions = 2 + } + } } `, bucketName) } @@ -1144,8 +1144,8 @@ func testAccStorageBucket_storageClass(bucketName, storageClass, location string } return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - storage_class = "%s"%s + name = "%s" + storage_class = "%s"%s } `, bucketName, storageClass, locationBlock) } @@ -1153,20 +1153,20 @@ resource "google_storage_bucket" "bucket" { func testGoogleStorageBucketsCors(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - cors { - origin = ["abc", "def"] - method = ["a1a"] - response_header = ["123", "456", "789"] - max_age_seconds = 10 - } + name = "%s" + cors { + origin = ["abc", "def"] + method = ["a1a"] + response_header = ["123", "456", "789"] + max_age_seconds = 10 + } - cors { - origin = ["ghi", "jkl"] - method = ["z9z"] - response_header = ["000"] - max_age_seconds = 5 - } + cors { + origin = ["ghi", "jkl"] + method = ["z9z"] + response_header = ["000"] + max_age_seconds = 5 + } } `, bucketName) } @@ -1174,11 +1174,11 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_forceDestroyWithVersioning(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - force_destroy = "true" - versioning { - enabled = "true" - } + name = "%s" + force_destroy = "true" + versioning { + enabled = "true" + } } `, bucketName) } @@ -1186,10 +1186,10 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_versioning(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - versioning { - enabled = "true" - } + name = "%s" + versioning { + enabled = "true" + } } `, bucketName) } @@ -1197,10 +1197,10 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_logging(bucketName string, logBucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - logging { - log_bucket = "%s" - } + name = "%s" + logging { + log_bucket = "%s" + } } `, bucketName, logBucketName) } @@ -1208,11 +1208,11 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_loggingWithPrefix(bucketName string, logBucketName string, prefix string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - logging { - log_bucket = "%s" - log_object_prefix = "%s" - } + name = "%s" + logging { + log_bucket = "%s" + log_object_prefix = "%s" + } } `, bucketName, logBucketName, prefix) } @@ -1220,43 +1220,43 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_lifecycleRulesMultiple(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - lifecycle_rule { - action { - type = "SetStorageClass" - storage_class = "NEARLINE" - } - condition { - matches_storage_class = ["COLDLINE"] - age = 2 - } - } - lifecycle_rule { - action { - type = "Delete" - } - condition { - age = 10 - } - } - lifecycle_rule { - action { - type = "SetStorageClass" - storage_class = "NEARLINE" - } - condition { - created_before = "2019-01-01" - } - } - lifecycle_rule { - action { - type = "SetStorageClass" - storage_class = "NEARLINE" - } - condition { - num_newer_versions = 10 - } - } + name = "%s" + lifecycle_rule { + action { + type = "SetStorageClass" + storage_class = "NEARLINE" + } + condition { + matches_storage_class = ["COLDLINE"] + age = 2 + } + } + lifecycle_rule { + action { + type = "Delete" + } + condition { + age = 10 + } + } + lifecycle_rule { + action { + type = "SetStorageClass" + storage_class = "NEARLINE" + } + condition { + created_before = "2019-01-01" + } + } + lifecycle_rule { + action { + type = "SetStorageClass" + storage_class = "NEARLINE" + } + condition { + num_newer_versions = 10 + } + } } `, bucketName) } @@ -1264,7 +1264,7 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_lifecycleRule_emptyArchived(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" lifecycle_rule { action { type = "Delete" @@ -1281,14 +1281,14 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_lifecycleRule_withStateArchived(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" lifecycle_rule { action { type = "Delete" } condition { - age = 10 + age = 10 with_state = "ARCHIVED" } } @@ -1299,14 +1299,14 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_lifecycleRule_withStateLive(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" lifecycle_rule { action { type = "Delete" } condition { - age = 10 + age = 10 with_state = "LIVE" } } @@ -1317,14 +1317,14 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_lifecycleRule_withStateAny(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" lifecycle_rule { action { type = "Delete" } condition { - age = 10 + age = 10 with_state = "ANY" } } @@ -1335,10 +1335,10 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_labels(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - labels = { - my-label = "my-label-value" - } + name = "%s" + labels = { + my-label = "my-label-value" + } } `, bucketName) } @@ -1346,8 +1346,8 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_bucketPolicyOnly(bucketName string, enabled bool) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - bucket_policy_only = %t + name = "%s" + bucket_policy_only = %t } `, bucketName, enabled) } @@ -1355,46 +1355,46 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_encryption(context map[string]interface{}) string { return Nprintf(` resource "google_project" "acceptance" { - name = "terraform-%{random_suffix}" - project_id = "terraform-%{random_suffix}" - org_id = "%{organization}" - billing_account = "%{billing_account}" + name = "terraform-%{random_suffix}" + project_id = "terraform-%{random_suffix}" + org_id = "%{organization}" + billing_account = "%{billing_account}" } resource "google_project_service" "acceptance" { - project = google_project.acceptance.project_id - service = "cloudkms.googleapis.com" + project = "${google_project.acceptance.project_id}" + service = "cloudkms.googleapis.com" } resource "google_kms_key_ring" "key_ring" { - name = "tf-test-%{random_suffix}" - project = google_project_service.acceptance.project - location = "us" + name = "tf-test-%{random_suffix}" + project = "${google_project_service.acceptance.project}" + location = "us" } resource "google_kms_crypto_key" "crypto_key" { - name = "tf-test-%{random_suffix}" - key_ring = google_kms_key_ring.key_ring.id - rotation_period = "1000000s" + name = "tf-test-%{random_suffix}" + key_ring = "${google_kms_key_ring.key_ring.id}" + rotation_period = "1000000s" } resource "google_storage_bucket" "bucket" { - name = "tf-test-crypto-bucket-%{random_int}" - encryption { - default_kms_key_name = google_kms_crypto_key.crypto_key.self_link - } + name = "tf-test-crypto-bucket-%{random_int}" + encryption { + default_kms_key_name = "${google_kms_crypto_key.crypto_key.self_link}" + } } -`, context) + `, context) } func testAccStorageBucket_updateLabels(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" - labels = { - my-label = "my-updated-label-value" - a-new-label = "a-new-label-value" - } + name = "%s" + labels = { + my-label = "my-updated-label-value" + a-new-label = "a-new-label-value" + } } `, bucketName) } @@ -1402,26 +1402,26 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_website(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "website" { - name = "%s.gcp.tfacc.hashicorptest.com" - location = "US" - storage_class = "MULTI_REGIONAL" + name = "%s.gcp.tfacc.hashicorptest.com" + location = "US" + storage_class = "MULTI_REGIONAL" - website { - main_page_suffix = "index.html" - not_found_page = "404.html" + website { + main_page_suffix = "index.html" + not_found_page = "404.html" + } } -} `, bucketName) } func testAccStorageBucket_retentionPolicy(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" - retention_policy { - retention_period = 10 - } + retention_policy { + retention_period = 10 + } } `, bucketName) } @@ -1429,12 +1429,12 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_lockedRetentionPolicy(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" - retention_policy { - is_locked = true - retention_period = 10 - } + retention_policy { + is_locked = true + retention_period = 10 + } } `, bucketName) } @@ -1442,26 +1442,25 @@ resource "google_storage_bucket" "bucket" { func testAccStorageBucket_websiteNoAttributes(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "website" { - name = "%s.gcp.tfacc.hashicorptest.com" - location = "US" - storage_class = "MULTI_REGIONAL" + name = "%s.gcp.tfacc.hashicorptest.com" + location = "US" + storage_class = "MULTI_REGIONAL" - website { + website {} } -} `, bucketName) } func testAccStorageBucket_websiteOneAttribute(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "website" { - name = "%s.gcp.tfacc.hashicorptest.com" - location = "US" - storage_class = "MULTI_REGIONAL" + name = "%s.gcp.tfacc.hashicorptest.com" + location = "US" + storage_class = "MULTI_REGIONAL" - website { - main_page_suffix = "index.html" + website { + main_page_suffix = "index.html" + } } -} `, bucketName) } diff --git a/google/resource_storage_default_object_access_control_test.go b/google/resource_storage_default_object_access_control_test.go index 71426b69cfd..2d4f871f1ab 100644 --- a/google/resource_storage_default_object_access_control_test.go +++ b/google/resource_storage_default_object_access_control_test.go @@ -44,13 +44,13 @@ func TestAccStorageDefaultObjectAccessControl_update(t *testing.T) { func testGoogleStorageDefaultObjectAccessControlBasic(bucketName, role, entity string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_default_object_access_control" "default" { - bucket = google_storage_bucket.bucket.name - role = "%s" - entity = "%s" + bucket = "${google_storage_bucket.bucket.name}" + role = "%s" + entity = "%s" } `, bucketName, role, entity) } diff --git a/google/resource_storage_default_object_acl_test.go b/google/resource_storage_default_object_acl_test.go index ac05160f1bf..a100b0556c2 100644 --- a/google/resource_storage_default_object_acl_test.go +++ b/google/resource_storage_default_object_acl_test.go @@ -196,12 +196,12 @@ func testAccCheckGoogleStorageDefaultObjectAclDelete(bucket, roleEntityS string) func testGoogleStorageDefaultObjectsAclBasic(bucketName, roleEntity1, roleEntity2 string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_default_object_acl" "acl" { - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s"] + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s"] } `, bucketName, roleEntity1, roleEntity2) } @@ -209,12 +209,12 @@ resource "google_storage_default_object_acl" "acl" { func testGoogleStorageDefaultObjectsAclBasicDelete(bucketName, roleEntity string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_default_object_acl" "acl" { - bucket = google_storage_bucket.bucket.name - role_entity = ["%s"] + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s"] } `, bucketName, roleEntity) } @@ -222,12 +222,12 @@ resource "google_storage_default_object_acl" "acl" { func testGoogleStorageDefaultObjectsAclNoRoleEntity(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_default_object_acl" "acl" { - bucket = google_storage_bucket.bucket.name - role_entity = [] + bucket = "${google_storage_bucket.bucket.name}" + role_entity = [] } `, bucketName) } @@ -239,7 +239,7 @@ resource "google_storage_bucket" "bucket" { } resource "google_storage_default_object_acl" "acl" { - bucket = google_storage_bucket.bucket.name + bucket = "${google_storage_bucket.bucket.name}" role_entity = ["%s", "%s", "%s", "%s", "%s"] } `, bucketName, roleEntityBasic1, roleEntityViewers, roleEntityOwners, roleEntityBasic2, roleEntityEditors) diff --git a/google/resource_storage_notification_test.go b/google/resource_storage_notification_test.go index 0abb075ba69..4266d3847df 100644 --- a/google/resource_storage_notification_test.go +++ b/google/resource_storage_notification_test.go @@ -178,75 +178,75 @@ func testAccCheckStorageNotificationCheckAttributes(notification *storage.Notifi func testGoogleStorageNotificationBasic(bucketName, topicName, topic string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } - + resource "google_pubsub_topic" "topic" { - name = "%s" + name = "%s" } // We have to provide GCS default storage account with the permission // to publish to a Cloud Pub/Sub topic from this project // Otherwise notification configuration won't work -data "google_storage_project_service_account" "gcs_account" { -} +data "google_storage_project_service_account" "gcs_account" {} resource "google_pubsub_topic_iam_binding" "binding" { - topic = google_pubsub_topic.topic.name - role = "roles/pubsub.publisher" - - members = ["serviceAccount:${data.google_storage_project_service_account.gcs_account.email_address}"] + topic = "${google_pubsub_topic.topic.name}" + role = "roles/pubsub.publisher" + + members = ["serviceAccount:${data.google_storage_project_service_account.gcs_account.email_address}"] } resource "google_storage_notification" "notification" { - bucket = google_storage_bucket.bucket.name - payload_format = "JSON_API_V1" - topic = google_pubsub_topic.topic.id - depends_on = [google_pubsub_topic_iam_binding.binding] + bucket = "${google_storage_bucket.bucket.name}" + payload_format = "JSON_API_V1" + topic = "${google_pubsub_topic.topic.id}" + depends_on = ["google_pubsub_topic_iam_binding.binding"] } resource "google_storage_notification" "notification_with_prefix" { - bucket = google_storage_bucket.bucket.name - payload_format = "JSON_API_V1" - topic = google_pubsub_topic.topic.id - object_name_prefix = "foobar" - depends_on = [google_pubsub_topic_iam_binding.binding] + bucket = "${google_storage_bucket.bucket.name}" + payload_format = "JSON_API_V1" + topic = "${google_pubsub_topic.topic.id}" + object_name_prefix = "foobar" + depends_on = ["google_pubsub_topic_iam_binding.binding"] } + `, bucketName, topicName) } func testGoogleStorageNotificationOptionalEventsAttributes(bucketName, topicName, topic, eventType1, eventType2 string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } - + resource "google_pubsub_topic" "topic" { - name = "%s" + name = "%s" } // We have to provide GCS default storage account with the permission // to publish to a Cloud Pub/Sub topic from this project // Otherwise notification configuration won't work -data "google_storage_project_service_account" "gcs_account" { -} +data "google_storage_project_service_account" "gcs_account" {} resource "google_pubsub_topic_iam_binding" "binding" { - topic = google_pubsub_topic.topic.name - role = "roles/pubsub.publisher" - - members = ["serviceAccount:${data.google_storage_project_service_account.gcs_account.email_address}"] + topic = "${google_pubsub_topic.topic.name}" + role = "roles/pubsub.publisher" + + members = ["serviceAccount:${data.google_storage_project_service_account.gcs_account.email_address}"] } resource "google_storage_notification" "notification" { - bucket = google_storage_bucket.bucket.name - payload_format = "JSON_API_V1" - topic = google_pubsub_topic.topic.id - event_types = ["%s", "%s"] - custom_attributes = { - new-attribute = "new-attribute-value" - } - depends_on = [google_pubsub_topic_iam_binding.binding] + bucket = "${google_storage_bucket.bucket.name}" + payload_format = "JSON_API_V1" + topic = "${google_pubsub_topic.topic.id}" + event_types = ["%s","%s"] + custom_attributes = { + new-attribute = "new-attribute-value" + } + depends_on = ["google_pubsub_topic_iam_binding.binding"] } + `, bucketName, topicName, eventType1, eventType2) } diff --git a/google/resource_storage_object_access_control_test.go b/google/resource_storage_object_access_control_test.go index 017d42a67b8..23b45669c34 100644 --- a/google/resource_storage_object_access_control_test.go +++ b/google/resource_storage_object_access_control_test.go @@ -50,20 +50,20 @@ func TestAccStorageObjectAccessControl_update(t *testing.T) { func testGoogleStorageObjectAccessControlBasic(bucketName, objectName, role, entity string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } resource "google_storage_object_access_control" "default" { - object = google_storage_bucket_object.object.name - bucket = google_storage_bucket.bucket.name - role = "%s" - entity = "%s" + object = "${google_storage_bucket_object.object.name}" + bucket = "${google_storage_bucket.bucket.name}" + role = "%s" + entity = "%s" } `, bucketName, objectName, tfObjectAcl.Name(), role, entity) } diff --git a/google/resource_storage_object_acl_test.go b/google/resource_storage_object_acl_test.go index 968d1ff5bfc..ec19b2d99d7 100644 --- a/google/resource_storage_object_acl_test.go +++ b/google/resource_storage_object_acl_test.go @@ -341,19 +341,19 @@ func testAccStorageObjectAclDestroy(s *terraform.State) error { func testGoogleStorageObjectsAclBasicDelete(bucketName string, objectName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } resource "google_storage_object_acl" "acl" { - object = google_storage_bucket_object.object.name - bucket = google_storage_bucket.bucket.name - role_entity = [] + object = "${google_storage_bucket_object.object.name}" + bucket = "${google_storage_bucket.bucket.name}" + role_entity = [] } `, bucketName, objectName, tfObjectAcl.Name()) } @@ -361,19 +361,19 @@ resource "google_storage_object_acl" "acl" { func testGoogleStorageObjectsAclBasic1(bucketName string, objectName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } resource "google_storage_object_acl" "acl" { - object = google_storage_bucket_object.object.name - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s"] + object = "${google_storage_bucket_object.object.name}" + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s"] } `, bucketName, objectName, tfObjectAcl.Name(), roleEntityBasic1, roleEntityBasic2) @@ -382,19 +382,19 @@ resource "google_storage_object_acl" "acl" { func testGoogleStorageObjectsAclBasic2(bucketName string, objectName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } resource "google_storage_object_acl" "acl" { - object = google_storage_bucket_object.object.name - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s"] + object = "${google_storage_bucket_object.object.name}" + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s"] } `, bucketName, objectName, tfObjectAcl.Name(), roleEntityBasic2, roleEntityBasic3_owner) @@ -403,19 +403,19 @@ resource "google_storage_object_acl" "acl" { func testGoogleStorageObjectsAclBasic3(bucketName string, objectName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } resource "google_storage_object_acl" "acl" { - object = google_storage_bucket_object.object.name - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s"] + object = "${google_storage_bucket_object.object.name}" + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s"] } `, bucketName, objectName, tfObjectAcl.Name(), roleEntityBasic2, roleEntityBasic3_reader) @@ -424,19 +424,19 @@ resource "google_storage_object_acl" "acl" { func testGoogleStorageObjectsAclPredefined(bucketName string, objectName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } resource "google_storage_object_acl" "acl" { - object = google_storage_bucket_object.object.name - bucket = google_storage_bucket.bucket.name - predefined_acl = "projectPrivate" + object = "${google_storage_bucket_object.object.name}" + bucket = "${google_storage_bucket.bucket.name}" + predefined_acl = "projectPrivate" } `, bucketName, objectName, tfObjectAcl.Name()) } @@ -444,19 +444,19 @@ resource "google_storage_object_acl" "acl" { func testGoogleStorageObjectAclUnordered(bucketName, objectName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { - name = "%s" + name = "%s" } resource "google_storage_bucket_object" "object" { - name = "%s" - bucket = google_storage_bucket.bucket.name - source = "%s" + name = "%s" + bucket = "${google_storage_bucket.bucket.name}" + source = "%s" } resource "google_storage_object_acl" "acl" { - object = google_storage_bucket_object.object.name - bucket = google_storage_bucket.bucket.name - role_entity = ["%s", "%s", "%s", "%s", "%s"] + object = "${google_storage_bucket_object.object.name}" + bucket = "${google_storage_bucket.bucket.name}" + role_entity = ["%s", "%s", "%s", "%s", "%s"] } `, bucketName, objectName, tfObjectAcl.Name(), roleEntityBasic1, roleEntityViewers, roleEntityOwners, roleEntityBasic2, roleEntityEditors) } diff --git a/google/resource_storage_transfer_job_test.go b/google/resource_storage_transfer_job_test.go index e057a489860..36586686da6 100644 --- a/google/resource_storage_transfer_job_test.go +++ b/google/resource_storage_transfer_job_test.go @@ -118,7 +118,7 @@ func testAccStorageTransferJobDestroy(s *terraform.State) error { func testAccStorageTransferJob_basic(project string, dataSourceBucketName string, dataSinkBucketName string, transferJobDescription string) string { return fmt.Sprintf(` data "google_storage_transfer_project_service_account" "default" { - project = "%s" + project = "%s" } resource "google_storage_bucket" "data_source" { @@ -128,9 +128,9 @@ resource "google_storage_bucket" "data_source" { } resource "google_storage_bucket_iam_member" "data_source" { - bucket = google_storage_bucket.data_source.name - role = "roles/storage.admin" - member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" + bucket = "${google_storage_bucket.data_source.name}" + role = "roles/storage.admin" + member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" } resource "google_storage_bucket" "data_sink" { @@ -140,47 +140,47 @@ resource "google_storage_bucket" "data_sink" { } resource "google_storage_bucket_iam_member" "data_sink" { - bucket = google_storage_bucket.data_sink.name - role = "roles/storage.admin" - member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" + bucket = "${google_storage_bucket.data_sink.name}" + role = "roles/storage.admin" + member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" } resource "google_storage_transfer_job" "transfer_job" { - description = "%s" - project = "%s" - - transfer_spec { - gcs_data_source { - bucket_name = google_storage_bucket.data_source.name - } - gcs_data_sink { - bucket_name = google_storage_bucket.data_sink.name - } - } - - schedule { - schedule_start_date { - year = 2018 - month = 10 - day = 1 - } - schedule_end_date { - year = 2019 - month = 10 - day = 1 - } - start_time_of_day { - hours = 0 - minutes = 30 - seconds = 0 - nanos = 0 - } - } - - depends_on = [ - google_storage_bucket_iam_member.data_source, - google_storage_bucket_iam_member.data_sink, - ] + description = "%s" + project = "%s" + + transfer_spec { + gcs_data_source { + bucket_name = "${google_storage_bucket.data_source.name}" + } + gcs_data_sink { + bucket_name = "${google_storage_bucket.data_sink.name}" + } + } + + schedule { + schedule_start_date { + year = 2018 + month = 10 + day = 1 + } + schedule_end_date { + year = 2019 + month = 10 + day = 1 + } + start_time_of_day { + hours = 0 + minutes = 30 + seconds = 0 + nanos = 0 + } + } + + depends_on = [ + "google_storage_bucket_iam_member.data_source", + "google_storage_bucket_iam_member.data_sink", + ] } `, project, dataSourceBucketName, project, dataSinkBucketName, project, transferJobDescription, project) } @@ -188,7 +188,7 @@ resource "google_storage_transfer_job" "transfer_job" { func testAccStorageTransferJob_omitScheduleEndDate(project string, dataSourceBucketName string, dataSinkBucketName string, transferJobDescription string) string { return fmt.Sprintf(` data "google_storage_transfer_project_service_account" "default" { - project = "%s" + project = "%s" } resource "google_storage_bucket" "data_source" { @@ -198,9 +198,9 @@ resource "google_storage_bucket" "data_source" { } resource "google_storage_bucket_iam_member" "data_source" { - bucket = google_storage_bucket.data_source.name - role = "roles/storage.admin" - member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" + bucket = "${google_storage_bucket.data_source.name}" + role = "roles/storage.admin" + member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" } resource "google_storage_bucket" "data_sink" { @@ -210,42 +210,42 @@ resource "google_storage_bucket" "data_sink" { } resource "google_storage_bucket_iam_member" "data_sink" { - bucket = google_storage_bucket.data_sink.name - role = "roles/storage.admin" - member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" + bucket = "${google_storage_bucket.data_sink.name}" + role = "roles/storage.admin" + member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" } resource "google_storage_transfer_job" "transfer_job" { - description = "%s" - project = "%s" - - transfer_spec { - gcs_data_source { - bucket_name = google_storage_bucket.data_source.name - } - gcs_data_sink { - bucket_name = google_storage_bucket.data_sink.name - } - } - - schedule { - schedule_start_date { - year = 2018 - month = 10 - day = 1 - } - start_time_of_day { - hours = 0 - minutes = 30 - seconds = 0 - nanos = 0 - } - } - - depends_on = [ - google_storage_bucket_iam_member.data_source, - google_storage_bucket_iam_member.data_sink, - ] + description = "%s" + project = "%s" + + transfer_spec { + gcs_data_source { + bucket_name = "${google_storage_bucket.data_source.name}" + } + gcs_data_sink { + bucket_name = "${google_storage_bucket.data_sink.name}" + } + } + + schedule { + schedule_start_date { + year = 2018 + month = 10 + day = 1 + } + start_time_of_day { + hours = 0 + minutes = 30 + seconds = 0 + nanos = 0 + } + } + + depends_on = [ + "google_storage_bucket_iam_member.data_source", + "google_storage_bucket_iam_member.data_sink", + ] } `, project, dataSourceBucketName, project, dataSinkBucketName, project, transferJobDescription, project) } diff --git a/google/resource_tpu_node_test.go b/google/resource_tpu_node_test.go index 5c13da1e5ed..9fcaf4a92dc 100644 --- a/google/resource_tpu_node_test.go +++ b/google/resource_tpu_node_test.go @@ -45,15 +45,14 @@ func TestAccTPUNode_tpuNodeBUpdateTensorFlowVersion(t *testing.T) { // autogenerated examples. func testAccTpuNode_tpuNodeTensorFlow(nodeId string, versionIdx int) string { return fmt.Sprintf(` -data "google_tpu_tensorflow_versions" "available" { -} +data "google_tpu_tensorflow_versions" "available" { } resource "google_tpu_node" "tpu" { - name = "%s" - zone = "us-central1-b" + name = "%s" + zone = "us-central1-b" accelerator_type = "v3-8" - tensorflow_version = data.google_tpu_tensorflow_versions.available.versions[%d] + tensorflow_version = "${data.google_tpu_tensorflow_versions.available.versions[%d]}" cidr_block = "10.1.0.0/29" } `, nodeId, versionIdx) diff --git a/google/resource_usage_export_bucket_test.go b/google/resource_usage_export_bucket_test.go index 9de321e791b..3971643296e 100644 --- a/google/resource_usage_export_bucket_test.go +++ b/google/resource_usage_export_bucket_test.go @@ -34,26 +34,26 @@ func TestAccComputeResourceUsageExportBucket(t *testing.T) { func testAccResourceUsageExportBucket(baseProject, org, billingId string) string { return fmt.Sprintf(` resource "google_project" "base" { - project_id = "%s" - name = "Export Bucket Base" - org_id = "%s" - billing_account = "%s" + project_id = "%s" + name = "Export Bucket Base" + org_id = "%s" + billing_account = "%s" } resource "google_project_service" "service" { - project = google_project.base.project_id - service = "compute.googleapis.com" + project = "${google_project.base.project_id}" + service = "compute.googleapis.com" } resource "google_storage_bucket" "bucket" { - name = "b-${google_project.base.project_id}" - project = google_project_service.service.project + name = "b-${google_project.base.project_id}" + project = "${google_project_service.service.project}" } resource "google_project_usage_export_bucket" "ueb" { - project = google_project.base.project_id - bucket_name = google_storage_bucket.bucket.name - prefix = "foobar" + project = "${google_project.base.project_id}" + bucket_name = "${google_storage_bucket.bucket.name}" + prefix = "foobar" } `, baseProject, org, billingId) }