(Easily) Setting Up Atom For Terraform Development

Intro

I’ve been finding myself editing automation code for tools like Terraform (A platform agnostic infrastructure provisioning tool) more frequently in the past few months.

No longer satisfied with using vim (Sorry fans!) I decided to make the switch to Atom.

So far things have been going smoothly but I knew the tool could help me write better Terraform code with a few more tweaks (or more importantly, plugins).

The Plugins

The following plugins helped provide me with basic completion, syntax highlighting, linting, and automatic formatting for all my Terraform .tf files.

atom-beautify
linter
linter-terraform-syntax
language-terraform

Instead of writing a lengthy article on about how totally awesome all this is, I’ve decided to help you get started as quickly as possible.

Get Started Quickly

Assuming you already have terraform in your PATH, the following code is install and forget (minus one change I’ll mention after the code snippet).

Just copy and paste into your terminal of choice.

apm install atom-beautify linter linter-terraform-syntax language-terraform

A Small Note

If you’d like terraform fmt to occur on each save, you’ll need to make a small change to atom-beautify.

  1. Go to the packages menu (Edit>Preferences>Packages)
  2. Click the “Settings” tab on atom-beautify
  3. Find and click Terraform to expand it (List is in alphabetical order)
  4. Make sure the “Beautify On Save” checkbox is ticked.
  5. ???
  6. PROFIT!

In Closing

While this article is rather short, it should help you quickly setup Atom for easily editing Terraform .tf files.

If you have any questions, feel free to comment below.

Happy automating!

5 Comments

  1. Ryan Hartje January 11, 2018 at 9:51 pm

    Hey Robert,

    Thanks for the advice on these atom packages for maintaining Terraform modules.
    Saw multiple statements and thought I might ask if you’ve noticed that you can install multiple packages inline as you can with yum/apt/pip?


    apm install atom-beautify linter linter-terraform-syntax language-terraform

    Cool article!

    1. Robert Tisdale January 12, 2018 at 5:30 am

      Hey Ryan,

      No problem! I had not tried and so wasn’t aware.

      Knowing is half the battle (The other half was updating the article with your suggestion)

      Thanks for the tip 😀

      ~RT

  2. David May 18, 2019 at 7:25 pm

    Thank you for this article. I used it to install and set up my environment to develop Terraform code.

  3. Christian von Wendt-Jensen August 24, 2019 at 12:48 am

    I was wondering if there is a plugin that actually “understand” terraform like the fabulous plugin to Intellij? You get context sensitive help and auto completion on the structure. Does anything in Atom support that?

    1. Robert Tisdale August 26, 2019 at 1:50 am

      Hey Christian,

      As far as I know, I’m not sure if there is anything in Atom that will provide completion as full fledged as something in Intellij.

      If you happen to find something though, let me know! I’d certainly be interested 🙂

      ~RT

Leave a comment

Your email address will not be published. Required fields are marked *