https://pulumi.com logo
Title
w

wet-noon-14291

11/08/2020, 11:58 PM
What is the recommended way to run a piece of code after a resource has been provisioned? Is it to do
Apply
on a
Name
for example and then run some kind there?
s

stocky-spoon-28903

11/09/2020, 2:17 AM
What does the code do?
The provisioner examples might be relevant
w

wet-noon-14291

11/09/2020, 6:18 AM
I’ll check the calendar example when on computer, thanks. My plan is to create some sql db accounts when the db has been provisioned.
I have no clue how "provisioner example" turned into "calendar example"... Anyhow, is there a more lightweight approach to run something every time you do
pulumi up
after some resources have been provisioned. The provisioners example is heavier than expected and is also based on one resource dependency as I see it. I can definitely work my way around it, but I was thinking it might be an easier way?
I guess you were referring to this example @stocky-spoon-28903 https://github.com/pulumi/examples/blob/master/azure-ts-vm-provisioners/provisioners/provisioner.ts, looks like
Pulumi.Dynamic.Resource
doesn't exist for .NET yet though.
Since dynamic providers, https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamicproviders, isn't available in .NET I'm on the search for a workaround. Any pointers?
s

stocky-spoon-28903

11/09/2020, 1:59 PM
Which DB is it?
w

wet-noon-14291

11/09/2020, 7:27 PM
Azure sql this time.
s

stocky-spoon-28903

11/09/2020, 7:31 PM
Is that SQL Server?
The best way to do this is to fit it into resource models - Postgres has a provider for example
w

wet-noon-14291

11/09/2020, 9:57 PM
I definitely agree, I just don't know how to do it for SQL Server. I would love to have something like a
SQL.Login
and
SQL.User
resource, but not sure how I would go about creating such a resource. Using a dynamic provider would make such a thing easy though.
my workaround at the moment is to solve it with db migration, but it is a little bit "hacky" because I sort of need to do two migration steps. One step to create login in master database and then one towards the actual database to create user and tables in that database.
s

stocky-spoon-28903

11/09/2020, 10:23 PM
w

wet-noon-14291

11/09/2020, 10:58 PM
Really appreciate your answers @stocky-spoon-28903! Not sure how I would go from that terraform provider to pulumi though. Also, not sure I want to base a pulumi provider on something that was made as an experiment two years ago. As of now I think I'll just have to live with my workaround.
s

stocky-spoon-28903

11/09/2020, 11:01 PM
You should talk to @broad-dog-22463 about this one!
👍 1
For users etc there’s probably something better than can be done
w

wet-noon-14291

11/10/2020, 8:14 AM
I definitely agree @stocky-spoon-28903, users (or logins as it is called in MSSQL) would ideally be created from pulumi. @broad-dog-22463, do you have any suggestion on this? I do have a workaround as mentioned so not critical at all but it would be a smoother experience working with SQL Server.