https://pulumi.com logo
s

salmon-beard-79336

07/04/2019, 8:48 AM
Failing with
Copy code
error: Plan apply failed: Error checking for presence of creating Cosmos Table urls (Account db2945defc): documentdb.DatabaseAccountsClient#GetTable: Failure responding to request: StatusCode=405 -- Original Error: autorest/azure: Service returned an error. Status=405 Code="MethodNotAllowed" Message="Requests for API table are not supported for this account.\r\nActivityId: 13c989f3-5b45-4888-a11d-6c5418c7cd94, Microsoft.Azure.Documents.Common/2.4.0.0"
t

tall-librarian-49374

07/04/2019, 9:07 AM
Hi Alex. Are you trying to deploy a container with Table Storage API?
s

salmon-beard-79336

07/04/2019, 9:08 AM
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

tall-librarian-49374

07/04/2019, 9:37 AM
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

salmon-beard-79336

07/04/2019, 9:41 AM
ah…. was going to ask how to create a custom resource for that, but terraform is behind
😕
do you recommend that approach?
t

tall-librarian-49374

07/04/2019, 9:42 AM
Yeah, that's what I did
s

salmon-beard-79336

07/04/2019, 9:42 AM
great, thanks for the feedback Mikhail
much appreciated
t

tall-librarian-49374

07/04/2019, 9:43 AM
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

salmon-beard-79336

07/04/2019, 9:44 AM
is it the Static Website example?
t

tall-librarian-49374

07/04/2019, 9:44 AM
yes 🙂
But you'd have to add deletion if you want to keep it correct
And upvote the terraform issue above 😉
s

salmon-beard-79336

07/04/2019, 9:47 AM
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

tall-librarian-49374

07/04/2019, 9:58 AM
You just add a call to the CLI delete command in delete method of the dynamic provider
s

salmon-beard-79336

07/04/2019, 10:04 AM
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

tall-librarian-49374

07/04/2019, 11:21 AM
yes (sorry for slow responses)
s

salmon-beard-79336

07/04/2019, 11:27 AM
haha, no worries… much appreciated your support
t

tall-librarian-49374

07/04/2019, 1:34 PM
If you make it work and don't mind sharing, I'd love to use it too!
s

salmon-beard-79336

07/04/2019, 3:59 PM
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

tall-librarian-49374

07/17/2019, 3:01 PM
Sure! What's your time zone?
s

salmon-beard-79336

07/17/2019, 3:03 PM
UTC+2, 5.03PM right now
t

tall-librarian-49374

07/17/2019, 3:04 PM
Great, I'm in UTC+3 right now
s

salmon-beard-79336

07/17/2019, 6:43 PM
It’s about what I posted in #typescript, what time would best suit you?