DEV Community

Cover image for Doggone!
bassg0navy
bassg0navy

Posted on

Doggone!

This is a submission for the Pulumi Deploy and Document Challenge: Get Creative with Pulumi and GitHub

What I Built

I built a command line tool to help import manually created infrastructure. It automates the import as well as the associated (and usually annoying) administrative tasks ๐Ÿฅฑ

Project Repo

Check out the repo here!

Idea -> Execution

Creating doggone was fairly straightforward after reaching from my own experiences for a "real-world" problem to solve with Pulumi and GitHub. This has been a pain point for many an engineer over the years and I've personally never seen a tool dedicated to it.

Using Pulumi with GitHub

This project included a lot of firsts for me, and my first experience with Pulumi and its Automation API was overall very positive. I've recently been made aware of its premise โ€” an IaC management tool with real programming language support. This is one of those scenarios where it leaves other IaC platforms in the dust. Terraform is my first love ๐Ÿ’Ÿ but HCL (Hashicorp Language) could never! Lambdas, try-catch blocks, etc. - all inside the same file where I define my infrastructure? Sign me up ๐Ÿ™‹๐Ÿฝโ€โ™‚๏ธ

After a brief indoctrination period, I was able to start writing code fairly quickly thanks to the very familiar Python SDK provided by Pulumi. Simply put, the automation and pulumi_oci libraries handle all import operations for the Oracle Cloud Infrastructure resources.

Challenges

I used Python's click library (another ๐Ÿ’ popped) to generate a bare bones command line interface. I then started working on the GitHub integration. This was where I really hit a wall. I realized although generally very useful for creating and modifying long-lived resources, Pulumiโ€™s GitHub provider was a poor choice for lower-level git functions like listing repositories, getting user information, etc. The latency made the command line tool almost unusable, so I made the tradeoff to query the GitHub API directly (using Python's PyGitHub and GitPython libraries) when it made sense.

Conclusion

By no means is this fully fleshed out or ready for production. Proceed with caution, but feel free to fork & iterate for your own purposes. I can see a tool like this being most useful during migrations of large swaths of existing infrastructure.

Would love feedback, if any!

Top comments (0)