Visitar URL original
test: Add required cloud tags to Azure resources in acceptance tests by marcabreracast · Pull Request #4771 · mongodb/terraform-provider-mongodbatlas · GitHub
Skip to content

test: Add required cloud tags to Azure resources in acceptance tests - #4771

Open
marcabreracast wants to merge 3 commits into
CLOUDP-441536-tag-test-cloud-resourcesfrom
CLOUDP-441536_Tag_Cloud_Resources_Azure
Open

marcabreracast wants to merge 3 commits into
CLOUDP-441536-tag-test-cloud-resourcesfrom
CLOUDP-441536_Tag_Cloud_Resources_Azure

Conversation

@marcabreracast

@marcabreracast marcabreracast commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The upcoming Cloud Tag Policy requires mongodb-owner and mongodb-env tags on Azure resources. Our acceptance tests create Azure resources (resource groups, storage accounts, etc.), so these tests would start failing once enforcement begins.

This PR tags all Azure resources created by acceptance tests by setting tags on the resources directly (azurerm does not support provider-level default_tags). Tag values come from the MONGODB_TAG_OWNER / MONGODB_TAG_ENV env vars, defaulting to the team email and test for local runs.

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

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

Stacked on #4763, merge that one first.

Note: azurerm does not support provider-level default_tags (hashicorp/terraform-provider-azurerm#13776), so tags are set on each resource instead.

Verified via scoped CI runs: TestAccLogIntegration_basicAzure and TestAccStreamRSStreamConnection_AzureBlobStorage(PrivateLink) pass with tagged resources.

The CI-skipped TestAccStreamPrivatelinkEndpointAzureBlobStorage_basic was executed locally to verify it's working as expected:

=== RUN   TestAccStreamPrivatelinkEndpointAzureBlobStorage_basic
    resource_test.go:204: Creating execution project (1): test-acc-tf-p-1099049023052102351
--- PASS: TestAccStreamPrivatelinkEndpointAzureBlobStorage_basic (2128.00s)
PASS


// ConfigTags returns the Cloud Tag Policy tags as a resource-level tags attribute.
// azurerm does not support provider-level default_tags, so Azure resources set tags individually: https://github.com/hashicorp/terraform-provider-azurerm/issues/13776.
func ConfigTags() string {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a temporary resolution. Once default_tags are supported, we should be able to remove this method and reuse ConfigDefaultTags() for both AWS and Azure

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should we create a CLOUDP to track this follow up work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sure, created CLOUDP-454792 to track this

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.

Copilot review overview

🟢 Approval recommended

All taggable Azure resources created by the affected acceptance-test helpers receive the required policy tags.

Review effort: Balanced
Findings: None

What changed in this PR

Adds mandatory Azure cloud-policy tags to resources created by acceptance tests.

Changes:

  • Adds a reusable resource-level Azure tags helper.
  • Tags Azure resource groups and storage accounts in shared test configurations.
File Description
internal/​testutil/​acc/​provider.go Adds the shared tag configuration helper.
internal/​testutil/​acc/​cloud_provider_access.go Tags shared Azure storage infrastructure.
internal/​testutil/​acc/​stream_privatelink_endpoint.go Tags Azure Blob Storage test resources.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@marcabreracast

marcabreracast commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Heads-up for reviewers: the CI acceptance test failures are expected for now. The tests now tag the Azure resources they create (required by the Cloud Tag Policy), but the CI users don't yet have tagging permissions, tracked in CLOUDP-451854. Looking for early feedback on the approach in the meantime, and won't merge until the permissions are in place and the tests run green.

@marcabreracast
marcabreracast marked this pull request as ready for review September 30, 2026 10:23
@marcabreracast
marcabreracast requested a review from a team as a code owner September 30, 2026 10:23
@marcabreracast
marcabreracast added this pull request to stack #4775 September 30, 2026 10:23
@augmentcode

augmentcode Bot commented Sep 30, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds resource-level Cloud Tag Policy tags to Azure resource groups and storage accounts generated by acceptance-test helpers.
Why: Ensures Azure resources created during acceptance tests include mongodb-owner and mongodb-env, using environment overrides with local-test defaults because azurerm lacks provider-level default tags.

🤖 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. No suggestions at this time.

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

@marcabreracast
marcabreracast force-pushed the CLOUDP-441536_Tag_Cloud_Resources_Azure branch from 642854f to fddd4da Compare September 30, 2026 13:50
@svc-apix-Bot

Copy link
Copy Markdown
Contributor

This PR has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!

@marcabreracast marcabreracast added the not_stale Not stale issue or PR label Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not_stale Not stale issue or PR stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants