Open ScottSuarez opened 3 years ago
~It may not be possible to always autogenerate this, but we could almost certainly autogenerate the trivial case.~
Correction: this is extracting the id rather than autogenerating it from vars or similar, so this probably would work automatically for all resources.
@ScottSuarez do you remember the details of the changes you were proposing here? We reviewed this and couldn't figure out what the delta on an existing resource would be.
I believe the goal here would be to eliminate lines like https://github.com/GoogleCloudPlatform/magic-modules/blob/ca3b14e9c32eac9356cd050ecc428f5df5f04fa2/mmv1/products/apigee/Environment.yaml#L66, which are a common cause of errors on PRs (because they require understanding exactly how primary_resource_name is used and properly escaping the string).
related: https://github.com/hashicorp/terraform-provider-google/issues/13983
Ah- primary_resource_name
is distinct from primary_resource_id
, right.
Just ran into this again on https://github.com/GoogleCloudPlatform/magic-modules/pull/10670 - this ended up causing several rounds of extra review.
If there is any usage of primary_resource_name
left, we should rename the field as discussed in https://github.com/hashicorp/terraform-provider-google/issues/13983
ran into this again on https://github.com/GoogleCloudPlatform/magic-modules/pull/10786 - the contributor skipped import tests to avoid the issue, which would have caused bugs in the import_format to be missed.
Affected Resource(s)
Community Note
Description
Currently you must manually supply MMv1 with
primary_resource_name
and construct the import case for the first example. We should be able to avoid this by auto generating the import id by parsing the id from the current state of the resource by usingImportStateIdFunc
New or Affected Resource(s)
Potential Test Configuration
References