https://pulumi.com logo
Title
a

ancient-eve-13947

07/13/2021, 10:11 AM
hi, I'm looking into Pulumi to set up Azure resources from C# and I'm wondering about one thing: for example, when creating an SQL server, you pass one `name`parameter directly in the constructor, and then there is a property `ServerName`in the
ServerArgs
parameters, too. The same goes for CosmosDb: there is the name parameter of the constructor and the
AccountName
property of
DatabaseAccountArgs
. What's the deal here? Why are there two different ways of specifying the name? What happens if I don't specify the one in the properties? Thank you, Mark @ DEON
b

brave-planet-10645

07/13/2021, 10:14 AM
when you say
name
, do you mean the first parameter:
resource_group = ResourceGroup("rg_Mark")
?
a

ancient-eve-13947

07/13/2021, 10:21 AM
yes
b

brave-planet-10645

07/13/2021, 10:22 AM
So that's the name that we use as part of the unique identifier within the state
a

ancient-eve-13947

07/13/2021, 10:22 AM
ah, so that name has nothing to do with Azure?
so, in principle, I don't really care about this name, do I? however, how about this:
var sqlServer= new Server("nameJustForPulumi", new ServerArgs{ ServerName="actualServerName", ... });
var sqlDatabase= new Database("...", new DatabaseArgs{ ServerName= sqlServer.Name});
Will the server name of the database be correctly set, ie, to "actualServerName"? or do I use this wrong?
b

brave-planet-10645

07/13/2021, 10:44 AM
As long as it's unique within the state that's fine. You'll probably find that the
ServerName
has a few characters on the end (due to our auto-naming), but you're referencing it correctly in the
Database
resource
a

ancient-eve-13947

07/13/2021, 10:48 AM
thank you very much!
ah, that link was gold!
it just made me realize there is no need for putting the stackname into the names of my resources
thanks again
b

brave-planet-10645

07/13/2021, 1:08 PM
No problem 🙂