0.2.4 • Published 4 years ago

@cloudcommons/terraform-assert v0.2.4

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

Terraform Assert

The aim of this assert library is to provide an easy way to assert terraform plans.

Any terraform plan created with terraform, in JSON format, can be used as input for assertion.

How to use

Generating a terraform plan in JSON format

This library expects a terraform plan in JSON format, as described in the terraform documentation.

The library supports the following plan format_version:

  • 0.1

Asserting JSON terraform plans

This example assumes you are using Mocha and Assert

npm install --save-dev mocha assert

To obtain a terraform plan in JSON format, assuming you have a valid terraform project and has been initialised:

terraform plan -out=plan.tfplan
terraform show -json plan.tfplan > plan.json

Then use plan.json as input for the assert library. This example assumes plan.json has been copied to the same folder :

// test.js
const assert = require('assert');
const terraformAssert = require('@cloudcommons/terraform-assert');
const planJson = require('plan'); // Assuming plan.json has been copied to the same folder as test.js
const plan = terraformAssert(planJson);


describe("My terraform plan test", () => {
    describe("Basic tests", () => {
        it("Terraform version is correct", () => {
            plan.terraformVersion.is("0.12.23");
        });
    });
});
0.2.4

4 years ago

0.2.1

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago