Skip to content

Add google_apigee_data_collector resource#16954

Merged
NickElliot merged 4 commits into
GoogleCloudPlatform:mainfrom
ogormans-deptstack:feat/apigee-datacollector
May 11, 2026
Merged

Add google_apigee_data_collector resource#16954
NickElliot merged 4 commits into
GoogleCloudPlatform:mainfrom
ogormans-deptstack:feat/apigee-datacollector

Conversation

@ogormans-deptstack

Copy link
Copy Markdown
Contributor

Adds the google_apigee_data_collector resource to the Google provider, enabling Terraform management of Apigee DataCollectors for custom analytics and API monetization.

This is a rewrite of #11655, which was opened under the old Ruby generator format. As noted by @rileykarson in that PR, the generator has since moved to Go with generic YAML types. This PR follows the current conventions.

Resource Details

  • API: apigee.googleapis.com/v1/organizations/{org}/datacollectors
  • Operations: Create, Read, Update (PATCH with updateMask), Delete, Import
  • Fields:
    • org_id (required, immutable) - Apigee organization
    • data_collector_id (required, immutable) - Must begin with dc_, validated via regex
    • type (required, immutable) - Enum: INTEGER, FLOAT, STRING, BOOLEAN, DATETIME
    • description (optional, mutable) - Only updatable field
    • name, created_at, last_modified_at (computed, output-only)

Testing

Built the provider locally and tested all CRUD operations against a real Apigee eval organization:

Operation Result
Create 2 data collectors (INTEGER, STRING types) created successfully
Read No drift on re-plan
Update Description updated via PATCH
Import Full path format (organizations/{org}/datacollectors/{id}) works
Delete Clean destruction with correct dependency ordering

Files

  • mmv1/products/apigee/DataCollector.yaml - Resource definition
  • mmv1/templates/terraform/custom_import/apigee_data_collector.go.tmpl - Import logic for org-scoped resources
  • mmv1/templates/terraform/examples/apigee_data_collector_basic.tf.tmpl - Docs example
  • mmv1/templates/terraform/examples/apigee_data_collector_basic_test.tf.tmpl - Acceptance test example

Modeled on existing Apigee resources (AppGroup, Envgroup) for consistency.

`google_apigee_data_collector`

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 4, 2026
@google-cla

google-cla Bot commented Apr 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions

github-actions Bot commented Apr 4, 2026

Copy link
Copy Markdown

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

@NickElliot, 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 NickElliot April 4, 2026 23:52
@ogormans-deptstack

Copy link
Copy Markdown
Contributor Author

I signed the CLA after the fact please rerun

@ogormans-deptstack

Copy link
Copy Markdown
Contributor Author

I signed the CLA after the fact please rerun

#16955 passed on my other contribution so we should be good

@modular-magician modular-magician added service/apigee and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Apr 7, 2026
@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 911 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 911 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 135 insertions(+))

@modular-magician

Copy link
Copy Markdown
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample

Tests analytics

Total tests: 73
Passed tests: 33
Skipped tests: 38
Affected tests: 2

Click here to see the affected service packages
  • apigee

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample
  • TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample

Get to know how VCR tests work

@modular-magician

Copy link
Copy Markdown
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample [Error message] [Debug log]
TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

@NickElliot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@github-actions

Copy link
Copy Markdown

@GoogleCloudPlatform/terraform-team @NickElliot This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@NickElliot NickElliot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for delays I was on PTO!
Could you share logs of the tests running locally?

@ogormans-deptstack

Copy link
Copy Markdown
Contributor Author

@NickElliot just wanted to flag the CI status here — all checks pass cleanly:

  • terraform-provider-google unit tests
  • terraform-provider-google-beta unit tests
  • terraform-google-conversion compile + unit tests
  • breaking-change-test, lint-yaml, disallow-large-prs, docs-examples
  • ✅ Generation for all three downstreams

The only red is the VCR test — which failed on TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample, an existing Apigee Organization test unrelated to this PR. Our DataCollector test is VCR-skipped since Apigee resources require a live org with provisioned runtime.

I've also addressed the same class of review feedback that @zli82016 raised on the sibling PR #16955 (vars for hardcoded names, update tests, sweeper/VCR skip explanations) — happy to apply any of those patterns here too if you'd like.

Let me know if you have any questions or feedback.

@github-actions github-actions Bot requested a review from NickElliot April 15, 2026 18:25
@ogormans-deptstack

Copy link
Copy Markdown
Contributor Author

Local acceptance test results

Full CRUD lifecycle test against a live GCP Apigee org (EVALUATION tier, us-central1):

=== RUN   TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample
=== PAUSE TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample
=== CONT  TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample
--- PASS: TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample (936.55s)
PASS
ok  	github.com/hashicorp/terraform-provider-google/google/services/apigee	937.658s

