Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jonbrouse/terraform-style-guide

This repository gives coding conventions for Terraform's HashiCorp Configuration Language (HCL).
https://github.com/jonbrouse/terraform-style-guide

Last synced: about 2 months ago
JSON representation

This repository gives coding conventions for Terraform's HashiCorp Configuration Language (HCL).

Awesome Lists containing this project

README

        

# Terraform Style Guide

**Table of Contents**

- [Introduction](#introduction)
- [Syntax](#syntax)
- [Spacing](#spacing)
- [Resource Block Alignment](#resource-block-alignment)
- [Comments](#comments)
- [Organizing Variables](#organizing-variables)
- [Naming Conventions](#naming-conventions)
- [File Names](#file-names)
- [Parameter, Meta-parameter and Variable Naming](#parameter-meta-parameter-and-variable-naming)
- [Resource Naming](#resource-naming)
- [Policies as Data Sources](#policies-as-data-sources)

## Introduction

This repository gives coding conventions for Terraform's HashiCorp Configuration Language (HCL). Terraform allows infrastructure to be described as code. As such, we should adhere to a style guide to ensure readable and high quality code.

## Syntax

- Strings are in double-quotes.

### Spacing

Use 2 spaces when defining resources except when defining inline policies or other inline resources.

```
resource "aws_iam_role" "iam_role" {
name = "${var.resource_name}-role"
assume_role_policy = <