pulumi-azure-native
pulumi-azure-native copied to clipboard
Autonaming - CosmosDB SqlResourceSqlDatabase seems impossible to be autonamed
What happened?
The resource SqlResourceSqlDatabase required the argument resource.id explained here in the documentation with a comment "Name of the Cosmos DB SQL database".
I have no way of knowing what will be generated by the Pulumi autonaming engine.
Example
Autonaming configuration:
pulumi:autonaming:
value:
pattern: ${name}-${alphanum(1)}
When I try putting the same value to the resources logical name as in the resource.id argument, I'm getting:
error: Status=400 Code="BadRequest" Message="{"code":"BadRequest","message":"Resource name Data-1 in request-uri does not match Resource name Data in request-body.\r\nActivityId: b41323cd-e4d2-4106-9459-4ca087b655a0, Microsoft.Azure.Documents.Common/2.14.0"}"
Output of pulumi about
CLI Version 3.197.0 Go Version go1.25.1 Go Compiler gc
Plugins KIND NAME VERSION language nodejs 3.197.0
Host OS Microsoft Windows 11 Enterprise Version 10.0.26100 Build 26100 Arch x86_64
This project is written in nodejs: executable='C:\Program Files\nodejs\node.exe' version='v24.8.0'
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
FYI the same goes for the SqlResourceSqlContainer resource type (I dont think it would be a good idea to create a separate issue for that).
@JiriKovar can you please include a self-contained program which reproduces the issue?
@JiriKovar can you please include a self-contained program which reproduces the issue?
Hi @blampe ,
not sure what "self-contained program" means in the context of the Pulumi, but here is a repro: https://github.com/JiriKovar/PulumiReproAutonamingSqlResourceSqlDatabase
Steps:
- download repo
az loginnpm installpulumi stack init testpulumi up --yes --skip-preview- see error:
azure-native:cosmosdb:SqlResourceSqlDatabase (repro-db):
error: Status=400 Code="BadRequest" Message="{"code":"BadRequest","message":"Resource name repro-db-f in request-uri does not match Resource name repro-db in request-body.\r\nActivityId: e3e89657-5d82-4c26-97ad-3bec6e9a4297, Microsoft.Azure.Documents.Common/2.14.0"}"
The issue is the required id field on the line 31 and its inconsistency with the autonamed cloud name (hence autonaming not possible).
The az-native provider does have support for propagating the auto-name e.g. to sub-resources. I take this to be a bug that the name is not propagating in this case.
Refs:
- https://github.com/pulumi/pulumi-azure-native/pull/519
- https://github.com/pulumi/pulumi-azure-native/blob/12031f9be156f3b399b20a2302c8a7b8cc4f8026/provider/pkg/provider/provider.go#L713-L723