Skip to main content

Learning Terraform

Create and Destroy EC2 using Terraform

Refer my GitHub repo - https://github.com/smarigowda/thecloudbootcamp/tree/ec2/learning_001

Watch my video - https://www.youtube.com/watch?v=2VPbpuj6nxo

Error - Default VPC is required

I encountered an error when tying to create an EC2 instance. The error EC2 instance requires a default VPC.

Watch my video - https://www.youtube.com/watch?v=hgXRS1zbjko

Splitting Terraform Code into Multiple Files

Terraform code can be written in multiple files. This helps in organizing the code.

Watch my video - https://www.youtube.com/watch?v=wo2_tXk6YZ0

GitHug Repo Link - https://github.com/smarigowda/thecloudbootcamp/tree/ec2/learning_002

Multiple Providers

There can be multiple providers in a Terraform code. This helps in managing multiple cloud providers.

Study Link: https://registry.terraform.io/browse/providers

Watch my video: https://youtu.be/lzEXUPEDZBs

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/providers/learning_001

VPC

Creating a VPC in AWS using Terraform code

Study Link: https://registry.terraform.io/providers/hashicorp/aws/latest/docs

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/vpc/learning_001

Watch my video: https://youtu.be/gYFkEV0ts84

Local File

Creating/ deleting a Local file using Terraform code

Study Link: https://registry.terraform.io/providers/hashicorp/local/latest

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/localfile/learning_001

Watch my video: https://youtu.be/6XTrDAm3ugI

Ramdon Provider

Creating a random String using Ramdom Provider

Study Link: https://registry.terraform.io/providers/hashicorp/random/latest

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/randomprovider/learning_001

Watch my video: https://youtu.be/WRkkabVPXPA

Input Variables

Without using variable block, create three S3 buckets

Create three S3 buckets

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/inputvars/learning_001

Watch my video: https://youtu.be/ydX_-JZJzzc

Using variable block with default values

Create three S3 buckets. Tag the buckets using variables with default values.

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/inputvars/learning_002

Watch my video: https://youtu.be/NXLXOZ2bNQI

Asking for input from user on command line

Create three S3 buckets. Tag the buckets by taking input from the user on the command line.

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/inputvars/learning_003

Watch my video: https://youtu.be/splae0XIvMU

Using Environment Variables

Create three S3 buckets. Tag the buckets by taking input from the environment variables.

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/inputvars/learning_004

Watch my video: https://youtu.be/piI4g4pWADs

Using variable definitions file - terraform.tfvars

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/inputvars/learning_006

Watch my video: https://youtu.be/sonm6LqmbUk

Reference:

Using --var-file on command line for Variable Definitions

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/inputvars/learning_007

Watch my video: https://youtu.be/gYBHG3gX940

Reference:

Using -var on command line

Create three S3 buckets. Tag the buckets by taking input from the -var command line option.

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/inputvars/learning_005

Watch my video: https://youtu.be/3_CF9iRc3Tk

Reference:

Using combination of file and user input on command line

Precedence for Input Variables

Output Values

Create one S3 bucket. Output the bucket name.

GitHub Repo Link: https://github.com/smarigowda/thecloudbootcamp/tree/outputvalues/learning_001

Watch my video: https://youtu.be/P9l86OXsxDU

Reference: https://developer.hashicorp.com/terraform/language/values/outputs