Test provisions a new GCP project, enables APIs, creates a compute network + service networking connection, provisions an Apigee org, creates the data collector, verifies the import step, then tears everything down. ~15 minutes end-to-end, all steps clean.

NickElliot
NickElliot previously approved these changes Apr 16, 2026

@NickElliot NickElliot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for the test results because both of the added tests are skipped/excluded, I am aware the checks were all green :)

LGTM!

@NickElliot NickElliot added this pull request to the merge queue Apr 16, 2026
@NickElliot NickElliot removed this pull request from the merge queue due to a manual request Apr 16, 2026
@NickElliot NickElliot self-requested a review April 16, 2026 18:58
@NickElliot NickElliot dismissed their stale review April 16, 2026 18:58

missed detail

@NickElliot NickElliot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked other apigee tests and saw we are able to provision Orgs within those tests without skipping them in CI/VCR e.g. TestAccApigeeOrganization_apigeeOrganizationCloudBasicTestExample, is there any reason we can't do the same here?

@ogormans-deptstack

Copy link
Copy Markdown
Contributor Author

Thanks for the review @NickElliot, and no worries about the PTO!

Good question on VCR. I initially added skip_vcr because the Apigee org provisioning is heavy (15+ min, new project + VPC peering + org creation) and I wasn't confident the API responses would replay cleanly — the datastore name field is a server-assigned UUID that changes each run, and the org provisioning involves async operations that can vary in timing.

That said, you're right that the Organization test itself runs without skipping VCR, and other resources like EndpointAttachment don't skip either. I'll remove skip_vcr and push — if CI's VCR recording handles it cleanly, that's the better path. If not, we'll have concrete evidence for why it's needed.

Will push shortly.

@github-actions github-actions Bot requested a review from NickElliot May 5, 2026 13:23
@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels May 5, 2026
@modular-magician

modular-magician commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit c2bbd2f:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 4 files changed, 922 insertions(+)
google-beta provider View Diff 4 files changed, 922 insertions(+)
terraform-google-conversion View Diff 1 file changed, 135 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
76 35 38 3
Affected Service Packages
  • apigee

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample
  • TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample
  • TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample

View the build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample
❌ Error · Log - TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample
❌ Error · Log - TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the build log or the debug logs folder for detailed results.

@ogormans-deptstack, @NickElliot VCR tests complete for c2bbd2f!

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

@NickElliot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

- Remove exclude_sweeper to enable resource cleanup
- Use vars for network_name and range_name in doc template
@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels May 8, 2026
@modular-magician

modular-magician commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 0d3c2b0:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 4 files changed, 922 insertions(+)
google-beta provider View Diff 4 files changed, 922 insertions(+)
terraform-google-conversion View Diff 1 file changed, 135 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
76 36 38 2
Affected Service Packages
  • apigee

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample
  • TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample

View the build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample
❌ Error · Log - TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the build log or the debug logs folder for detailed results.

@ogormans-deptstack, @NickElliot VCR tests complete for 0d3c2b0!

@ogormans-deptstack

Copy link
Copy Markdown
Contributor Author

@NickElliot VCR results are in and the DataCollector tests look clean.

VCR replay (Step 1): Only 2 tests were flagged as affected — both are the pre-existing TestAccApigeeOrganization_apigeeOrganizationCloud*DisableVpcPeeringTestExample tests. Our DataCollector test (TestAccApigeeDataCollector_apigeeDataCollectorBasicTestExample) passed replay and is not in the affected list.

VCR recording (Step 2): The only failures are those same 2 pre-existing Organization tests — they fail on every Apigee PR (same failures appear on #16955 and #16957, and on other Apigee PRs from before our changes).

So to summarize:

  • DataCollector VCR: passing
  • Local acceptance test: passing (936s full CRUD lifecycle)
  • All unit tests and generation: passing
  • skip_vcr and exclude_sweeper removed per your feedback
  • Only red is the pre-existing Organization test, which is unrelated to this resource

Happy to address any other concerns. This one should be ready for approval.

@NickElliot NickElliot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thanks for adding the tests!

@NickElliot NickElliot added this pull request to the merge queue May 11, 2026
Merged via the queue into GoogleCloudPlatform:main with commit e1b97d6 May 11, 2026
24 of 25 checks passed
pragya644 pushed a commit to pragya644/magic-modules that referenced this pull request May 12, 2026
inadenenko pushed a commit to inadenenko/magic-modules that referenced this pull request May 12, 2026
inadenenko pushed a commit to inadenenko/magic-modules that referenced this pull request May 12, 2026
gitika-yadav pushed a commit to gitika-yadav/magic-modules that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants