https://pulumi.com logo
#general
Title
# general
f

freezing-air-90947

07/18/2021, 7:06 PM
Hi. I have just started working with Pulumi. I have a question. How do you run your development cycle? Do you deploy the code every time to the cloud in order to test a little change in the code? Or do you use unit tests instead? Am I missing anything? Is there any better method to use?
p

prehistoric-activity-61023

07/18/2021, 7:18 PM
Most of the errors can be detected by running
pulumi preview
(this is what I added as a check for all pull requests on GH).
I know pulumi has some support for writing unit tests but I haven’t touched that yet so I cannot say anything from experience 🙂.
g

green-stone-37839

07/18/2021, 7:21 PM
Hi Nir, the short story is Pulumi integrates with any CI/CD pipeline that's setup to continuously delivery your changes to the cloud. Here's a link to some documentation that discusses Pulumi and CI/CD. https://www.pulumi.com/docs/guides/continuous-delivery/ You can use things like 'pulumi preview' to view changes that will be applied to your cloud resources, but unit tests can also be used, much like they would with your application code. Pulumi will only make changes when you execute 'pulumi up'. Info on testing: https://www.pulumi.com/docs/guides/testing/
p

prehistoric-activity-61023

07/18/2021, 7:21 PM
+ if you’re using python you can rely on things like
mypy
to check your code (personally, I also use
pydantic
a lot to validate values from stack files)
f

freezing-air-90947

07/18/2021, 7:25 PM
Thank you all for the detailed answers. I would like to use Typescript for my project. I understand the CI/CD idea and I love that pulumi integrates with CI/CD easily. My question is a little different: How do you test the on-going small code changes? Are you going through the CI/CD process for every little change? It sounds weird to me that every little code change need to pass through CI/CD. I thought there will be something more cleaver to deal with testing small code changes while developing.
Maybe this can be solved by organizing my code in such a way that it can executed from additional endpoint which is not pulumi. For example, through cmd. I just wondered if there is any accepted practice for that.
g

great-sunset-355

07/18/2021, 9:50 PM
@freezing-air-90947 This depends on how experienced are you with IaC in general. From the experience, I can tell that writing Unit tests for IaC are waste of time unless your scenario becomes very complex. Because the best thing you can test at the beginning is if some value is set to an expected value, this becomes old very quickly because resources can have 20+ parameters. Unit testing becomes worth it if you start using automation API https://www.pulumi.com/docs/guides/testing/unit/ I find the ideal dev process is that each developer has access to some sort of protected environment that does not collide with others. AWS Account, or at least Pulumi Stack so you do not step on each others toes while developing. Then you run
pulumi up
as often as you need. By the time you get experienced, you'll learn that
pulumi preview
may give you enough information and confidence with your code changes. When you get comfortable you can add CI/CD to the mix, but local development process mentioned above stays
👌 1
21 Views