Skip to content

fix: adds missing DatabaseRegex field when creating FederatedDataSource #1486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

marcosuma
Copy link
Collaborator

Description

Please include a summary of the fix/feature/change, including any relevant motivation and context.

Link to any related issue(s): https://jira.mongodb.org/browse/HELP-49694

Testing

This .tf extract:

[.....]
resource "mongodbatlas_federated_database_instance" "test" {
  project_id = var.project_id
  name       = var.name
  cloud_provider_config {
    aws {
      role_id        = mongodbatlas_cloud_provider_access_authorization.auth_role.role_id
      test_s3_bucket = var.test_s3_bucket
    }
  }
  storage_databases {
    name = "test_storage_databases"
    collections {
      name = "test_collections"
      data_sources {
        collection = var.collection 
        database_regex =  ".TestDB"
        store_name = var.atlas_cluster_name
        urls = []
      }
    }
  }

[.....]

was not working before, it was returning an error like:

Error: error creating MongoDB Atlas Federated Database Instace: https://cloud.mongodb.com/api/atlas/v2/groups/603f66d365f0154b5b1754ac/dataFederation POST: HTTP 400 Bad Request (Error code: "DATA_FEDERATION_STORAGE_CONFIG_INVALID") Detail: Data Federation storage config invalid. Reason: Bad Request. Params: [Federated Database Instance storage config invalid (errors: [[database 'VirtualDatabase0': collection 'test1': dataSource 0: either database or databaseRegex must be specified unless a wildcard database name is in use]]).]

Now it succeeds.

While investigating customer's issue, I found out that the field DatabaseRegex was being missed when creating a new..DataSource. This seems like a bug when creating the method

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.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • 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 fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.

Further comments

@marcosuma marcosuma added the bug label Sep 20, 2023
@marcosuma marcosuma requested a review from a team as a code owner September 20, 2023 14:36
@marcosuma marcosuma merged commit f41aa23 into master Sep 20, 2023
@marcosuma marcosuma deleted the HELP-49694-database_regex_not_working branch September 20, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants