Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 28, 2021 02:13 pm GMT

Pulumi - IaC in your favorite programming language!

DevOps tool of the month is a series, where each month I introduce one new useful DevOps tool in 2021

For May I chose: Pulumi - a modern Infrastructure as Code Tool for Developers.

What is Pulumi and how it's different from other IaC tools

When writing IaC scripts using other tools, you usually have to use a DSL (like HCL in case of Terraform) of that tool or YAML or JSON which is a format that many tools use.

Problem with YAML or JSON:
It's easy to read and easy to define resources you want to create and that is great.

But what if we need to add some logic in there, like

  • conditionals, "create this EC2 instance, if xyz"
  • or use loops, like "I want to create 20 EC2 Instances with the same configuration"
  • or what about re-using logic? Like, "all 20 instances with this shared config, plus some specific configs"

It gets pretty complex in such formats. So all these logical operations, loops, reusing blocks of code is a natural part of any programming language, right?

So writing the same infrastructure as code logic in a programming language would obviously make writing more complex code easier and cleaner. And that's exactly what Pulumi did.

Pulumi allows you to write infrastructure as code in a programming language.

Now which programming language is that? Well, you can actually choose whichever language you want to use Pulumi. You can write it in Node.js, Python, .net etc.

Pulumi - choose favorite language

So instead of having to learn a new syntax or DSL or a new language, you can use the language you are most proficient in and use it for writing infrastructure as code.

Main Benefits of using a Programming Language of your choice

1) Use the same Programming Tools you know for Infrastructure
If you are coding in Python for example, you probably have the most fitting IDE for it, like PyCharm, you have installed all the plugins for that languages, you have configured linters that tell you immediately if you have an error in the code or warning in your code quality. You know all the main libraries you can use in your code etc.

So you know the whole eco-system of that language. And that means you can use all that same eco-system and your expertise for now writing infrastructure as code. And this can make your work much more efficient.

Use Programming Expertise for Infrastructure

2) Treat Infrastructure as Code as Application Code
Another thing that we see emerging and becoming a standard is treating our infrastructure as code exactly the same way as our application code.

One Pipeline for Everyone

That includes e.g. testing the code. Having unit tests, integration tests etc. So with YAML and JSON format or DSL, like HCL that Terraform uses, it's pretty difficult to write tests for these scripts.

With Pulumi obviously you have the advantage of simply writing tests for you IaC as for your application code, using the same test libraries, same language, same editor etc.

How Pulumi works in Practice

Check out the video to see how Pulumi works in practice. I will show you how to write a simple Pulumi project to first create an S3 bucket in an AWS account and then a more realistic example of provisioning an EKS cluster:
Pulumi Demo

More awesome tools coming up next on this series, so stay tuned for it!

Like, share and follow me for more content:


Original Link: https://dev.to/techworld_with_nana/pulumi-iac-in-your-favorite-programming-language-3i1m

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To