Git Product home page Git Product logo

terraform-modules's Introduction

CDS Common Terraform Modules

Module List

What is this repo?

This repo is a collection of modules made by folks at CDS. It is a collection of policies, best practices, and repeated patterns. You do not have to use these modules but it is recommended by the SREs at CDS that you do. If you have a reason for not using one of these modules we'd love to here about it so we can modify them to fit your need.

Why would you use this repo

  • This code is currently in use in several products
  • This code is tested by Terratest
  • This code embeds security features
  • This code is fully documented
  • This code follows what CDS SREs consider best practices
  • The more people that use it the better it is.
  • The code is opinionated and so removes the need for discussion on certain topics.
  • There are only so many ways to put together infrastructure so it's probably going to end up looking pretty close to this anyways. You might as well not reinvent the wheel here.

How to use modules in this repo

Official instructions for Terraform module usage

To reference modules in this repo use the following source setting:

  source = "github.com/cds-snc/terraform-modules?ref=<<version>>//<<Module Name>>

for instance the user_login_alarm module resource v0.0.1 would look like the following:

module "console_login_alarms" {
  source                 = "github.com/cds-snc/terraform-modules?ref=v0.0.1//user_login_alarm
  account_names          = ["account1", "account2"]
  log_group_name         = "cloudtrailLogGroup"
  alarm_actions_failures = ["alarm_arn"]
  alarm_actions_success  = ["alarm_arn"]
}

Documentation Generation

Documentation is automatically generated using the framework (terraform-docs)[https://terraform-docs.io/].

At a bare minimum you need to add a header to the main.tf file https://terraform-docs.io/user-guide/how-to/#module-header. You also need to document your variables. Optionally you can document your outputs if they aren't descriptive enough.

A github action will detect changes and update documentation in the PR.

Scaffolding

When creating a module it's recommended you use a scaffold to create the minimum required files for a module.

You run the scaffold like so:

make scaffold

The script will prompt you for a scaffold name.

Please Note: output.tf is optional if you have no outputs, locals.tf is also optional if you don't have any taggable resources.

terraform-modules's People

Contributors

calvinrodo avatar patheard avatar renovate[bot] avatar maxneuvians avatar mohdnr avatar actions-user avatar wmoussa-gc avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.