Skip to content

Add cosmos-db version 2026-03-15 and fix error when user specified resource ID is incorrectly identified as known segments used for scope#5486

Open
v-yhyeo0202 wants to merge 2 commits into
hashicorp:mainfrom
v-yhyeo0202:cosmos-db-2026-03-15
Open

Add cosmos-db version 2026-03-15 and fix error when user specified resource ID is incorrectly identified as known segments used for scope#5486
v-yhyeo0202 wants to merge 2 commits into
hashicorp:mainfrom
v-yhyeo0202:cosmos-db-2026-03-15

Conversation

@v-yhyeo0202

@v-yhyeo0202 v-yhyeo0202 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

cosmos-db API version 2026-03-15 is added for hashicorp/terraform-provider-azurerm#31546. In this version, the typical SDK generation fails due to duplicated resource IDs of Cassandra, Gremlin, Mongo MI, SQL, and table role assignment as shown in the log below. The error happens because of identification of roleAssignmentId user specified segment and its corresponding static segment as scope segment, causing the segments to be excluded when deciding if the resource IDs are unique. As scope segment only appears at the start of resource ID and not after static segment, conditional statements are added to avoid the incorrect identification of scope segment.

Error: parsing Data for the Service "CosmosDB": parsing Data for Service "CosmosDB": parsing "CosmosDB" API Version "2026-03-15": parsing the Resource IDs from "/home/v-yyeo/pandora/submodules/rest-api-specs/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/DocumentDB/stable/2026-03-15/openapi.json": finding Resource IDs: generating Names for Resource IDs: determining unique names for conflicting uri's "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId} | /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleAssignments/{roleAssignmentId} | /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinRoleAssignments/{roleAssignmentId} | /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongoMIRoleAssignments/{roleAssignmentId} | /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraRoleAssignments/{roleAssignmentId}": not enough segments in "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleAssignments/{roleAssignmentId}" to determine a unique name - conflicts with "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"

PR Checklist

  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so, please include appropriate closing keywords below.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.

Adding New API Version

Important

The primary purpose of API versions in this repository is to serve the Terraform Azure Providers. API versions are imported and maintained to support the providers' needs. If you would like to add an API version for use outside of the providers (e.g., another project consuming go-azure-sdk), please include a description of what you would like to use it for so we can evaluate the request.

  • I have verified the Service/API Version exists in the Azure REST API Specs.
  • I have followed the Service Import Guide.
  • This PR is for another downstream project and not for the Terraform Azure Providers.

Changes to Tooling

  • I have added an explanation of what my changes do and why I'd like you to include them.
  • I have written new tests for my changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges.

Testing Command(s) Used:

cd ~/pandora/tools/importer-rest-api-specs
go test -v ./internal/components/apidefinitions/parser/resourceids/ -run TestParseResourceIDFromOperation

Testing Evidence:

Tests in pandora/tools/importer-rest-api-specs/internal/components/apidefinitions/parser/resourceids/parse_segments_test.go are run.

--- PASS: TestParseResourceIDFromOperation_ConstantSingle (0.00s)
--- PASS: TestParseResourceIDFromOperation_ResourceGroupId_IncorrectSegment (0.00s)
--- PASS: TestParseResourceIDFromOperation_InvalidSegmentDefaultAsStaticValueGetsLeft (0.00s)
--- PASS: TestParseResourceIDFromOperation_InvalidSegmentDefaultGetsTransformed (0.00s)
--- PASS: TestParseResourceIDFromOperation_InvalidSegmentTypeGetsTransformed (0.00s)
--- PASS: TestParseResourceIDFromOperation_ConstantMultiple (0.00s)
--- PASS: TestParseResourceIDFromOperation_ResourceGroupId (0.00s)
--- PASS: TestParseResourceIDFromOperation_ManagementGroupId (0.00s)
--- PASS: TestParseResourceIDFromOperation_UriSuffixOnly (0.00s)
--- PASS: TestParseResourceIDFromOperation_UserSpecifiedResourceIdSameAsKnownSegmentsUsedForScope (0.00s)
--- PASS: TestParseResourceIDFromOperation_SubscriptionId (0.00s)
--- PASS: TestParseResourceIDFromOperation_Scope (0.00s)
--- PASS: TestParseResourceIDFromOperation_UserAssignedIdentityId (0.00s)

Note

If this PR changes meaningfully during the course of review, please update the title and description as required.

@v-yhyeo0202 v-yhyeo0202 changed the title Add cosmos-db version 2026-03-15 Add cosmos-db version 2026-03-15 and fix error when user specified resource ID is incorrectly identified as known segments used for scope Jul 9, 2026
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.

1 participant