Skip to content

doc: Add OAuth examples for mongodbatlas_metric_integration - #4746

Open
marcabreracast wants to merge 5 commits into
dev/CLOUDP-412204_OAuth_Support_OTel_Metric_Sinkfrom
CLOUDP-445734_Add_OAuth_Examples_Metric_Integration
Open

marcabreracast wants to merge 5 commits into
dev/CLOUDP-412204_OAuth_Support_OTel_Metric_Sinkfrom
CLOUDP-445734_Add_OAuth_Examples_Metric_Integration

Conversation

@marcabreracast

@marcabreracast marcabreracast commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Description

Restructures the mongodbatlas_metric_integration examples into sibling directories and adds OAuth 2.0 examples alongside the existing header-based one:

  • header/ — the existing header-based (Datadog) example.
  • oauth/client_secret/ — export metrics using a shared client secret.
  • oauth/private_key_jwt/ — export metrics using an Atlas-managed private-key JWT signing assertion; register the returned jwks_uri with your identity provider.

Each example creates a MongoDB Atlas project and the metric integration, and reads it back with the singular and plural data sources. Regenerates the resource and data source docs to reference the new examples.

Link to any related issue(s): CLOUDP-445734

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fix and verified my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@marcabreracast marcabreracast changed the title docs: Add OAuth examples for mongodbatlas_metric_integration chore: Add OAuth examples for mongodbatlas_metric_integration Sep 18, 2026
@marcabreracast marcabreracast changed the title chore: Add OAuth examples for mongodbatlas_metric_integration doc: Add OAuth examples for mongodbatlas_metric_integration Sep 18, 2026
@marcabreracast
marcabreracast marked this pull request as ready for review September 18, 2026 15:08
@marcabreracast
marcabreracast requested review from a team as code owners September 18, 2026 15:08
Copilot AI lite review requested due to automatic review settings September 18, 2026 15:08
@github-actions

Copy link
Copy Markdown
Contributor

APIx bot: a message has been sent to Docs Slack channel

@augmentcode

augmentcode Bot commented Sep 18, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Reorganizes Metric Integration examples and documents OAuth authentication.

Changes:

  • Moves the existing Datadog header-authentication example into header/.
  • Adds a client-secret OAuth 2.0 OTEL metric-integration example.
  • Adds a private-key JWT OAuth 2.0 example with signing-key metadata output.
  • Both OAuth examples create a project, integration, and read it with singular and plural data sources.
  • Adds per-example READMEs with prerequisites, inputs, defaults, and lifecycle commands.
  • Updates the root example README to link to the sibling examples.
  • Regenerates resource and data-source documentation from updated templates.

Technical Notes: The OAuth configurations use CUSTOM/OTEL, OAUTH2, DELTA temporality, and Atlas Stream Processing metrics by default; client-secret input is marked sensitive.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread templates/resources/metric_integration.md.tmpl

Copilot AI 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.

🟡 Changes recommended

The rendered documentation omits the project resource, and the header example’s documented Datadog environment variables do not populate its Terraform variables.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Reorganizes metric integration examples and adds OAuth 2.0 client-secret and private-key JWT configurations.

Changes:

  • Splits the existing Datadog example into header/.
  • Adds two OAuth example flows with data-source readbacks.
  • Updates templates, generated documentation, and READMEs.
File summaries
File Description
templates/resources/metric_integration.md.tmpl Updates embedded example and links.
templates/data-sources/metric_integrations.md.tmpl Updates embedded example and links.
templates/data-sources/metric_integration.md.tmpl Updates embedded example and links.
examples/mongodbatlas_metric_integration/README.md Adds the example index.
examples/mongodbatlas_metric_integration/header/* Moves and documents the Datadog example.
examples/mongodbatlas_metric_integration/oauth/client_secret/* Adds client-secret OAuth configuration.
examples/mongodbatlas_metric_integration/oauth/private_key_jwt/* Adds private-key JWT OAuth configuration.
docs/resources/metric_integration.md Updates resource example links.
docs/data-sources/metric_integrations.md Updates plural data-source links.
docs/data-sources/metric_integration.md Updates singular data-source links.
Review details
  • Files reviewed: 18/23 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/mongodbatlas_metric_integration/header/README.md Outdated
Comment on lines +2 to +3
client_id = var.atlas_client_id
client_secret = var.atlas_client_secret
Comment on lines +2 to +3
client_id = var.atlas_client_id
client_secret = var.atlas_client_secret
Updated environment variable exports for Datadog API and app keys to use Terraform variable format.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@marcabreracast

Copy link
Copy Markdown
Collaborator Author

Docs Link Check failures are expected, as the examples are not available yet on the released version of the provider.


### Further Examples
- [Metric Integration Examples](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v2.18.0/examples/mongodbatlas_metric_integration)
- [Header-based](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v2.18.0/examples/mongodbatlas_metric_integration/header) — export using header-based authentication.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

export what? try to provide a title that leaves no room for the reader or llm to guess what you mean.

### Further Examples
- [Metric Integration Examples](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v2.18.0/examples/mongodbatlas_metric_integration)
- [Header-based](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v2.18.0/examples/mongodbatlas_metric_integration/header) — export using header-based authentication.
- [OAuth 2.0](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v2.18.0/examples/mongodbatlas_metric_integration/oauth) — export using OAuth 2.0 authentication.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

export what? see above.

@JuliaMongo JuliaMongo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM with a few suggestions.

@@ -0,0 +1,66 @@
# MongoDB Atlas Metric Integration with Datadog Example

This example demonstrates how to configure a metric integration to export MongoDB Atlas metrics to Datadog over OTLP. It also shows how to read the integration back with the singular and plural data sources.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

a metric integration that exports ....

new paragraph:
The example also shows ....


This example demonstrates how to configure a metric integration to export MongoDB Atlas metrics to Datadog over OTLP. It also shows how to read the integration back with the singular and plural data sources.

This example is specific to Datadog. To export to another provider, update `provider_type` (`CUSTOM`, `NEW_RELIC`, or `DYNATRACE`), the `endpoint`, and the authentication `headers` to match that provider.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To export what? metrics? Add this

add "the values for that provider", as in:
... to match the values for that provider.

export TF_VAR_datadog_app_key="<DATADOG_APP_KEY>"
```

Alternatively, follow as in the `variables.tf` file and create a **terraform.tfvars** file with all the variable values:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Did you mean: Alternatively, specify all the variable values in a single file, as shown in the following example of the variables.tf file:

If yes, please consider rewriting this


**2\. Review the Terraform plan.**

Execute the following command and confirm the plan's accuracy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Run the following command and ...

terraform plan
```

**3\. Execute the Terraform apply.**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here and elsewhere: Run is much shorter than execute. consider replacing all literal instruction text instances of execute with run. The scope is just this PR, don't expand scope. This can be gradually adopted as the practice over time.
This is just a suggestion and is optional.


**4\. Destroy the resources.**

When you have finished your testing, ensure you destroy the resources to avoid accruing charges in Atlas.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

in the sentence at least, suggest to use you delete... instead of destroy

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants