-
Notifications
You must be signed in to change notification settings - Fork 2.3k
apigee: fix google_apigee_endpoint_attachment import panic#17941
Open
xuchenma wants to merge 1 commit into
Open
apigee: fix google_apigee_endpoint_attachment import panic #17941xuchenma wants to merge 1 commit into
xuchenma wants to merge 1 commit into
Conversation
The custom import used tpgresource.ParseImportId with a "(?P<name>.+)" regex
solely to load the full import id into the output-only `name` attribute. Now
that ParseImportId also populates the resource identity, it called
identity.Set("name", ...) -- but `name` is not part of the endpoint
attachment's identity schema -- causing a hard panic
("Invalid address to set: name") on every import. This made
TestAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExample fail
100% in nightly (ga and beta).
Set the import id directly on `name` with d.Set("name", d.Id()) instead,
preserving the existing parsing of org_id / endpoint_attachment_id while avoiding
the identity-set path.
Fixes hashicorp/terraform-provider-google#27404
BUG=513957540
Signed-off-by: Xuchen Ma <xuchenm@google.com>
@modular-magician
modular-magician
added
the
awaiting-approval
Pull requests that need reviewer's approval to run presubmit tests
label
Jun 11, 2026
Googlers: For automatic test runs see go/terraform-auto-test-runs.
@malhotrasagar2212, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.
You can help make sure that review is quick by doing a self-review and by running impacted tests locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExamplefails 100% in nightly (ga and beta) with a provider panic during import:Root cause
The custom import called
tpgresource.ParseImportId([]string{"(?P<name>.+)"}, ...)purely to load the full import id into the output-onlynameattribute for parsing.ParseImportIdnow also populates the resource identity for each captured group, so it calledidentity.Set("name", ...).nameis not part of this resource's identity schema, so the SDK panics.Fix
Replace the
ParseImportIdcall withd.Set("name", d.Id()). This keeps the exact same downstream parsing oforg_id/endpoint_attachment_idfromname, but avoids routing a non-identity field through the identity-setting path.(Note:
ParseImportIdwill panic for any resource whose custom import regex captures a field that isn't in the identity schema — a more general guard there may be worth a follow-up, but this change is scoped to the failing Apigee resource.)Test evidence
(Previously: panic on the import step.)
Fixes hashicorp/terraform-provider-google#27404