Giter Club home page Giter Club logo

terraform-null-assert's Introduction

Introduction

Assert is a terraform assertion utility. As far you may know currently there is no any invariant processing support in Terraform itself or anywhere in its community modules. This library was introduced to fullfill this space. Moreover: this library may be used in your custom modules unit testing.

General programming rule is that each time you assume something you must write down your assumption in code. Otherwise later or earlier you'll get some problems.

Prerequisites

At the moment Windows OS is not supported. There are no any known terraform limitations within concise versions. Please inform me in case you find some version-specific issues.

Basic usage

Basic usage is pretty simple: you create check module, you pass condition variable and you get error if it doesn't interpolate to true value. Example presented below ensures that at least one subnet exists in given AWS VPC with vpc_id = "vpc-funnyid".

data "aws_subnet_ids" "example" {
  vpc_id = "vpc-funnyid"
}

module "subnets_are_present" {
    source    = "kchugalinskiy/assert/null"
    condition = "${0 != length(data.aws_subnet_ids.example.ids)}"
}

Features

As a development of IaaC concept, some common features of assertions in regular programming languages were introduced. Additional supported operators are listed below:

  • ACTUAL eq EXPECTED
  • ACTUAL neq UNEXPECTED
  • ACTUAL gt(>) EXPECTED
  • ACTUAL ge(>=) EXPECTED
  • ACTUAL lt(<) EXPECTED
  • ACTUAL le(<=) EXPECTED
  • ACTUAL match REGEX

You may find usage snippets in examples directory.

terraform-null-assert's People

Contributors

kchugalinskiy avatar

Stargazers

Petr Řehoř avatar Ollie Petch avatar Sergey Samsonov avatar John Owen Nixon avatar Oleksandr Kukhar avatar

Watchers

James Cloos avatar  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.