Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

apigee: fix google_apigee_endpoint_attachment import panic#17941

Open
xuchenma wants to merge 1 commit into
GoogleCloudPlatform:main from
xuchenma:b513957540-endpointattachment-import
Open

apigee: fix google_apigee_endpoint_attachment import panic #17941
xuchenma wants to merge 1 commit into
GoogleCloudPlatform:main from
xuchenma:b513957540-endpointattachment-import

Conversation

@xuchenma

@xuchenma xuchenma commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

TestAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExample fails 100% in nightly (ga and beta) with a provider panic during import:

panic: Invalid address to set: []string{"name"}
 .../helper/schema/identity_data.go:74
 .../tpgresource/import.go:72
 apigee.resourceApigeeEndpointAttachmentImport (resource_apigee_endpoint_attachment.go:420)

Root cause

The custom import called tpgresource.ParseImportId([]string{"(?P<name>.+)"}, ...) purely to load the full import id into the output-only name attribute for parsing. ParseImportId now also populates the resource identity for each captured group, so it called identity.Set("name", ...). name is not part of this resource's identity schema, so the SDK panics.

Fix

Replace the ParseImportId call with d.Set("name", d.Id()). This keeps the exact same downstream parsing of org_id / endpoint_attachment_id from name, but avoids routing a non-identity field through the identity-setting path.

(Note: ParseImportId will 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

--- PASS: TestAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExample (1183.83s)

(Previously: panic on the import step.)

Fixes hashicorp/terraform-provider-google#27404

apigee: fixed a panic when importing `google_apigee_endpoint_attachment`

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

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@malhotrasagar2212 malhotrasagar2212 Awaiting requested review from malhotrasagar2212

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

awaiting-approval Pull requests that need reviewer's approval to run presubmit tests

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Failing test(s): TestAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExample

AltStyle によって変換されたページ (->オリジナル) /