Skip to content

Commit bfdc1c5

Browse files
Revert "Fix partial match regexes" (#14814) (#23957)
[upstream:a1d8ac9b278955ba2e4424561dcccc334d01b912] Signed-off-by: Modular Magician <[email protected]>
1 parent 1bf7ae8 commit bfdc1c5

25 files changed

+68
-66
lines changed

.changelog/14814.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
provider: fixed many import functions throughout the provider that erroneously matched a subset of the provided input, leading to unclear error messages when using `terraform input` with invalid resource IDs (revert)
3+
```

google/services/apigee/resource_apigee_api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ func resourceApigeeApiDelete(d *schema.ResourceData, meta interface{}) error {
340340
func resourceApigeeApiImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
341341
config := meta.(*transport_tpg.Config)
342342
if err := tpgresource.ParseImportId([]string{
343-
"^organizations/(?P<org_id>[^/]+)/apis/(?P<name>[^/]+)$",
344-
"^(?P<org_id>[^/]+)/(?P<name>[^/]+)$",
343+
"organizations/(?P<org_id>[^/]+)/apis/(?P<name>[^/]+)",
344+
"(?P<org_id>[^/]+)/(?P<name>[^/]+)",
345345
}, d, config); err != nil {
346346
return nil, err
347347
}

google/services/apigee/resource_apigee_flowhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ func resourceApigeeFlowhookDelete(d *schema.ResourceData, meta interface{}) erro
239239
func resourceApigeeFlowhookImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
240240
config := meta.(*transport_tpg.Config)
241241
if err := tpgresource.ParseImportId([]string{
242-
"^organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/flowhooks/(?P<flow_hook_point>[^/]+)$",
243-
"^(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<flow_hook_point>[^/]+)$",
242+
"organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/flowhooks/(?P<flow_hook_point>[^/]+)",
243+
"(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<flow_hook_point>[^/]+)",
244244
}, d, config); err != nil {
245245
return nil, err
246246
}

google/services/apigee/resource_apigee_keystores_aliases_key_cert_file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ func resourceApigeeKeystoresAliasesKeyCertFileDelete(d *schema.ResourceData, met
378378
func resourceApigeeKeystoresAliasesKeyCertFileImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
379379
config := meta.(*transport_tpg.Config)
380380
if err := tpgresource.ParseImportId([]string{
381-
"^organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/keystores/(?P<keystore>[^/]+)/aliases/(?P<alias>[^/]+)$",
382-
"^(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<keystore>[^/]+)/(?P<alias>[^/]+)$",
381+
"organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/keystores/(?P<keystore>[^/]+)/aliases/(?P<alias>[^/]+)",
382+
"(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<keystore>[^/]+)/(?P<alias>[^/]+)",
383383
}, d, config); err != nil {
384384
return nil, err
385385
}

google/services/apigee/resource_apigee_keystores_aliases_pkcs12.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ func ResourceApigeeKeystoresAliasesPkcs12Delete(d *schema.ResourceData, meta int
315315
func ResourceApigeeKeystoresAliasesPkcs12Import(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
316316
config := meta.(*transport_tpg.Config)
317317
if err := tpgresource.ParseImportId([]string{
318-
"^organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/keystores/(?P<keystore>[^/]+)/aliases/(?P<alias>[^/]+)$",
319-
"^(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<keystore>[^/]+)/(?P<alias>[^/]+)$",
318+
"organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/keystores/(?P<keystore>[^/]+)/aliases/(?P<alias>[^/]+)",
319+
"(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<keystore>[^/]+)/(?P<alias>[^/]+)",
320320
}, d, config); err != nil {
321321
return nil, err
322322
}

google/services/apigee/resource_apigee_sharedflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ func resourceApigeeSharedFlowDelete(d *schema.ResourceData, meta interface{}) er
340340
func resourceApigeeSharedFlowImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
341341
config := meta.(*transport_tpg.Config)
342342
if err := tpgresource.ParseImportId([]string{
343-
"^organizations/(?P<org_id>[^/]+)/sharedflows/(?P<name>[^/]+)$",
344-
"^(?P<org_id>[^/]+)/(?P<name>[^/]+)$",
343+
"organizations/(?P<org_id>[^/]+)/sharedflows/(?P<name>[^/]+)",
344+
"(?P<org_id>[^/]+)/(?P<name>[^/]+)",
345345
}, d, config); err != nil {
346346
return nil, err
347347
}

google/services/apigee/resource_apigee_sharedflow_deployment.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,8 @@ func resourceApigeeSharedflowDeploymentDelete(d *schema.ResourceData, meta inter
244244
func resourceApigeeSharedflowDeploymentImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
245245
config := meta.(*transport_tpg.Config)
246246
if err := tpgresource.ParseImportId([]string{
247-
"^organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/sharedflows/(?P<sharedflow_id>[^/]+)/revisions/(?P<revision>[^/]+)$",
248-
"^organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/sharedflows/(?P<sharedflow_id>[^/]+)/revisions/(?P<revision>[^/]+)/deployments$",
249-
"^(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<sharedflow_id>[^/]+)/(?P<revision>[^/]+)$",
247+
"organizations/(?P<org_id>[^/]+)/environments/(?P<environment>[^/]+)/sharedflows/(?P<sharedflow_id>[^/]+)/revisions/(?P<revision>[^/]+)",
248+
"(?P<org_id>[^/]+)/(?P<environment>[^/]+)/(?P<sharedflow_id>[^/]+)/(?P<revision>[^/]+)",
250249
}, d, config); err != nil {
251250
return nil, err
252251
}

google/services/bigquery/resource_bigquery_table.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3517,9 +3517,9 @@ func flattenSerDeInfo(si *bigquery.SerDeInfo) []map[string]interface{} {
35173517
func resourceBigQueryTableImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
35183518
config := meta.(*transport_tpg.Config)
35193519
if err := tpgresource.ParseImportId([]string{
3520-
"^projects/(?P<project>[^/]+)/datasets/(?P<dataset_id>[^/]+)/tables/(?P<table_id>[^/]+)$",
3521-
"^(?P<project>[^/]+)/(?P<dataset_id>[^/]+)/(?P<table_id>[^/]+)$",
3522-
"^(?P<dataset_id>[^/]+)/(?P<table_id>[^/]+)$",
3520+
"projects/(?P<project>[^/]+)/datasets/(?P<dataset_id>[^/]+)/tables/(?P<table_id>[^/]+)",
3521+
"(?P<project>[^/]+)/(?P<dataset_id>[^/]+)/(?P<table_id>[^/]+)",
3522+
"(?P<dataset_id>[^/]+)/(?P<table_id>[^/]+)",
35233523
}, d, config); err != nil {
35243524
return nil, err
35253525
}

google/services/bigtable/resource_bigtable_authorized_view.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ func resourceBigtableAuthorizedViewDestroy(d *schema.ResourceData, meta interfac
371371
func resourceBigtableAuthorizedViewImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
372372
config := meta.(*transport_tpg.Config)
373373
if err := tpgresource.ParseImportId([]string{
374-
"^projects/(?P<project>[^/]+)/instances/(?P<instance_name>[^/]+)/tables/(?P<table_name>[^/]+)/authorizedViews/(?P<name>[^/]+)$",
375-
"^(?P<project>[^/]+)/(?P<instance_name>[^/]+)/(?P<table_name>[^/]+)/(?P<name>[^/]+)$",
376-
"^(?P<instance_name>[^/]+)/(?P<table_name>[^/]+)/(?P<name>[^/]+)$",
374+
"projects/(?P<project>[^/]+)/instances/(?P<instance_name>[^/]+)/tables/(?P<table_name>[^/]+)/authorizedViews/(?P<name>[^/]+)",
375+
"(?P<project>[^/]+)/(?P<instance_name>[^/]+)/(?P<table_name>[^/]+)/(?P<name>[^/]+)",
376+
"(?P<instance_name>[^/]+)/(?P<table_name>[^/]+)/(?P<name>[^/]+)",
377377
}, d, config); err != nil {
378378
return nil, err
379379
}

google/services/bigtable/resource_bigtable_instance.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,9 +845,9 @@ func resourceBigtableInstanceClusterReorderTypeListFunc(diff tpgresource.Terrafo
845845
func resourceBigtableInstanceImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
846846
config := meta.(*transport_tpg.Config)
847847
if err := tpgresource.ParseImportId([]string{
848-
"^projects/(?P<project>[^/]+)/instances/(?P<name>[^/]+)$",
849-
"^(?P<project>[^/]+)/(?P<name>[^/]+)$",
850-
"^(?P<name>[^/]+)$",
848+
"projects/(?P<project>[^/]+)/instances/(?P<name>[^/]+)",
849+
"(?P<project>[^/]+)/(?P<name>[^/]+)",
850+
"(?P<name>[^/]+)",
851851
}, d, config); err != nil {
852852
return nil, err
853853
}

0 commit comments

Comments
 (0)