Giter Club home page Giter Club logo

terraform-goof's Introduction

Snyk Infrastructure as Code Demo

This repository contains a hello world example which demonstrates the Terraform features of Snyk Infrastructure as code. In particular:

  • Detecting CIS Benchmark issues for the AWS Terraform provider

Snyk UI Projects

When this repository is imported into Snyk we should scan the .tf files and identify any issues. This should appear in Snyk like so:

Snyk projects

Clicking on the individual projects will show the Terraform code, along with details of the individual issues and where they exist in the code.

Snyk project

Snyk Cli

After installing the Snyk CLI tool, you will then have the capability of scanning your IAC projects.

For this example repository, you will first need to pull down the code base to your local enviornment.

Terraform is not required to be installed for any of the following examples.

Once in your root directory for the project you can run snyk iac test which will recursively identify any of your .tf files in the project.

If you would like to specify a file, it can be added by with the filepath to the file location. ex: snyk iac test ./modules/storage/main.tf

Snyk projects

Terraform plan ouput

One thing which was recently added is the ability to scan the plan output.

This can be done by running snyk iac test tf-plan.json while in the root directory of this repo.

The plan output is a list of instructions used by terraform which defines what resources will be deployed, if the configuration were to be applied at that very moment. One thing companies will sometimes do, is create that plan output for when they are ready to deploy this configuration to each of their enviornments.

With Snyk there are two different options we have for scanning the plan file.

  1. Resource changes snyk iac test tf-plan.json --scan=resource-changes - any resource changes including third party resources and variables that are different from the current state file (i.e What is currently deployed in your cloud environments).
  2. Planned values snyk iac test tf-plan.json --scan=planned-values - a full view of every resource including third party resources and variables regardless of the current state of deployed resources. (i.e If this configuration was deployed for the first time today, how secure would it be.)

The plan output holds vulnerable information such as secret variables and access credentials and should typically not be commited into SCM.

For this example, we have commited the file tf-plan.json with that secret information for demonstration purposes. The credentials have been deactivated for security reason.

When scanning the plan file, we are looking for vulnerabilities in all of the resources which will be deployed on the next execution of terraform apply tfplan.binary which is applying the configuration related to the plan output, but in the machine readble format.

It's worth noting that not all configuration files are detected in our default scans. This is mostly due to the ability to use third party modules when attempting to deploy resources quickly. The plan output scan is a good way to see the FULL view of what is being deployed and not just the code which the customers manage.

terraform-goof's People

Watchers

 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.