From 5a25c26c4aae91fff85f22dd38fa280bfbcce345 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 13:54:52 -0700 Subject: [PATCH 01/20] Updating appengine firewall ID field, sample for more thorough 3.0.0 work --- products/appengine/terraform.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/appengine/terraform.yaml b/products/appengine/terraform.yaml index a317399d104a..ecc8892af473 100644 --- a/products/appengine/terraform.yaml +++ b/products/appengine/terraform.yaml @@ -14,8 +14,8 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides FirewallRule: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{project}}/{{priority}}" - import_format: ["{{project}}/{{priority}}"] + id_format: "apps/{{project}}/firewall/ingressRules/{{priority}}" + import_format: ["apps/{{project}}/firewall/ingressRules/{{priority}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "app_engine_firewall_rule_basic" From 8c2369fa6e14ea92481cd4074925dd01b73855f4 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 14:30:43 -0700 Subject: [PATCH 02/20] Remove unneeded id format declaration instead --- products/appengine/terraform.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/products/appengine/terraform.yaml b/products/appengine/terraform.yaml index ecc8892af473..2f1272857145 100644 --- a/products/appengine/terraform.yaml +++ b/products/appengine/terraform.yaml @@ -25,8 +25,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides test_env_vars: org_id: :ORG_ID StandardAppVersion: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "apps/{{project}}/services/{{service}}/versions/{{version_id}}" - import_format: ["apps/{{project}}/services/{{service}}/versions/{{version_id}}"] mutex: "apps/{{project}}/services/{{service}}" parameters: service: !ruby/object:Overrides::Terraform::PropertyOverride From 4db967d0c0596402f80c8ce835f2ea6f8a3685fe Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 14:38:10 -0700 Subject: [PATCH 03/20] Fiddling with import id --- products/appengine/terraform.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/products/appengine/terraform.yaml b/products/appengine/terraform.yaml index 2f1272857145..ecc8892af473 100644 --- a/products/appengine/terraform.yaml +++ b/products/appengine/terraform.yaml @@ -25,6 +25,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides test_env_vars: org_id: :ORG_ID StandardAppVersion: !ruby/object:Overrides::Terraform::ResourceOverride + id_format: "apps/{{project}}/services/{{service}}/versions/{{version_id}}" + import_format: ["apps/{{project}}/services/{{service}}/versions/{{version_id}}"] mutex: "apps/{{project}}/services/{{service}}" parameters: service: !ruby/object:Overrides::Terraform::PropertyOverride From 6506466c1a4fbb4a03039379f8a43da7c004bfc4 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 14:54:35 -0700 Subject: [PATCH 04/20] Updates for the rest of appengine --- products/appengine/terraform.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/appengine/terraform.yaml b/products/appengine/terraform.yaml index ecc8892af473..980f3534b4a6 100644 --- a/products/appengine/terraform.yaml +++ b/products/appengine/terraform.yaml @@ -67,8 +67,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides exclude: true DomainMapping: !ruby/object:Overrides::Terraform::ResourceOverride self_link: 'apps/{{project}}/domainMappings/{{domain_name}}' - id_format: "{{domain_name}}" - import_format: ["{{domain_name}}"] + id_format: 'apps/{{project}}/domainMappings/{{domain_name}}' + import_format: ['apps/{{project}}/domainMappings/{{domain_name}}'] examples: - !ruby/object:Provider::Terraform::Examples name: "app_engine_domain_mapping_basic" From 3fd84d5299f3f873d5afdc846b5487e7e89fa3a6 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 15:09:33 -0700 Subject: [PATCH 05/20] Updating bigquery id formats --- products/bigquery/terraform.yaml | 4 ++-- .../terraform/resources/resource_bigquery_table.go.erb | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/products/bigquery/terraform.yaml b/products/bigquery/terraform.yaml index 1340cbed0ad7..41f8c32d58c9 100644 --- a/products/bigquery/terraform.yaml +++ b/products/bigquery/terraform.yaml @@ -15,8 +15,8 @@ legacy_name: 'bigquery' overrides: !ruby/object:Overrides::ResourceOverrides Dataset: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{project}}:{{dataset_id}}" - import_format: ["{{project}}:{{dataset_id}}", "{{project}}/{{dataset_id}}", "{{dataset_id}}"] + id_format: "projects/{{project}}/datasets/{{dataset_id}}" + import_format: ["projects/{{project}}/datasets/{{dataset_id}}"] delete_url: projects/{{project}}/datasets/{{dataset_id}}?deleteContents={{delete_contents_on_destroy}} examples: - !ruby/object:Provider::Terraform::Examples diff --git a/third_party/terraform/resources/resource_bigquery_table.go.erb b/third_party/terraform/resources/resource_bigquery_table.go.erb index af0a4e4a5564..ad78514f5f26 100644 --- a/third_party/terraform/resources/resource_bigquery_table.go.erb +++ b/third_party/terraform/resources/resource_bigquery_table.go.erb @@ -479,7 +479,7 @@ func resourceBigQueryTableCreate(d *schema.ResourceData, meta interface{}) error log.Printf("[INFO] BigQuery table %s has been created", res.Id) - d.SetId(fmt.Sprintf("%s:%s.%s", res.TableReference.ProjectId, res.TableReference.DatasetId, res.TableReference.TableId)) + d.SetId(fmt.Sprintf("projects/%s/datasets/%s/tables/%s", res.TableReference.ProjectId, res.TableReference.DatasetId, res.TableReference.TableId)) return resourceBigQueryTableRead(d, meta) } @@ -847,12 +847,11 @@ type bigQueryTableId struct { } func parseBigQueryTableId(id string) (*bigQueryTableId, error) { - // Expected format is "PROJECT:DATASET.TABLE", but the project can itself have . and : in it. - // Those characters are not valid dataset or table components, so just split on the last two. - matchRegex := regexp.MustCompile("^(.+):([^:.]+)\\.([^:.]+)$") + // Expected format is "projects/{{project}}/datasets/{{dataset}}/tables/{{table}}" + matchRegex := regexp.MustCompile("^projects/(.+)/datasets/(.+)/tables/(.+)$") subMatches := matchRegex.FindStringSubmatch(id) if subMatches == nil { - return nil, fmt.Errorf("Invalid BigQuery table specifier. Expecting {project}:{dataset-id}.{table-id}, got %s", id) + return nil, fmt.Errorf("Invalid BigQuery table specifier. Expecting "projects/{{project}}/datasets/{{dataset}}/tables/{{table}}", got %s", id) } return &bigQueryTableId{ Project: subMatches[1], From 372420882b715c0928a68e2d3d12ef644e782cec Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 15:17:00 -0700 Subject: [PATCH 06/20] Fix extra quotes --- third_party/terraform/resources/resource_bigquery_table.go.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/terraform/resources/resource_bigquery_table.go.erb b/third_party/terraform/resources/resource_bigquery_table.go.erb index ad78514f5f26..4fff8ad72446 100644 --- a/third_party/terraform/resources/resource_bigquery_table.go.erb +++ b/third_party/terraform/resources/resource_bigquery_table.go.erb @@ -851,7 +851,7 @@ func parseBigQueryTableId(id string) (*bigQueryTableId, error) { matchRegex := regexp.MustCompile("^projects/(.+)/datasets/(.+)/tables/(.+)$") subMatches := matchRegex.FindStringSubmatch(id) if subMatches == nil { - return nil, fmt.Errorf("Invalid BigQuery table specifier. Expecting "projects/{{project}}/datasets/{{dataset}}/tables/{{table}}", got %s", id) + return nil, fmt.Errorf("Invalid BigQuery table specifier. Expecting projects/{{project}}/datasets/{{dataset}}/tables/{{table}}, got %s", id) } return &bigQueryTableId{ Project: subMatches[1], From 29d28193faa6b98f6b5e3e4cc68a7c1fe5659ee4 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 15:53:39 -0700 Subject: [PATCH 07/20] Update bigtable resource ids --- products/bigtable/terraform.yaml | 2 +- .../terraform/resources/resource_bigtable_instance.go | 8 ++++++-- .../terraform/resources/resource_bigtable_table.go | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/products/bigtable/terraform.yaml b/products/bigtable/terraform.yaml index 6e8c7204446d..44a112c82ee1 100644 --- a/products/bigtable/terraform.yaml +++ b/products/bigtable/terraform.yaml @@ -14,7 +14,7 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides AppProfile: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{project}}/{{instance}}/{{app_profile_id}}" + id_format: "projects/{{project}}/instances/{{instance}}/appProfiles/{{app_profile_id}}" import_format: ["projects/{{project}}/instances/{{instance}}/appProfiles/{{app_profile_id}}"] examples: - !ruby/object:Provider::Terraform::Examples diff --git a/third_party/terraform/resources/resource_bigtable_instance.go b/third_party/terraform/resources/resource_bigtable_instance.go index e8f261d92a06..235a429d2e7e 100644 --- a/third_party/terraform/resources/resource_bigtable_instance.go +++ b/third_party/terraform/resources/resource_bigtable_instance.go @@ -131,7 +131,11 @@ func resourceBigtableInstanceCreate(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Error creating instance. %s", err) } - d.SetId(conf.InstanceID) + id, err := replaceVars(d, config, "projects/{{project}}/instances/{{name}}") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) return resourceBigtableInstanceRead(d, meta) } @@ -371,7 +375,7 @@ func resourceBigtableInstanceImport(d *schema.ResourceData, meta interface{}) ([ } // Replace import id for the resource id - id, err := replaceVars(d, config, "{{name}}") + id, err := replaceVars(d, config, "projects/{{project}}/instances/{{name}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/third_party/terraform/resources/resource_bigtable_table.go b/third_party/terraform/resources/resource_bigtable_table.go index 52e678d1f562..aa021f45f811 100644 --- a/third_party/terraform/resources/resource_bigtable_table.go +++ b/third_party/terraform/resources/resource_bigtable_table.go @@ -107,7 +107,11 @@ func resourceBigtableTableCreate(d *schema.ResourceData, meta interface{}) error } } - d.SetId(name) + id, err := replaceVars(d, config, "projects/{{project}}/instances/{{instance_id}}/tables/{{name}}") + if err != nil { + return nil, fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) return resourceBigtableTableRead(d, meta) } From c2bea8e4e61416bdf28952997aab558496fe0a1d Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 16:19:41 -0700 Subject: [PATCH 08/20] Update binauth id formats --- products/binaryauthorization/terraform.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/binaryauthorization/terraform.yaml b/products/binaryauthorization/terraform.yaml index fff7c4a35222..5f51c75b8fe9 100644 --- a/products/binaryauthorization/terraform.yaml +++ b/products/binaryauthorization/terraform.yaml @@ -15,7 +15,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides Attestor: !ruby/object:Overrides::Terraform::ResourceOverride import_format: ["projects/{{project}}/attestors/{{name}}"] - id_format: "{{project}}/{{name}}" + id_format: "projects/{{project}}/attestors/{{name}}" examples: - !ruby/object:Provider::Terraform::Examples name: "binary_authorization_attestor_basic" @@ -54,7 +54,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides attestationAuthorityNote.publicKeys.id: !ruby/object:Overrides::Terraform::PropertyOverride default_from_api: true Policy: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{project}}" + id_format: "projects/{{project}}" import_format: ["projects/{{project}}"] custom_code: !ruby/object:Provider::Terraform::CustomCode constants: 'templates/terraform/constants/binaryauthorization_policy.erb' From 2c6db23ade19f24c465dd17582bbc604922881c5 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Oct 2019 16:31:54 -0700 Subject: [PATCH 09/20] Update cloudbuild id formats --- products/cloudbuild/terraform.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/cloudbuild/terraform.yaml b/products/cloudbuild/terraform.yaml index 132d5a7ee1f5..1ac1862a6655 100644 --- a/products/cloudbuild/terraform.yaml +++ b/products/cloudbuild/terraform.yaml @@ -17,7 +17,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides Trigger: !ruby/object:Overrides::Terraform::ResourceOverride # import by default only works with old-style self links ending in a name import_format: ["projects/{{project}}/triggers/{{trigger_id}}"] - id_format: '{{project}}/{{trigger_id}}' + id_format: 'projects/{{project}}/triggers/{{trigger_id}}' self_link: 'projects/{{project}}/triggers/{{trigger_id}}' examples: - !ruby/object:Provider::Terraform::Examples From 0cc63eca9791fea2ab330ece48e7b903750c2b30 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Thu, 10 Oct 2019 15:39:53 -0700 Subject: [PATCH 10/20] Update cloudfunction id --- products/cloudfunctions/terraform.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/cloudfunctions/terraform.yaml b/products/cloudfunctions/terraform.yaml index 98f88077c493..ad900171f724 100644 --- a/products/cloudfunctions/terraform.yaml +++ b/products/cloudfunctions/terraform.yaml @@ -16,7 +16,7 @@ legacy_name: 'cloudfunctions' overrides: !ruby/object:Overrides::ResourceOverrides CloudFunction: !ruby/object:Overrides::Terraform::ResourceOverride legacy_name: 'google_cloudfunctions_function' - id_format: '{{project}}/{{region}}/{{cloud_function}}' + id_format: 'projects/{{project}}/locations/{{region}}/functions/{{cloud_function}}' base_url: projects/{{project}}/locations/{{region}}/functions import_format: ["projects/{{project}}/locations/{{region}}/functions/{{cloud_function}}"] exclude_resource: true From 8f05a8f92f25365fb4021c140ada08ab602d17dd Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Thu, 10 Oct 2019 15:45:14 -0700 Subject: [PATCH 11/20] Update id formats for cloudrun --- products/cloudrun/terraform.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/products/cloudrun/terraform.yaml b/products/cloudrun/terraform.yaml index ee64ce02f6c8..d1d958ecf9bb 100644 --- a/products/cloudrun/terraform.yaml +++ b/products/cloudrun/terraform.yaml @@ -14,6 +14,8 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides DomainMapping: !ruby/object:Overrides::Terraform::ResourceOverride + import_format: ['projects/{{project}}/locations/{{location}}/domainmappings/{{name}}'] + id_format: 'projects/{{project}}/locations/{{location}}/domainmappings/{{name}}' examples: - !ruby/object:Provider::Terraform::Examples name: "cloud_run_domain_mapping_basic" @@ -43,6 +45,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides metadata.name: !ruby/object:Overrides::Terraform::PropertyOverride exclude: true Service: !ruby/object:Overrides::Terraform::ResourceOverride + import_format: ['projects/{{project}}/locations/{{location}}/services/{{name}}'] + id_format: 'projects/{{project}}/locations/{{location}}/services/{{name}}' examples: - !ruby/object:Provider::Terraform::Examples name: "cloud_run_service_basic" From fd99a058621a10d13effbeb27126fd90b462b48e Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Thu, 10 Oct 2019 16:45:04 -0700 Subject: [PATCH 12/20] Cloudscheduler, dns --- products/cloudscheduler/terraform.yaml | 1 + products/dns/terraform.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/products/cloudscheduler/terraform.yaml b/products/cloudscheduler/terraform.yaml index 8730f55d3a83..943c4c74597d 100644 --- a/products/cloudscheduler/terraform.yaml +++ b/products/cloudscheduler/terraform.yaml @@ -14,6 +14,7 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides Job: !ruby/object:Overrides::Terraform::ResourceOverride + id_format: 'projects/{{project}}/locations/{{region}}/jobs/{{name}}' custom_code: !ruby/object:Provider::Terraform::CustomCode constants: templates/terraform/constants/scheduler_auth.erb resource_definition: templates/terraform/resource_definition/scheduler_auth.erb diff --git a/products/dns/terraform.yaml b/products/dns/terraform.yaml index cd772a5722dc..20e84ea5fcfe 100644 --- a/products/dns/terraform.yaml +++ b/products/dns/terraform.yaml @@ -14,6 +14,7 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides ManagedZone: !ruby/object:Overrides::Terraform::ResourceOverride + id_format: 'projects/{{project}}/managedZones/{{name}}' examples: - !ruby/object:Provider::Terraform::Examples name: "dns_managed_zone_basic" @@ -94,6 +95,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides diff_suppress_func: 'caseDiffSuppress' custom_flatten: templates/terraform/custom_flatten/default_if_empty.erb Policy: !ruby/object:Overrides::Terraform::ResourceOverride + id_format: 'projects/{{project}}/policies/{{name}}' examples: - !ruby/object:Provider::Terraform::Examples name: "dns_policy_basic" From f52ded52c6315e0bff3f9679c3c4a9ea84dceca3 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 10:38:11 -0700 Subject: [PATCH 13/20] Removing unneeded id format declarations --- products/cloudrun/terraform.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/products/cloudrun/terraform.yaml b/products/cloudrun/terraform.yaml index d1d958ecf9bb..ee64ce02f6c8 100644 --- a/products/cloudrun/terraform.yaml +++ b/products/cloudrun/terraform.yaml @@ -14,8 +14,6 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides DomainMapping: !ruby/object:Overrides::Terraform::ResourceOverride - import_format: ['projects/{{project}}/locations/{{location}}/domainmappings/{{name}}'] - id_format: 'projects/{{project}}/locations/{{location}}/domainmappings/{{name}}' examples: - !ruby/object:Provider::Terraform::Examples name: "cloud_run_domain_mapping_basic" @@ -45,8 +43,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides metadata.name: !ruby/object:Overrides::Terraform::PropertyOverride exclude: true Service: !ruby/object:Overrides::Terraform::ResourceOverride - import_format: ['projects/{{project}}/locations/{{location}}/services/{{name}}'] - id_format: 'projects/{{project}}/locations/{{location}}/services/{{name}}' examples: - !ruby/object:Provider::Terraform::Examples name: "cloud_run_service_basic" From be5b26327a8db450173ed9eedfaffeebab12f19d Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 10:49:45 -0700 Subject: [PATCH 14/20] Fix return vals --- third_party/terraform/resources/resource_bigtable_table.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/terraform/resources/resource_bigtable_table.go b/third_party/terraform/resources/resource_bigtable_table.go index aa021f45f811..8d98b5935bc3 100644 --- a/third_party/terraform/resources/resource_bigtable_table.go +++ b/third_party/terraform/resources/resource_bigtable_table.go @@ -109,7 +109,7 @@ func resourceBigtableTableCreate(d *schema.ResourceData, meta interface{}) error id, err := replaceVars(d, config, "projects/{{project}}/instances/{{instance_id}}/tables/{{name}}") if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) + return fmt.Errorf("Error constructing id: %s", err) } d.SetId(id) From b18d8b396b6819968192f5171a0838dfe26d918d Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 11:52:55 -0700 Subject: [PATCH 15/20] Update id formats for generated resources in: compute, containeranalysis, filestore, healthcare, pubsub, redis, runtimeconfig, securityscanner, sourcerepo, spanner, sql, tpu --- products/compute/terraform.yaml | 5 ----- products/containeranalysis/terraform.yaml | 1 - products/filestore/terraform.yaml | 2 -- products/healthcare/terraform.yaml | 2 -- products/pubsub/terraform.yaml | 2 -- products/redis/terraform.yaml | 2 -- products/runtimeconfig/terraform.yaml | 2 -- products/securityscanner/terraform.yaml | 1 - products/sourcerepo/terraform.yaml | 1 - products/spanner/terraform.yaml | 1 - products/sql/terraform.yaml | 3 --- products/tpu/terraform.yaml | 2 -- 12 files changed, 24 deletions(-) diff --git a/products/compute/terraform.yaml b/products/compute/terraform.yaml index 7ea66b1bfd74..779c06ee5ee5 100644 --- a/products/compute/terraform.yaml +++ b/products/compute/terraform.yaml @@ -14,7 +14,6 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides Address: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{project}}/{{region}}/{{name}}" examples: - !ruby/object:Provider::Terraform::Examples name: "address_basic" @@ -71,7 +70,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides custom_code: !ruby/object:Provider::Terraform::CustomCode post_create: templates/terraform/post_create/labels.erb Autoscaler: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{zone}}/{{name}}" examples: - !ruby/object:Provider::Terraform::Examples name: "autoscaler_single_instance" @@ -1019,7 +1017,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides Region: !ruby/object:Overrides::Terraform::ResourceOverride exclude: true RegionAutoscaler: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{region}}/{{name}}" examples: - !ruby/object:Provider::Terraform::Examples name: "region_autoscaler_beta" @@ -1332,7 +1329,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides `next_hop_instance`. Omit if `next_hop_instance` is specified as a URL. Router: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "{{region}}/{{name}}" mutex: router/{{region}}/{{name}} examples: - !ruby/object:Provider::Terraform::Examples @@ -1642,7 +1638,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides insert_minutes: 6 update_minutes: 6 delete_minutes: 6 - id_format: "{{region}}/{{name}}" properties: id: !ruby/object:Overrides::Terraform::PropertyOverride exclude: true diff --git a/products/containeranalysis/terraform.yaml b/products/containeranalysis/terraform.yaml index 6fcf384ae447..b2c4d9fb3ed1 100644 --- a/products/containeranalysis/terraform.yaml +++ b/products/containeranalysis/terraform.yaml @@ -14,7 +14,6 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides Note: !ruby/object:Overrides::Terraform::ResourceOverride - import_format: ["projects/{{project}}/notes/{{name}}"] custom_code: !ruby/object:Provider::Terraform::CustomCode pre_update: 'templates/terraform/pre_update/containeranalysis_note.erb' encoder: templates/terraform/encoders/containeranalysis_attestation_field_name.go.erb diff --git a/products/filestore/terraform.yaml b/products/filestore/terraform.yaml index 6a4a9ca8b9df..f20a9567914f 100644 --- a/products/filestore/terraform.yaml +++ b/products/filestore/terraform.yaml @@ -19,8 +19,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides update_minutes: 6 delete_minutes: 6 autogen_async: true - id_format: "{{project}}/{{zone}}/{{name}}" - import_format: ["projects/{{project}}/locations/{{zone}}/instances/{{name}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "filestore_instance_basic" diff --git a/products/healthcare/terraform.yaml b/products/healthcare/terraform.yaml index 92c80245ca94..6e4704164aa4 100644 --- a/products/healthcare/terraform.yaml +++ b/products/healthcare/terraform.yaml @@ -16,8 +16,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides Dataset: !ruby/object:Overrides::Terraform::ResourceOverride description: | {{description}} - id_format: "projects/{{project}}/locations/{{location}}/datasets/{{name}}" - import_format: ["projects/{{project}}/locations/{{location}}/datasets/{{name}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "healthcare_dataset_basic" diff --git a/products/pubsub/terraform.yaml b/products/pubsub/terraform.yaml index 771cf77e7323..93604efad66a 100644 --- a/products/pubsub/terraform.yaml +++ b/products/pubsub/terraform.yaml @@ -14,7 +14,6 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides Topic: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "projects/{{project}}/topics/{{name}}" error_retry_predicates: ["pubsubTopicProjectNotReady"] iam_policy: !ruby/object:Api::Resource::IamPolicy parent_resource_attribute: 'topic' @@ -48,7 +47,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides encoder: templates/terraform/encoders/no_send_name.go.erb update_encoder: templates/terraform/update_encoder/pubsub_topic.erb Subscription: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "projects/{{project}}/subscriptions/{{name}}" examples: - !ruby/object:Provider::Terraform::Examples name: "pubsub_subscription_push" diff --git a/products/redis/terraform.yaml b/products/redis/terraform.yaml index 59eacce05ad2..291474d603d1 100644 --- a/products/redis/terraform.yaml +++ b/products/redis/terraform.yaml @@ -19,8 +19,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides update_minutes: 10 delete_minutes: 10 autogen_async: true - id_format: "{{project}}/{{region}}/{{name}}" - import_format: ["projects/{{project}}/locations/{{region}}/instances/{{name}}"] custom_code: !ruby/object:Provider::Terraform::CustomCode encoder: templates/terraform/encoders/redis_location_id_for_fallback_zone.go.erb examples: diff --git a/products/runtimeconfig/terraform.yaml b/products/runtimeconfig/terraform.yaml index cbadd0fcd26e..069c8ebe66d7 100644 --- a/products/runtimeconfig/terraform.yaml +++ b/products/runtimeconfig/terraform.yaml @@ -16,8 +16,6 @@ legacy_name: runtimeconfig overrides: !ruby/object:Overrides::ResourceOverrides Config: !ruby/object:Overrides::Terraform::ResourceOverride exclude_resource: true - id_format: 'projects/{{project}}/configs/{{config}}' - import_format: ["projects/{{project}}/configs/{{config}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "runtimeconfig_config_basic" diff --git a/products/securityscanner/terraform.yaml b/products/securityscanner/terraform.yaml index a40e142ff064..763ff1ae7949 100644 --- a/products/securityscanner/terraform.yaml +++ b/products/securityscanner/terraform.yaml @@ -13,7 +13,6 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides ScanConfig: !ruby/object:Overrides::Terraform::ResourceOverride - import_format: ["{{name}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "scan_config_basic" diff --git a/products/sourcerepo/terraform.yaml b/products/sourcerepo/terraform.yaml index 2c18421b498d..a03836a963ac 100644 --- a/products/sourcerepo/terraform.yaml +++ b/products/sourcerepo/terraform.yaml @@ -19,7 +19,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides exclude: false method_name_separator: ':' parent_resource_attribute: 'repository' - id_format: '{{project}}/{{name}}' examples: - !ruby/object:Provider::Terraform::Examples name: "sourcerepo_repository_basic" diff --git a/products/spanner/terraform.yaml b/products/spanner/terraform.yaml index fa7d29732465..16765e710866 100644 --- a/products/spanner/terraform.yaml +++ b/products/spanner/terraform.yaml @@ -15,7 +15,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides Database: !ruby/object:Overrides::Terraform::ResourceOverride autogen_async: true - id_format: "{{project}}/{{instance}}/{{name}}" import_format: - "projects/{{project}}/instances/{{instance}}/databases/{{name}}" - "instances/{{instance}}/databases/{{name}}" diff --git a/products/sql/terraform.yaml b/products/sql/terraform.yaml index 0488eec48868..6b217793c43b 100644 --- a/products/sql/terraform.yaml +++ b/products/sql/terraform.yaml @@ -16,12 +16,9 @@ client_name: 'SqlAdmin' overrides: !ruby/object:Overrides::ResourceOverrides Database: !ruby/object:Overrides::Terraform::ResourceOverride mutex: "google-sql-database-instance-{{project}}-{{instance}}" - id_format: "{{instance}}:{{name}}" import_format: ["projects/{{project}}/instances/{{instance}}/databases/{{name}}", "{{project}}/{{instance}}/{{name}}", "instances/{{instance}}/databases/{{name}}", - # support for a legacy import format - "{{instance}}:{{name}}", "{{instance}}/{{name}}", "{{name}}"] examples: diff --git a/products/tpu/terraform.yaml b/products/tpu/terraform.yaml index 56f9b85a58cc..857085513288 100644 --- a/products/tpu/terraform.yaml +++ b/products/tpu/terraform.yaml @@ -18,8 +18,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides insert_minutes: 15 update_minutes: 15 delete_minutes: 15 - id_format: "{{project}}/{{zone}}/{{name}}" - import_format: ["projects/{{project}}/locations/{{zone}}/nodes/{{name}}"] autogen_async: true examples: - !ruby/object:Provider::Terraform::Examples From be762ebf6e015f8ee8d7cefe118671be4c54fcc0 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 13:27:43 -0700 Subject: [PATCH 16/20] Remove some redundant id formats as the default works in most cases --- products/appengine/terraform.yaml | 4 ---- products/bigquery/terraform.yaml | 2 -- products/binaryauthorization/terraform.yaml | 4 ---- products/containeranalysis/terraform.yaml | 2 ++ products/healthcare/terraform.yaml | 2 ++ products/runtimeconfig/terraform.yaml | 4 ++++ 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/products/appengine/terraform.yaml b/products/appengine/terraform.yaml index 980f3534b4a6..8cd55c6d6fab 100644 --- a/products/appengine/terraform.yaml +++ b/products/appengine/terraform.yaml @@ -14,8 +14,6 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides FirewallRule: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "apps/{{project}}/firewall/ingressRules/{{priority}}" - import_format: ["apps/{{project}}/firewall/ingressRules/{{priority}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "app_engine_firewall_rule_basic" @@ -25,8 +23,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides test_env_vars: org_id: :ORG_ID StandardAppVersion: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "apps/{{project}}/services/{{service}}/versions/{{version_id}}" - import_format: ["apps/{{project}}/services/{{service}}/versions/{{version_id}}"] mutex: "apps/{{project}}/services/{{service}}" parameters: service: !ruby/object:Overrides::Terraform::PropertyOverride diff --git a/products/bigquery/terraform.yaml b/products/bigquery/terraform.yaml index 41f8c32d58c9..4a5f80e58493 100644 --- a/products/bigquery/terraform.yaml +++ b/products/bigquery/terraform.yaml @@ -15,8 +15,6 @@ legacy_name: 'bigquery' overrides: !ruby/object:Overrides::ResourceOverrides Dataset: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "projects/{{project}}/datasets/{{dataset_id}}" - import_format: ["projects/{{project}}/datasets/{{dataset_id}}"] delete_url: projects/{{project}}/datasets/{{dataset_id}}?deleteContents={{delete_contents_on_destroy}} examples: - !ruby/object:Provider::Terraform::Examples diff --git a/products/binaryauthorization/terraform.yaml b/products/binaryauthorization/terraform.yaml index 5f51c75b8fe9..efda55a357d7 100644 --- a/products/binaryauthorization/terraform.yaml +++ b/products/binaryauthorization/terraform.yaml @@ -14,8 +14,6 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides Attestor: !ruby/object:Overrides::Terraform::ResourceOverride - import_format: ["projects/{{project}}/attestors/{{name}}"] - id_format: "projects/{{project}}/attestors/{{name}}" examples: - !ruby/object:Provider::Terraform::Examples name: "binary_authorization_attestor_basic" @@ -54,8 +52,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides attestationAuthorityNote.publicKeys.id: !ruby/object:Overrides::Terraform::PropertyOverride default_from_api: true Policy: !ruby/object:Overrides::Terraform::ResourceOverride - id_format: "projects/{{project}}" - import_format: ["projects/{{project}}"] custom_code: !ruby/object:Provider::Terraform::CustomCode constants: 'templates/terraform/constants/binaryauthorization_policy.erb' pre_delete: 'templates/terraform/pre_delete/restore_default_binaryauthorization_policy.erb' diff --git a/products/containeranalysis/terraform.yaml b/products/containeranalysis/terraform.yaml index b2c4d9fb3ed1..99a3579f59f6 100644 --- a/products/containeranalysis/terraform.yaml +++ b/products/containeranalysis/terraform.yaml @@ -14,6 +14,8 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides Note: !ruby/object:Overrides::Terraform::ResourceOverride + id_format: "projects/{{project}}/notes/{{name}}" + import_format: ["projects/{{project}}/notes/{{name}}"] custom_code: !ruby/object:Provider::Terraform::CustomCode pre_update: 'templates/terraform/pre_update/containeranalysis_note.erb' encoder: templates/terraform/encoders/containeranalysis_attestation_field_name.go.erb diff --git a/products/healthcare/terraform.yaml b/products/healthcare/terraform.yaml index 6e4704164aa4..92c80245ca94 100644 --- a/products/healthcare/terraform.yaml +++ b/products/healthcare/terraform.yaml @@ -16,6 +16,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides Dataset: !ruby/object:Overrides::Terraform::ResourceOverride description: | {{description}} + id_format: "projects/{{project}}/locations/{{location}}/datasets/{{name}}" + import_format: ["projects/{{project}}/locations/{{location}}/datasets/{{name}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "healthcare_dataset_basic" diff --git a/products/runtimeconfig/terraform.yaml b/products/runtimeconfig/terraform.yaml index 069c8ebe66d7..3f6a3b8ce15d 100644 --- a/products/runtimeconfig/terraform.yaml +++ b/products/runtimeconfig/terraform.yaml @@ -16,6 +16,8 @@ legacy_name: runtimeconfig overrides: !ruby/object:Overrides::ResourceOverrides Config: !ruby/object:Overrides::Terraform::ResourceOverride exclude_resource: true + id_format: 'projects/{{project}}/configs/{{config}}' + import_format: ["projects/{{project}}/configs/{{config}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "runtimeconfig_config_basic" @@ -23,6 +25,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides primary_resource_name: "fmt.Sprintf(\"my-config%s\", context[\"random_suffix\"])" vars: config_name: "my-config" + Variable: !ruby/object:Overrides::Terraform::ResourceOverride + exclude: true # This is for copying files over files: !ruby/object:Provider::Config::Files # These files have templating (ERB) code that will be run. From e4b224e03654c06340ddb529f4eeab9e3bc89f93 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 13:39:57 -0700 Subject: [PATCH 17/20] Remove runtimeconfig unused var --- products/runtimeconfig/terraform.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/products/runtimeconfig/terraform.yaml b/products/runtimeconfig/terraform.yaml index 3f6a3b8ce15d..069c8ebe66d7 100644 --- a/products/runtimeconfig/terraform.yaml +++ b/products/runtimeconfig/terraform.yaml @@ -16,8 +16,6 @@ legacy_name: runtimeconfig overrides: !ruby/object:Overrides::ResourceOverrides Config: !ruby/object:Overrides::Terraform::ResourceOverride exclude_resource: true - id_format: 'projects/{{project}}/configs/{{config}}' - import_format: ["projects/{{project}}/configs/{{config}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "runtimeconfig_config_basic" @@ -25,8 +23,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides primary_resource_name: "fmt.Sprintf(\"my-config%s\", context[\"random_suffix\"])" vars: config_name: "my-config" - Variable: !ruby/object:Overrides::Terraform::ResourceOverride - exclude: true # This is for copying files over files: !ruby/object:Provider::Config::Files # These files have templating (ERB) code that will be run. From 4e195b0312ebf0f28ca5727cd07c6974bb2e4218 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 15:36:36 -0700 Subject: [PATCH 18/20] Fixes for appengine standard version, runtimeconfig, binauth attestor. PR feedback --- products/appengine/terraform.yaml | 1 + products/binaryauthorization/terraform.yaml | 1 + products/runtimeconfig/terraform.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/products/appengine/terraform.yaml b/products/appengine/terraform.yaml index 8cd55c6d6fab..bc567e475f43 100644 --- a/products/appengine/terraform.yaml +++ b/products/appengine/terraform.yaml @@ -23,6 +23,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides test_env_vars: org_id: :ORG_ID StandardAppVersion: !ruby/object:Overrides::Terraform::ResourceOverride + import_format: ["apps/{{project}}/services/{{service}}/versions/{{version_id}}"] mutex: "apps/{{project}}/services/{{service}}" parameters: service: !ruby/object:Overrides::Terraform::PropertyOverride diff --git a/products/binaryauthorization/terraform.yaml b/products/binaryauthorization/terraform.yaml index efda55a357d7..64033a8a9138 100644 --- a/products/binaryauthorization/terraform.yaml +++ b/products/binaryauthorization/terraform.yaml @@ -14,6 +14,7 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides Attestor: !ruby/object:Overrides::Terraform::ResourceOverride + import_format: ["projects/{{project}}/attestors/{{name}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "binary_authorization_attestor_basic" diff --git a/products/runtimeconfig/terraform.yaml b/products/runtimeconfig/terraform.yaml index 069c8ebe66d7..ebc0dde63223 100644 --- a/products/runtimeconfig/terraform.yaml +++ b/products/runtimeconfig/terraform.yaml @@ -16,6 +16,7 @@ legacy_name: runtimeconfig overrides: !ruby/object:Overrides::ResourceOverrides Config: !ruby/object:Overrides::Terraform::ResourceOverride exclude_resource: true + import_format: ["projects/{{project}}/configs/{{config}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "runtimeconfig_config_basic" From c9914da1775d8d45de4dba62c2cbe70a4639b619 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 15:53:17 -0700 Subject: [PATCH 19/20] Fix binauth policy, bigquery dataset ids --- products/bigquery/terraform.yaml | 1 + products/binaryauthorization/terraform.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/products/bigquery/terraform.yaml b/products/bigquery/terraform.yaml index 4a5f80e58493..4fcf4d7b766e 100644 --- a/products/bigquery/terraform.yaml +++ b/products/bigquery/terraform.yaml @@ -15,6 +15,7 @@ legacy_name: 'bigquery' overrides: !ruby/object:Overrides::ResourceOverrides Dataset: !ruby/object:Overrides::Terraform::ResourceOverride + import_format: ["projects/{{project}}/datasets/{{dataset_id}}"] delete_url: projects/{{project}}/datasets/{{dataset_id}}?deleteContents={{delete_contents_on_destroy}} examples: - !ruby/object:Provider::Terraform::Examples diff --git a/products/binaryauthorization/terraform.yaml b/products/binaryauthorization/terraform.yaml index 64033a8a9138..7408351a5dc7 100644 --- a/products/binaryauthorization/terraform.yaml +++ b/products/binaryauthorization/terraform.yaml @@ -53,6 +53,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides attestationAuthorityNote.publicKeys.id: !ruby/object:Overrides::Terraform::PropertyOverride default_from_api: true Policy: !ruby/object:Overrides::Terraform::ResourceOverride + id_format: "projects/{{project}}" + import_format: ["projects/{{project}}"] custom_code: !ruby/object:Provider::Terraform::CustomCode constants: 'templates/terraform/constants/binaryauthorization_policy.erb' pre_delete: 'templates/terraform/pre_delete/restore_default_binaryauthorization_policy.erb' From ffddeb756f10be5f4c944bac6f01be8cd1e7dec1 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 11 Oct 2019 16:05:10 -0700 Subject: [PATCH 20/20] Last name issue, appengine firewall --- products/appengine/terraform.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/products/appengine/terraform.yaml b/products/appengine/terraform.yaml index bc567e475f43..44dfbea86ece 100644 --- a/products/appengine/terraform.yaml +++ b/products/appengine/terraform.yaml @@ -14,6 +14,7 @@ --- !ruby/object:Provider::Terraform::Config overrides: !ruby/object:Overrides::ResourceOverrides FirewallRule: !ruby/object:Overrides::Terraform::ResourceOverride + import_format: ["apps/{{project}}/firewall/ingressRules/{{priority}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "app_engine_firewall_rule_basic"