Skip to content

slavrd/terraform-go-redis-counter

Repository files navigation

Terraform - webcounter

A Terraform configuration to deploy the webcounter application in AWS.

The root module of the configuration is used to call on three sub-modules - webcounter and redis-server, placed in respectively named sub directories and terraform-aws-basic-network. For details on each submodule check their readme.

The modules create a VPC and subnets in which then deploy EC2 instances from pre-built AMIs. The AMIs are built using the following packer projects - webcounter, redis-server.

All modules are tested using Kitchen-Terraform.

Prerequisites

Usage

  • Set up AWS region using environment variable - export AWS_REGION=my-aws-region.
  • Assign values to the terraform input variables - help. The variables and their descriptions are defined in the input.*.tf files.
  • run terraform init to initialize the terraform project.
  • run terraform plan|apply|destroy to manage the AWS resources.

Testing with Terraform-Kitchen

Prerequisites:

  • Ruby with version defined in the Gemfile.
  • Gems described in Gemfile. Recommended to use ruby bundler - run bundle install.

Setting up tests:

  • Set AWS region for the test - export AWS_REGION=my-aws-region.
  • The TF configuration for the test is in test/fixtures folder. Change values like ami search patterns, used network cidrs etc. in it as needed.

Running tests (assuming using bundler):

  • run bundle exec kitchen converge - build the test environment
  • run bundle exec kitchen verify - run the tests
  • run bundle exec kitchen destroy - destroy testing environment

Note: At least several seconds are needed between building the environment and running the tests. That is why using the kitchen test command to automatically perform the three actions above can sometimes fail.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published