Skip to content

Commit

Permalink
deprecate 0.11 syntax in tests (resources)
Browse files Browse the repository at this point in the history
  • Loading branch information
megan07 authored Nov 21, 2019
2 parents bac54ae + 82ce5e6 commit 5be364d
Show file tree
Hide file tree
Showing 143 changed files with 10,060 additions and 9,686 deletions.
1 change: 0 additions & 1 deletion google/data_source_google_active_folder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,5 @@ data "google_active_folder" "my_folder" {
parent = google_folder.foobar.parent
display_name = google_folder.foobar.display_name
}
`, parent, displayName)
}
20 changes: 11 additions & 9 deletions google/data_source_google_compute_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ 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)
}
3 changes: 2 additions & 1 deletion google/data_source_storage_object_signed_url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 12 additions & 10 deletions google/resource_app_engine_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ 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 {
Expand All @@ -69,9 +70,10 @@ 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)
}
12 changes: 7 additions & 5 deletions google/resource_app_engine_domain_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,23 @@ 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)
}
67 changes: 37 additions & 30 deletions google/resource_big_query_dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,53 +180,56 @@ 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 {
Expand All @@ -242,7 +245,8 @@ resource "google_bigquery_dataset" "test" {
env = "foo"
default_table_expiration_ms = 3600000
}
}`, datasetID, location)
}
`, datasetID, location)
}

func testAccBigQueryDatasetWithOneAccess(datasetID string) string {
Expand All @@ -259,7 +263,8 @@ resource "google_bigquery_dataset" "access_test" {
env = "foo"
default_table_expiration_ms = 3600000
}
}`, datasetID)
}
`, datasetID)
}

func testAccBigQueryDatasetWithTwoAccess(datasetID string) string {
Expand All @@ -280,7 +285,8 @@ resource "google_bigquery_dataset" "access_test" {
env = "foo"
default_table_expiration_ms = 3600000
}
}`, datasetID)
}
`, datasetID)
}

func testAccBigQueryDatasetWithViewAccess(datasetID, otherDatasetID, otherTableID string) string {
Expand All @@ -293,14 +299,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
}
}
Expand All @@ -314,17 +320,18 @@ 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
}
}
labels = {
env = "foo"
default_table_expiration_ms = 3600000
}
}`, otherDatasetID, otherTableID, datasetID)
}
`, otherDatasetID, otherTableID, datasetID)
}

func testAccBigQueryDataset_cmek(pid, datasetID, kmsKey string) string {
Expand All @@ -334,7 +341,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"
}
Expand All @@ -350,7 +357,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)
}
42 changes: 21 additions & 21 deletions google/resource_bigquery_data_transfer_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,32 +127,32 @@ 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"
}
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)
Expand All @@ -163,40 +163,40 @@ 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" {
depends_on = [google_project_iam_member.permissions]
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)
Expand Down
Loading

0 comments on commit 5be364d

Please sign in to comment.