https://pulumi.com logo
#azure
Title
# azure
c

colossal-room-15708

05/10/2020, 8:06 AM
Is there any way to get the connection string to a SQL cosmos DB account? I find it a bit strange that this doesn't seem to be possible based on the docs. https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/azure/cosmosdb/#Account-connectionStrings It's absolutely available in the portal.
this will have to do then:
Copy code
const cosmosConnectionString = pulumi.all([cosmosAccount.endpoint, cosmosAccount.primaryMasterKey]).apply(([accountEndpoint, key]) => `AccountEndpoint=${accountEndpoint};AccountKey=${key};`)
b

broad-dog-22463

05/10/2020, 9:05 AM
If that’s the correct way, we can add a mixin to make that an available func @colossal-room-15708
c

colossal-room-15708

05/10/2020, 9:06 AM
yeah, that string is correct. What's a
mixin
?
I might want to do that myself. I'll take a look.
b

broad-dog-22463

05/10/2020, 11:06 AM
If you check out the overlays in the cosmosDB folder in the nodejs sdk you should see a mixins.ts file
That’s where you would add such a function to get the connection string based on the correct parameters
c

colossal-room-15708

05/10/2020, 11:30 AM
Yeah, I read up on the pattern. I'll see if I can open a PR for it.
b

broad-dog-22463

05/10/2020, 12:02 PM
Let me know if you need help
c

colossal-room-15708

05/10/2020, 1:06 PM
Let me know if this is BS 😉
Before merging (haha, wishful thinking) I'd love to do the same for the other languages to keep everything at the same level.
t

tall-librarian-49374

05/10/2020, 2:36 PM
Unfortunately, I believe mixins only exist for Node at the moment
b

broad-dog-22463

05/10/2020, 2:38 PM
Yes ☝️
It’s on the list to be added though
t

tall-librarian-49374

05/10/2020, 2:40 PM
I added a comment to the PR
c

colossal-room-15708

05/11/2020, 8:58 AM
@tall-librarian-49374 let me know what you think about my changes or if I misinterpreted the doco
@tall-librarian-49374 you had a chance to take another look?
t

tall-librarian-49374

05/12/2020, 12:20 PM
Not really… I’m still puzzled and want to understand the route cause.
If missing connection strings are a bug, we should fix it upstream. If it’s by design - why?
https://github.com/Azure/azure-cli/issues/4419 was fixed somewhere around 01/01/2019, so after the TF change including the doc
c

colossal-room-15708

05/12/2020, 12:46 PM
t

tall-librarian-49374

05/12/2020, 12:49 PM
no, only if that’s the behavior of the Go SDK or the service itself
<http://github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb|github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb>
maybe there is an update here
c

colossal-room-15708

05/12/2020, 1:07 PM
That would be strange. The APIs definitely expose this, at least the portal shows the values and the RP also shows the connection string. So push for MS to change it or compute in pulumi for now?
It seems like the
ListConnectionStrings
method is only implemented for the
mongodb
client? https://github.com/Azure/azure-sdk-for-go/blob/master/services/cosmos-db/mongodb/client.go#L71 Nowhere to be seen in https://github.com/Azure/azure-sdk-for-go/blob/master/services/cosmos-db/mgmt/2020-03-01/documentdb/client.go (or any other API version)
I just checked with the cosmos DB team if they can explain this
t

tall-librarian-49374

05/13/2020, 3:09 PM
I would also a bug in the TF provider to track this. Any fix in there seems like a better solution.
c

colossal-room-15708

05/13/2020, 9:23 PM
😥 always takes so long for them to get to things
Fat fingers, didn't want to send this to the channel...
t

tall-librarian-49374

05/14/2020, 6:24 AM
I’m just trying to avoid a confusing API that we’d have to maintain forever. Even fixing it in our fork of TF sounds okay, if TF themselves don’t cooperate.
(I think you can “un-send” messages from the channel)
c

colossal-room-15708

05/14/2020, 8:11 AM
Hmm, not in my client...
Yeah, I get what you're saying... sort of why I wished there wasn't that dependency on TF 😉
TF says "MS needs to fix"... now I'm waiting for MS to fix something, TF to pick it up and release and then pulumi... I'll stick to my workaround I think
t

tall-librarian-49374

05/14/2020, 11:07 AM
So in this case having no dep on TF wouldn’t help: MS still doesn’t return it
c

colossal-room-15708

05/14/2020, 11:10 AM
Depends on if you said, "it's fine, we can compute it ourselves" or "MS needs to do it"
Hmm, started working now?! Created a documentation bug for terraform.
t

tall-librarian-49374

05/16/2020, 7:00 PM
Started working just now?
c

colossal-room-15708

05/16/2020, 10:10 PM
At least in terraform, yeah. Have to test pulumi again.
3 Views