Repository navigation
test: Add required cloud tags to AWS resources in acceptance tests - #4763
marcabreracast wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The shared configuration is valid and consistently covers all acceptance-test AWS resource definitions.
Review effort: Balanced
Findings: None
What changed in this PR
Adds mandatory AWS cloud tags to acceptance-test resources through shared provider configuration helpers.
Changes:
- Adds configurable
mongodb-ownerandmongodb-envdefault tags. - Applies tagged AWS provider configuration across affected acceptance tests.
- Preserves existing provider settings such as regions and credentials.
| File | Description |
|---|---|
internal/testutil/acc/provider.go |
Adds shared AWS default-tag helpers. |
internal/testutil/acc/encryption_at_rest.go |
Tags AWS IAM resources. |
internal/serviceapi/pushbasedlogexportapi/resource_test.go |
Tags IAM and S3 resources. |
internal/serviceapi/logintegration/resource_test.go |
Tags IAM and S3 resources. |
internal/service/streamconnection/resource_stream_connection_test.go |
Tags AWS access roles. |
internal/service/pushbasedlogexport/resource_test.go |
Tags IAM and S3 resources. |
internal/service/privatelinkendpointservice/resource_test.go |
Adds tags to the existing AWS provider. |
internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go |
Tags networking resources. |
internal/service/federatedquerylimit/resource_federated_query_limit_test.go |
Tags AWS IAM resources. |
internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go |
Tags IAM, VPC, subnet, and endpoint resources. |
internal/service/federateddatabaseinstance/data_source_federated_database_instances_test.go |
Tags plural data-source test resources. |
internal/service/federateddatabaseinstance/data_source_federated_database_instance_test.go |
Tags singular data-source test resources. |
internal/service/cluster/resource_cluster_test.go |
Adds tags to existing AWS provider configurations. |
internal/service/cloudprovideraccess/resource_cloud_provider_access_authorization_test.go |
Tags cloud-access IAM resources. |
internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go |
Tags export-job AWS resources. |
internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket_test.go |
Tags export-bucket IAM resources. |
internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go |
Tags backup export resources. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Heads-up for reviewers: the CI acceptance test failures are expected for now. The tests now tag the AWS 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. |
🤖 Augment PR SummarySummary: This PR prepares AWS-backed acceptance tests for the upcoming Cloud Tag Policy. Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
| tagOwnerEnvVar = "MONGODB_TAG_OWNER" | ||
| tagEnvEnvVar = "MONGODB_TAG_ENV" | ||
| defaultTagOwner = "api-experience-integrations-team@mongodb.com" | ||
| defaultTagEnv = "test" |
There was a problem hiding this comment.
I assume we are fine with having same tag values for both CI and local test runs? should we add MONGODB_TAG_OWNER and MONGODB_TAG_ENV as GH secrets/variables? and use the env vars in https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/.github/workflows/acceptance-tests.yml?
| if v := os.Getenv(envVar); v != "" { | ||
| return v | ||
| } | ||
| if os.Getenv("TF_ACC") == "" { |
There was a problem hiding this comment.
Without TF_ACC, configs are constructed but never applied, so return a placeholder to keep unit tests independent of the tag env vars. With TF_ACC=1, fail fast when the variable is unset.
4f752f1 to
992288a
Compare
|
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! |
Description
The upcoming Cloud Tag Policy requires
mongodb-ownerandmongodb-envtags on AWS resources. Our acceptance tests create AWS resources (IAM roles, S3 buckets, VPCs, etc.), so these tests would start failing once enforcement begins.This PR tags all AWS resources created by acceptance tests by adding a
provider "aws"block withdefault_tagsto the test configs that don't already define one. Tag values come from theMONGODB_TAG_OWNER/MONGODB_TAG_ENVenv vars, defaulting to the team email andtestfor local runs.Link to any related issue(s): CLOUDP-441536
Type of change:
Required Checklist:
Further comments
TestAccEncryptionAtRest_basicAWSis skipped in CI, and was executed locally to verify it's working as expected:The
mongodbatlas_log_integrationS3 bucket case (ignore_changes = [tags, tags_all]) was verified with a live repro: default tags are applied at bucket creation and follow-up plans show no drift. Additionally, acceptance tests are also passing locally: