Skip to content

apigee: fix org_id doubled prefix in google_apigee_sharedflow#16947

Open
xuchenma wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
xuchenma:478035977
Open

apigee: fix org_id doubled prefix in google_apigee_sharedflow#16947
xuchenma wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
xuchenma:478035977

Conversation

@xuchenma
Copy link
Copy Markdown
Contributor

@xuchenma xuchenma commented Apr 4, 2026

Description

Fixes a bug where using google_apigee_organization.id as org_id in google_apigee_sharedflow caused a doubled organizations/ prefix in the API URL, resulting in 404 errors.

google_apigee_organization.id returns "organizations/<project-id>". The resource URL template is organizations/{{org_id}}/sharedflows, so when the full value is substituted it becomes organizations/organizations/<project-id>/sharedflows.

Fix: Added a StateFunc and DiffSuppressFunc to the org_id field that strip the organizations/ prefix if present, so both bare project IDs and fully-qualified organization IDs work correctly.

Fixes: hashicorp/terraform-provider-google#25876

Tests

TestAccApigeeSharedFlow_apigeeSharedflowTestExample passed locally (1138s):

--- PASS: TestAccApigeeSharedFlow_apigeeSharedflowTestExample (1138.23s)
PASS
apigee: fixed `google_apigee_sharedflow` `org_id` accepting `organizations/` prefix to prevent doubled prefix in API URL

When users reference google_apigee_organization.id as org_id, the value
already contains the 'organizations/' prefix (e.g. 'organizations/my-project').
The URL template then doubles it to 'organizations/organizations/my-project',
causing API 404 errors.

Fix by adding a StateFunc and DiffSuppressFunc to the org_id field that strip
the 'organizations/' prefix if present, allowing both bare project IDs and
fully-qualified organization IDs to be used interchangeably.

Fixes: hashicorp/terraform-provider-google#25876
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 4, 2026

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@zli82016, 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.

@github-actions github-actions bot requested a review from zli82016 April 4, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when setting google_apigee_sharedflow.org_id

2 participants