Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 2.15 KB

README.md

File metadata and controls

47 lines (32 loc) · 2.15 KB

drone-terraform-compliance

Plugin wrapper for https://terraform-compliance.com

Usage

Build the image

Navigate to the Dockerfile directory and run the following command to build the Docker image:

docker build -t <image_name> .

Setting up Environment

Ensure that inside the Terraform files' directory, you have a Terraform plan file named plan.out and a directory named features containing compliance feature files. These feature files specify the conditions to be enforced during compliance checks.

Run the container

Navigate to Terraform files' directory and execute the following command to run the Docker image and perform Terraform test:

docker run -v $(pwd):/app <image_name>

This command mounts the current directory ($(pwd)) as /app inside the Docker container and runs compliance checks on that directory.

Environment Variable (optional)

You can set the PLUGIN_ARGS environment variable to provide additional flags or options when running the Terraform Compliance tool.

usage: docker run -v $(pwd):/app -e PLUGIN_ARGS='[options]' <image_name>

options:
  --help, -h                                             show this help message and exit   
  --terraform [terraform_file], -t [terraform_file]      The absolute path to the terraform executable.
  --features feature directory, -f feature director      Directory (or git repository with "git:" prefix) consists of BDD features
  --planfile plan_file, -p plan_file                     Plan output file generated by Terraform
  --quit-early, -q                                       Stops executing any more steps in a scenario on first failure.
  --no-failure, -n                                       Skip all the tests that is failed, but giving proper failure message
  --silent, -S                                           Do not output any scenarios, just write results or failures
  --identity [ssh private key], -i [ssh private key]     SSH Private key that will be use on git authentication.
  --debug, -d                                            Turns on debugging mode
  --version, -v                                          show program's version number and exit