This message was deleted.
# general
s
This message was deleted.
t
Hi Alex. Are you trying to deploy a container with Table Storage API?
s
Hi Mikhail, so after more playing around realised that it just my typescript syntax just creates the CosmosDB account, but no DB.
So what I need to figure out, is the optimal way of creating the Databases and a bunch of tables/containers in it
so basically need to find the equivalent of these commands in Pulumi
az cosmosdb database create --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup --db-name MyDatabase
and
az cosmosdb collection delete --collection-name xxx --db-name yyy
t
The database is easy:
Copy code
const db = new azure.cosmosdb.SqlDatabase("testdb", {
    resourceGroupName: resourceGroup.name,
    accountName: account.name,
});
However, there's no Pulumi resource for Sql Container yet
They need to be added to the Terraform provider first, see https://github.com/terraform-providers/terraform-provider-azurerm/issues/3506
s
ah…. was going to ask how to create a custom resource for that, but terraform is behind
😕
do you recommend that approach?
t
Yeah, that's what I did
s
great, thanks for the feedback Mikhail
much appreciated
t
There is a way to wrap a CLI command into a dynamic resource but that's not a trivial thing to do
I can show you an example if you want to try
s
is it the Static Website example?
t
yes 🙂
But you'd have to add deletion if you want to keep it correct
And upvote the terraform issue above 😉
s
yea, that’s what I was thinking… need to be able to delete to. In fact, I have implemented the static website example but the deletion of that is easy because it just deletes the whole storage account
but yes, need to implement both the ability to create and delete the container
upvoted
any guidance would be very appreciated
t
You just add a call to the CLI delete command in delete method of the dynamic provider
s
yea, so just like the StaticWebsite custom resource, but with the additional
delete(id, props)
method triggering
az cosmosdb collection delete --collection-name --db-name
t
yes (sorry for slow responses)
s
haha, no worries… much appreciated your support
t
If you make it work and don't mind sharing, I'd love to use it too!
s
absolutely, will update you once I have something working
Mikhail, this is on hold for a bit as I’ve been pulled to fix some inherited mess. Will get back to it at some point and let you know the outcome
👍 1
Hello @tall-librarian-49374 I’m running into a few issue trying to put this together. Would you have sometime tomorrow to maybe go over them with me?
t
Sure! What's your time zone?
s
UTC+2, 5.03PM right now
t
Great, I'm in UTC+3 right now
s
It’s about what I posted in #CJ909TL6P, what time would best suit you?