• This repository has been archived on 25/Oct/2020
  • Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    Go
  • License
    Mozilla Public Li...
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple tool for Terraform language syntax cleanup, extending terraform fmt

terraform-clean-syntax

NOTE: The changes made by this tool were integrated into Terraform's own terraform fmt in Terraform v0.14.0, so the functionality in this repository will see no further changes.

terraform-clean-syntax is a simple command line tool for performing some small syntax cleanup steps on Terraform .tf configuration files automatically.

Specifically, it currently knows how to clean up the following:

  • Argument values that are just a single template interpolation, like "${foo}", are simplified to the equivalent foo.
  • Variable type constraints using the legacy forms from Terraform 0.11, like "string", "list", or "map", are replaced with their modern type constraint expressions string, list(string) and map(string).

The two changes listed above will both silence some (though not all) of the syntax deprecation warnings emitted by Terraform 0.12.14 and later. This program is conservative, so it may skip certain opportunities for cleanup if they are too complex for it to be sure that the change is safe.

The built in terraform fmt command in Terraform doesn't perform these cleanups automatically at the time of writing, because the Terraform team worried that this would make it difficult for folks to continue maintaining modules that are cross-compatible with both Terraform 0.11 and 0.12. The cleanups made by this program will render a configuration incompatible with Terraform 0.11, so this program should not be used on any module that must retain Terraform 0.11 compatibility.

Usage

After compiling the program using Go 1.12 or later, run it with a single argument that is a file or directory to apply rewriting to:

terraform-clean-syntax .

If given a directory, terraform-clean-syntax will visit all of the .tf files in the directory and recursively search any directories within it.

If given a single file, terraform-clean-syntax will process that file only if its name has the suffix .tf.

This program rewrites configuration files in-place, so it's best to make sure your version control work tree is clean before running so that you can clearly see which changes it is proposing and discard those changes if desired.

This program is a best-effort static analysis tool and it doesn't have intimate understanding of Terraform language syntax, so be sure to review the changes it proposes and test your resulting configuration with terraform validate and/or terraform plan before merging the changes into your codebase.

More Repositories

1

go-cidr

Go library for various manipulations of CIDR netmasks and their associated addresses
Go
113
star
2

terraform-aws-tf-registry

Terraform module for creating a simple private Terraform registry in AWS with DynamoDB
HCL
105
star
3

angularjs-viewhead

Change the HTML title and head elements on a per-view basis
HTML
99
star
4

livejournal

LiveJournal Server Source Code (stale history from before it went closed-source)
Perl
78
star
5

terraform-provider-testing

An experimental Terraform provider to assist in writing tests for Terraform modules
Go
69
star
6

terraform-simple-registry

Go
64
star
7

terrafy

An experimental little tool to automate importing collections of things into Terraform. Bork impult.
Go
41
star
8

terraform-provider-bash

Terraform utility provider for constructing bash scripts that use data from a Terraform module
Go
34
star
9

activity-streams-python

Activity Streams Parser for Python
Python
28
star
10

activity-streams-specs

Specifications for publishing and consuming Activity Streams
28
star
11

node-angularcontext

Use AngularJS in Node applications
JavaScript
24
star
12

go-openvpn-mgmt

[WIP] Go client library for OpenVPN's management protocol
Go
22
star
13

proximobus

An alternative interface to the NextBus Public API
Python
20
star
14

python-nextbus

A Python library for connecting to the NextBus public API
Python
18
star
15

libdanga-socket-anyevent-perl

Danga::Socket reimplementation in terms of AnyEvent
Perl
13
star
16

terraform-sdk

Experimental next-generation Terraform SDK (prototype)
Go
11
star
17

libnet-openid-perl

OpenID libraries for Perl
Perl
10
star
18

verilog-vga-simulator

Verilog VPI VGA Simulator using SDL
C
10
star
19

activity-streams-tester

Google App Engine app which parses Activity Streams and renders what it found
Python
10
star
20

terraform-provider-javascript

A Terraform provider for computing values using JavaScript
Go
10
star
21

68k-computer

A homebrew computer design based on the MC68SEC000 CPU
C
10
star
22

go-versions

Version-wrangling library for Go
Go
9
star
23

python-stl

Python library for parsing and producing STL files, in both ASCII and binary formats. No longer maintained.
Python
9
star
24

python-camlistore

Python interface to Camlistore
Python
8
star
25

padstone

Go
8
star
26

hcltemplate

CLI filter for rendering JSON objects using the HCL template language
Go
7
star
27

terraform-provider

Client library for using Terraform providers without using Terraform itself
Go
7
star
28

perl-anyevent-websocket

WebSocket implementation for AnyEvent
Perl
7
star
29

libhttp-request-multi-perl

HTTP::Request::Multi - Perl implementation of Batch HTTP Requests
7
star
30

camlistore-aws

Packer and Terraform configs to build and run camlistore server in AWS
Shell
6
star
31

activity-streams-perl

Activity Streams Library for Perl
Perl
6
star
32

atom-media-specs

Specifications for extensions to Atom to support media use-cases
6
star
33

go-rundeck-api

Go client for the Rundeck HTTP API
Go
6
star
34

poe-danga-socket

POE Loop implementation that targets Danga::Socket
Perl
5
star
35

android-nextbus

This does something secret
Java
5
star
36

http-batch-specs

Specification for a protocol for batch requests to RESTful APIs
5
star
37

sf-ped-map

OpenStreetMap-based San Francisco Map for Pedestrians
Python
5
star
38

dotcloud-serviceconfig

Simple mechanism to help your dotcloud services find each other
Python
5
star
39

terraform-schema-go

