Skip to main content

auto terraform review

Project description

Terraform automatic reviewer

terraform scripts checker.
This package helps you to review your tf script.
(ex: confirm add logging rule to all s3 bucket)

Installation

$ pip install tf_cop

Usage

do review

pass terraform root path & review_book root path

import tf_cop

if __name__ == '__main__':
    test = tf_cop.TfCop()
    test.tf_review("./test", "./review_book_default")

get output

    output = test.output(color_flg=True)
    print(output["output_log"])
    print(output["output_summary_log"])
    print(output["program_error_log"])
    print(output["system_log"])

Review_book yaml rule

key description
title test title
desc description for test
mode test mode (existance|value|nested)
key test target key (ex. tags)
value correct value regex
nest for nested test

existance test

check if target key is exist.
(ex. description)

value test

check if target value is correct.
(ex. name = "(prd|stg|dev)-s3-.*-terraform")

nested test

test to nested key_value

tags {
    Name = "${terraform.env}-tf-review-bucket"
    Env = "dev"
}

Testing

python test.py

Author

ys-tydy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tf-cop, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size tf_cop-0.0.4.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page