GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - gruntwork-io/intro-to-terraform: Sample code for the blog post series "A Comprehensive Guide to Terraform."

This repository was archived by the owner on Feb 24, 2023. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
.circleci
.circleci
 
 
.github
.github
 
 
cluster-of-web-servers
cluster-of-web-servers
 
 
database
database
 
 
live
live
 
 
loops-with-count
loops-with-count
 
 
loops-with-for-each
loops-with-for-each
 
 
loops-with-for
loops-with-for
 
 
modules/services/webserver-cluster
modules/services/webserver-cluster
 
 
s3-backend
s3-backend
 
 
single-web-server
single-web-server
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
CODEOWNERS
CODEOWNERS
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 

Repository files navigation

Maintained by Gruntwork.io Terraform Version

NOTE: This repo is now archived and replaced!

This repo contains the sample code for the blog post series A Comprehensive Guide to Terraform, which we turned into the book Terraform: Up & Running, with its own code examples repo.

Instead of maintaining two examples repos, we have decided to maintain just one. This repo is now archived, so please head over to the terraform-up-and-running-code repo for the most up to date examples.

Original content (saved for posterity)

An Introduction to Terraform Sample Code

This repo contains the sample code for the blog post series A Comprehensive Guide to Terraform. The examples correspond to the following parts of the series:

  1. An Introduction to Terraform
    • single-web-server: Deploy a single EC2 Instance with a web server that will return "Hello, World" for every request on port 8080.
    • cluster-of-web-servers: Deploy a cluster of EC2 Instances in an Auto Scaling Group (ASG) and an Elastic Load Balancer (ELB). The ELB listens on port 80 and distributes load across the EC2 Instances, each of which runs the same "Hello, World" web server.
  2. How to Manage Terraform State
    • s3-backend: Create an S3 bucket and DynamoDB table to use as a Terraform backend.
    • database: Deploy MySQL on top of Amazon's Relational Database Service (RDS).
  3. How to create reusable infrastructure with Terraform modules
    • modules: Examples of reusable Terraform modules, including a module that can deploy a web server cluster on top of ASG with an ELB.
    • live: Examples of how to deploy different live environments (i.e., staging, production) using the code from the modules folder.
  4. Terraform tips & tricks: loops, if-statements, and pitfalls
    • loops-with-count: Examples of how to use the count parameters to "loop" over resources.
    • loops-with-for-each: Examples of how to use for_each to "loop" over inline blocks.
    • loops-with-for: Examples of how to use for to "loop" over individual values.

Quick start

Note: These examples deploy resources into your AWS account. Although all the resources should fall under the AWS Free Tier, it is not our responsibility if you are charged money for this.

  1. Install Terraform.
  2. Set your AWS credentials as the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  3. cd into one of the example folders.
  4. Run terraform init.
  5. Run terraform apply.
  6. After it's done deploying, the example will output URLs or IPs you can try out.
  7. To clean up and delete all resources after you're done, run terraform destroy.

License

Please see LICENSE.txt for details on how the code in this repo is licensed.

About

Sample code for the blog post series "A Comprehensive Guide to Terraform."

blog.gruntwork.io/a-comprehensive-guide-to-terraform-b3d32832baca

Topics

awsdevopssamplesterraform

Resources

Readme
License
Activity
Custom properties

Stars

724 stars

Watchers

5 watching

Forks

517 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.