DEV Community

Cover image for My take on GitHub co-pilot's Terraform skills
Arpan
Arpan

Posted on • Updated on

My take on GitHub co-pilot's Terraform skills

Introduction

So after a long wait in the waiting list, I've finally been able to get my hands on GitHub's co-pilot.

If you're not familiar with co-pilot, check it out here.

It's been a couple of weeks since copilot's been setup on my VSCode and I must say, this looks really promising!

Since working with Terraform is part of my day job, I was curious to see how it would perform as my co-pilot declaring resources through it on my personal device. So this article focuses on its Terraform prowess.

Terraform and Co-pilot

It was impressive to see the bot recognise my coding style and immediately infer what I was trying to do. However, it didn't fully understand my intentions until I was a little further into the code.

The gif below shows copilot trying to guess what I'm trying to do:

Github co-pilot with terraform

Below is where it truly shines by making meaningful suggestions to my output resource.

Github co-pilot with terraform, context recognition

While not mind-blowing, it can save time by suggesting something you would either type yourself anyway of copy from somewhere else.

Here's another example; I added some extra variables to the module to test whether co-pilot would detect those and try to suggest them as outputs. To (or not, at this stage) my surprise, it did!

Github co-pilot with terraform

What about Makefiles?
My quick test with a go-project makefile seems shows fruitful results.The co-pilot made a great suggestion for a makefile target to release the binary with version and platform suffixes! Well done co-pilot ;)
Image description

Final thoughts

Is co-pilot more than just a copy-paste bot? Well, I think so. It's impressive that it understands and makes mostly good suggestions for Terraform, I can imagine how good it would be for other more widely available languages on GitHub.

Top comments (0)