koosha-t / terraform-demo

A simple terraform demo project for beginners

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform Demo for Beginners

In this project, we'll be implementing the following infrastructure AWS using Terraform:

rs
Demo Overview



Connecting to AWS

There are two ways you could connect Terraform to AWS:

1. Using ENV Variables:

$ export AWS_ACCESS_KEY_ID=<aws access key id>
$ export AWS_SECRET_ACCESS_KEY=<aws secret key>

2. One-time Configuration of AWS Credentials in your host (globally):

Install awsclie and run the following:

$ aws configure 

You'll then be provided with step-by-step instructinos to set your aws credentials. Terraform will automatically pick your credentials everytime you use it.

Running & Building the Infrastructure in AWS

  1. Initializing a new terraform project via running the following command from the tf dir:
    $ tarraform init
  2. Preview the execution plan and changes (optional):
    $ terraform plan
  3. Apply the changes:
    $ terraform apply

Using Existing Terraform Module

The main branch contains modules (i.e. subnet and webserver) customly created by myself. If you want to see an example of using an existing subnet module from Terraform AWS regsitry, please see the existing_modules branch.

Terraform Provisioners

Though using provisioners is not reommended, however, if you want to see usage examples, please see the provisioners branch.

About

A simple terraform demo project for beginners


Languages

Language:HCL 96.4%Language:Shell 3.6%