Go library for modelling Terraform schemas
Go
5
star
40

camlistore-git

Toy implementation of git "server" that stores repository data in a camlistore instance.
Python
5
star
41

json-syn-specs

Specifications for the representation of syndication objects in JSON
4
star
42

media-center

Yet Another Media Center?
JavaScript
4
star
43

go-rst

[WIP] ReStructuredText Parser for golang
Go
4
star
44

brightsquare

A stupid little web app for updating both BrightKite and FourSquare at the same time
Perl
4
star
45

go-hcl-overlay

HCL helper for applying overlays to configuration, such as command line arguments
Go
4
star
46

libjson-streaming-writer-perl

JSON::Streaming::Writer - Generate JSON output without assembling data structure in memory
Perl
4
star
47

terraform-filter-vars

A small utility for filtering .tfvars files to include only definitions related to a particular Terraform module
Go
4
star
48

rust-linux

Lightweight safe wrappers around direct Linux system calls
Rust
3
star
49

terraform-aws-serverless-webapp

Terraform module for deploying "serverless" applications to AWS Lambda and Amazon API Gateway
HCL
3
star
50

domain-federation-protocol-specs

Specifications for a Domain Federation Protocol
3
star
51

activitystreams-old-registry-tools

Prototype tools for managing the prototype registry
Perl
3
star
52

raspi-jtag-hat

C
3
star
53

python-promise

Batchable, Coalescable, Concurrent Promises in Python
Python
3
star
54

pish

Python
3
star
55

go-protohcl

[Prototype!] Represent HCL schemas using protobuf message descriptors
Go
3
star
56

quantumkeep

Key-value store with version control
Python
3
star
57

epub-recipes

Makes an ePub book from some recipes parsed from simple text files
Perl
3
star
58

s2

S2 Template System
Perl
3
star
59

terraform-plan-output-grammar

A TextMate-style grammar for the human-oriented Terraform plan diff output
3
star
60

libjson-acrobatic-perl

Perl implementation of Acrobatic JSON
Perl
3
star
61

libwebservice-typepad-perl

Perl library for accessing Six Apart's TypePad JSON API
Perl
3
star
62

hclcalc

Go
2
star
63

activity-api

Activity API
2
star
64

atom-crossposting-specs

Specification to allow feed publishers to declare cross-post duplicates that they create
2
star
65

libutil-future-perl

Smart batch-loader using "Futures"
Perl
2
star
66

libjson-streaming-reader-perl

Parse JSON strings in a streaming fashion
Perl
2
star
67

libutil-datathing-perl

Perl
2
star
68

libsyntax-highlighting-json-perl

JSON Syntax Highlighting in Perl
2
star
69

led-alpha-sign-msg-server

A simple HTTP interface to showing and hiding priority messages on an Adaptive Micro Systems LED sign
Perl
2
star
70

juniper-vpn-launcher

An API for launching the Juniper VPN ncsvc client
2
star
71

libutil-task-perl

Coalescable Tasks
Perl
2
star
72

libhardware-hal-perl

Hardware::HAL - Perl API for freedesktop.org HAL
2
star
73

python-acrobaticjson

Acrobatic JSON implementation for Python
Python
2
star
74

pubsubhubbub-json

PubSubHubbub for JSON
2
star
75

python-canal

Simple graph processing library built on greenlets
Python
2
star
76

nextbus-aggregator

Some gunk for aggregating and optimizing queries to NextBus
Perl
2
star
77

federationsandbox

An AppEngine app that provides a sandbox and testing ground for DFP implementations
Python
2
star
78

hcl-compat-bridge

WIP bridge from the HCL 2 API to the HCL 1 and HIL parsers/evaluators
Go
2
star
79

reviewhoo

Little tool that suggests who you might ask to review a particular git changeset
Go
2
star
80

terraform-aws-service-roles

A Terraform module for creating AWS IAM service roles
HCL
2
star
81

led-matrix-fonts

Some bitmap fonts that are small enough to use on an LED matrix
Python
2
star
82

wordclock

A clock that tells the time in words
KiCad Layout
2
star
83

blogwhack

A shim to whack together multiple blogs served from different services
2
star
84

python-conjurer

A simple utility for mapping SQLAlchemy resultsets to object instances in a declarative way
Python
2
star
85

go-shquot

Go
2
star
86

py2bsc

Translates a subset of Python into BrightScript to enable more sensible Roku/BrightSign programming
Python
2
star
87

genext2fs-tar-index

Generate device/metadata indices for genext2fs
Go
2
star
88

elfbin

Tool (and Rust library) for creating ELF object files with symbols whose data comes from other files
Rust
2
star
89

nextbus-trip

Uses NextBus predictions to give a whole-trip estimate
Perl
2
star
90

python-tfplugin

EXPERIMENTAL+WIP library for implementing Terraform plugins in Python
Python
2
star
91

libutil-task-httprequest-perl

Util::Task implementation for doing HTTP requests
Perl
2
star
92

rust-lpc81x-hal

Rust HAL crate for lpc81x-series microcontrollers
Rust
2
star
93

proximo-web

A HTML5 UI for bus predictions built on ProximoBus
JavaScript
2
star
94

go-ssd1306

Go interface to drive SSD1306 OLED controllers
Go
2
star
95

terraform

Go
2
star
96

camlistore-debian

Debian packaging for Camlistore
Go
2
star
97

go-gpio

Hardware-agnostic GPIO interfaces for Go
Go
2
star
98

ng-anon-module

Create AngularJS modules without polluting the global module registry
JavaScript
1
star
99

apparentlymart.github.com

1
star
100

go-pilfer

Utility for copying Go named types from one package to another
Go
1
star