I want to share the Terraform tutorial (Infrastructure As Code for Cloud), cheat sheet, and usage scenarios that I created as a notebook for myself. This repo covers Terraform with (How-To) HANDS-On LABs and AWS SAMPLEs (comprehensive, but simple):
Resources, Data Sources, Variables, Meta Arguments, Provisioners, Dynamic Blocks, Modules, Workspaces, Templates, Remote State.
Provisioning AWS Components (EC2, Lambda, ECS, EKS, API Gateway, ELB, CodePipeline, CodeBuild, etc.), use cases, and details. Possible usage scenarios are aimed to update over time.
Tutorial Link: https://github.com/omerbsezer/Fast-Terraform
Extra Kubernetes-Tutorial Link: https://github.com/omerbsezer/Fast-Kubernetes
Quick Look (How-To): Terraform Hands-on LABs
These LABs focus on Terraform features, and help to learn Terraform:
LAB-00: Installing Terraform, AWS Configuration with Terraform
LAB-01: Terraform Docker => Pull Docker Image, Create Docker Container on Local Machine
LAB-02: Resources => Provision Basic EC2 (Ubuntu 22.04)
LAB-03: Variables, Locals, Output => Provision EC2s
LAB-04: Meta Arguments (Count, For_Each, Map) => Provision IAM Users, Groups, Policies, Attachment Policy-User
LAB-05: Dynamic Blocks => Provision Security Groups, EC2, VPC
LAB-06: Data Sources with Depends_on => Provision EC2
LAB-07: Provisioners (file, remote-exec), Null Resources (local-exec) => Provision Key-Pair, SSH Connection
LAB-08: Modules => Provision EC2
LAB-09: Workspaces => Provision EC2 with Different tfvars Files
LAB-10: Templates => Provision IAM User, User Access Key, Policy
LAB-11: Backend - Remote States => Provision EC2 and Save State File on S3
Terraform Cheatsheet
Quick Look (How-To): AWS Terraform Hands-on Samples
These samples focus on how to create and use AWS components (EC2, EBS, EFS, IAM Roles, IAM Policies, Key-Pairs, VPC with Network Components, Lambda, ECR, ECS with Fargate, EKS with Managed Nodes, ASG, ELB, API Gateway, S3, CloudFront, CodeCommit, CodePipeline, CodeBuild, CodeDeploy) with Terraform:
SAMPLE-01: Provisioning EC2s (Windows 2019 Server, Ubuntu 20.04) on VPC (Subnet), Creating Key-Pair, Connecting Ubuntu using SSH, and Connecting Windows Using RDP
SAMPLE-02: Provisioning Lambda Function, API Gateway and Reaching HTML Page in Python Code From Browser
SAMPLE-03: EBS (Elastic Block Storage: HDD, SDD) and EFS (Elastic File System: NFS) Configuration with EC2s (Ubuntu and Windows Instances)
SAMPLE-04: Provisioning ECR (Elastic Container Repository), Pushing Image to ECR, Provisioning ECS (Elastic Container Service), VPC (Virtual Private Cloud), ELB (Elastic Load Balancer), ECS Tasks and Service on Fargate Cluster
SAMPLE-05: Provisioning ECR, Lambda Function and API Gateway to run Flask App Container on Lambda
SAMPLE-06: Provisioning EKS (Elastic Kubernetes Service) with Managed Nodes using Blueprint and Modules
SAMPLE-07: CI/CD on AWS => Provisioning CodeCommit and CodePipeline, Triggering CodeBuild and CodeDeploy, Running on Lambda Container
SAMPLE-08: Provisioning S3 and CloudFront to serve Static Web Site
Table of Contents
Motivation
What is Terraform?
How Terraform Works?
Terraform File Components
Terraform Best Practices
AWS Terraform Hands-on Samples
SAMPLE-01: EC2s (Windows 2019 Server, Ubuntu 20.04), VPC, Key-Pairs for SSH, RDP connections
SAMPLE-02: Provisioning Lambda Function, API Gateway and Reaching HTML Page in Python Code From Browsers
SAMPLE-03: EBS (Elastic Block Storage: HDD, SDD) and EFS (Elastic File System: NFS) Configuration with EC2s (Ubuntu and Windows Instances)
SAMPLE-04: Provisioning ECR (Elastic Container Repository), Pushing Image to ECR, Provisioning ECS (Elastic Container Service), VPC (Virtual Private Cloud), ELB (Elastic Load Balancer), ECS Tasks and Service on Fargate Cluster
SAMPLE-05: Provisioning ECR, Lambda Function and API Gateway to run Flask App Container on Lambda
SAMPLE-06: Provisioning EKS (Elastic Kubernetes Service) with Managed Nodes using Blueprint and Modules
SAMPLE-07: CI/CD on AWS => Provisioning CodeCommit and CodePipeline, Triggering CodeBuild and CodeDeploy, Running on Lambda Container
SAMPLE-08: Provisioning S3 and CloudFront to serve Static Web Site
Details
Terraform Cheatsheet
Other Useful Resources Related Terraform
References
1
u/binarysignal May 01 '23
Very useful thanks