Skip to content

chore: Add resource schema hooks and fix ip access list semantics - #4679

Open
laylaazouz wants to merge 4 commits into
CLOUDP-411233-mcp-configfrom
CLOUDP-411233-ip-access-list-fixes
Open

chore: Add resource schema hooks and fix ip access list semantics#4679
laylaazouz wants to merge 4 commits into
CLOUDP-411233-mcp-configfrom
CLOUDP-411233-ip-access-list-fixes

Conversation

@laylaazouz

@laylaazouz laylaazouz commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Converts ip_access_list on mongodbatlas_mcp_config and
    mongodbatlas_project_mcp_config (and their data sources) from a list to
    a set
  • adds resource schema hooks to make it behave correctly against
    the Atlas API.
    Link to any related issue(s):

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

@laylaazouz laylaazouz changed the title feat: add resoruce schema hooks feat: Add resource schema hooks Aug 26, 2026
@laylaazouz laylaazouz changed the title feat: Add resource schema hooks chore: Add resource schema hooks Aug 26, 2026
@laylaazouz laylaazouz changed the title chore: Add resource schema hooks chore: Add resource schema hooks and fix ip access list semantics Aug 26, 2026
@github-actions github-actions Bot added the bug label Aug 26, 2026
@laylaazouz
laylaazouz marked this pull request as ready for review August 26, 2026 13:05
@laylaazouz
laylaazouz requested review from a team as code owners August 26, 2026 13:05
@github-actions

Copy link
Copy Markdown
Contributor

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

@augmentcode

augmentcode Bot commented Aug 26, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR aligns MCP configuration IP access-list handling with the API's unordered semantics.

Changes:

  • Converts MCP configuration IP access lists from nested lists to nested sets in resources and data sources.
  • Regenerates schemas, models, and documentation to expose the attributes as sets.
  • Adds resource schema hooks requiring exactly one of ip_address or cidr_block per entry.
  • Adds a set plan modifier so API-recreated computed entry fields are replanned as unknown on updates.
  • Normalizes echoed IPv4 host CIDRs out of PATCH request bodies.
  • Updates acceptance assertions to test unordered nested-set entries, including a multi-entry project case.
  • Moves project-scoped MCP tests to execution-created projects and makes org cleanup tolerate already-deleted configurations.
Technical Notes: The set conversion addresses unstable API ordering and avoids inconsistent-result errors after multi-entry updates.

🤖 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.

}
ip, hasIP := entry["ipAddress"].(string)
cidr, hasCIDR := entry["cidrBlock"].(string)
if hasIP && hasCIDR && ip != "" && cidr == ip+"/32" {

@augmentcode augmentcode Bot Aug 26, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

At internal/serviceapi/mcpconfig/resource_custom_hooks.go:64, this only recognizes an echoed IPv4 host CIDR (/32), but ip_address also supports IPv6, whose equivalent echoed CIDR is /128. A subsequent update of an IPv6-backed configuration can therefore submit both fields, which the API rejects as mutually exclusive.

Severity: medium

Other Locations
  • internal/serviceapi/projectmcpconfig/resource_custom_hooks.go:64

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@erabil-mdb erabil-mdb 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!

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