Skip to content

A demo on how Terraform works with AWS and can be tested w/Kitchen

Notifications You must be signed in to change notification settings

vzedano/terraform_kitchen_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform_kitchen_demo

A demo on how Terraform works with AWS and can be tested w/Kitchen

Steps taken to perform demo on Linux Mint (A superset of Ubuntu)

Setup the local environment

  1. Setup VSCode
  2. Setup Terraform
  3. Install RVM following the guide: https://rvm.io/rvm/install
    • Make sure you also install ruby 2.6.0 using RVM.
  4. Declare kitchen-terraform as a gem in a Gemfile
    • Run bundle install to download the necessary dependencies.
  5. Setup AWS credentials.

Start working on the project

  1. Create a main.tf, outputs.tf and variables.tf files and add the aws provider to main.tf.
  2. Declare the desired S3 bucket resource
  3. Declare the s3 bucket object resources. (the files). Don't forget to set the timestamp as the content.
  4. Create kitchen test case
    • Create folder test/fixtures/tf_module for storing our terraform plan managed by kitchen
    • Create main.tf, outputs.tf and variables.tf files in test/fixtures/tf_module to call the real terraform plan as a module
    • Create a folder that will hold our tests: test/integration/default/controls
    • Create the kitchen.yml and test/integration/default/inspec.yml files and reference the created directories in kitchen.yml as per kitchen config.
    • Create the testing.tfvars file for the test variables to be used for the module.
    • Add the tests under test/integration/default/
    • Run bundle exec kitchen converge to apply the state
    • Run bundle exec kitchen verify to verify the state as per tests
    • Run bundle exec kitchen destroy to destroy the resources created by kitchen

About

A demo on how Terraform works with AWS and can be tested w/Kitchen

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published