Learn Devops Infrastructure Automation With Terraform
Tags: DevOps
Learn how to automate your infrastructure with terraform. Covers Terraform with AWS, Packer, Docker, ECS, EKS, Jenkins
Last updated 2022-01-10 | 4.5
- Understand- use and apply terraform
- including advanced terraform features
- Use terraform to provision AWS resources
- Prepare for the HashiCorp Terraform Certification with lectures aligned with the exam objectives
What you'll learn
* Requirements
* To be able to do the demos yourself* you should have an AWS account. You can open one for free and I explain how to open one in the course.
Description
Terraform has gained a lot in popularity lately and is the tool you need to master if you are or about to get into a Ops / DevOps role. You typically use a technology like Ansible, Chef, or Puppet to automate the provisioning of software. Terraform starts from the same principle, infrastructure as code, but focusses on the automation of the infrastructure itself. Your whole Cloud infrastructure (instances, volumes, networking, IPs) can be described in terraform.
In this course you'll learn how to use terraform to automate your infrastructure. I will first show you the basics of terraform and will then explain how to automate infrastructure on AWS using terraform. You can open an AWS account for free to do the labs. I also provide a lot of code examples which you can immediately use to automate your own infrastructure.
Update (Oct-2016):
Added AWS Autoscaling lectures
Added Terraform+Packer Jenkins integration lectures
Added Terraform with Docker on AWS (ECR and ECS)
Added Terraform with Jenkins workflow using ECR and ECS
Update (Dec-2016):
Added a lecture about useful terraform commands
Added a demo on how to use terraform show/graph/taint/untaint/import
Added a lecture and demo about Elastic Beanstalk on AWS
Update (Jun-2018):
Terraform for Windows setup + puttygen
Interpolation
Conditionals
Built-in functions
Module development with an ECS + ALB module demo
Setting up a hosted Kubernetes cluster using AWS EKS
Update (Nov-2019):
Terraform-0.12 updates
Lectures covering new variable approach in terraform-0.12
For & For Each loops
Update (March-2020):
CodePipeline lectures
Updated lectures with new AWS UI
Updated jenkins-packer-demo demo
Update (December-2020):
Advanced Module development
Lectures and demos covering new Terraform 0.13 features
Terraform lock file (terraform 0.14)
State manipulation
Update (December-2020):
A complete new section on the HashiCorp Terraform Certification has now been added!
Update (January-2022):
Refactoring modules with the "moved" block
This course includes english captions.
Who this course is for:
- This course is great if you're in an Ops or DevOps position and you want to learn about automation using terraform
Course content
14 sections • 123 lectures
Course Introduction Preview 03:06
Discussions and Support Preview 00:15
Procedure Document Preview 01:24
Contains useful information for this course
Introduction Preview 02:59
Introduction to what terraform is.
Terraform installation Preview 02:24
An explanation of how to install terraform on Windows / MacOS / Linux
Terraform Installation (on Windows) Preview 07:04
Terraform installation using Vagrant Preview 02:34
An alternative installation procedure using Vagrant. This will allow you to use exactly the same setup I have!
Understanding terraform HCL Preview 13:10
In this lecture I'll explain the basics of HCL (the HashiCorp Configuration Language) by using simple examples
First steps in terraform - AWS Setup Preview 05:03
First steps in terraform: learn how to spin up your first instance. First: AWS account setup.
First steps in terraform - Spinning up an instance Preview 06:47
First steps in terraform: learn how to spin up your first instance
First steps in terraform - summary Preview 01:48
Summary of the first steps in terraform
Terraform Variable Types Preview 03:04
Quiz 1
Test your knowledge
Variables Preview 04:35
How to use variables in terraform
Demo: variables Preview 04:23
A demo of how to use variables in terraform
Software Provisioning Preview 05:47
Provision software on your instance using chef / ansible / puppet / shell scripts.
Demo: Software provisioning Preview 06:59
A demo to show you how to provision software using a shell script
Demo: Windows Server Provisioning Preview 07:29
In this demo I'll show you how to use WinRM to provision a Windows Server
Outputting attributes Preview 02:40
Using outputs in terraform you can output information on screen
Demo: Outputting Attributes Preview 02:53
A demo showing how outputs work
Remote state Preview 06:41
The terraform.tfstate can be stored remotely. This helps collaboration when using Terraform within a team.
Demo: Remote state Preview 03:26
This demo shows how to store the remote terraform state in an S3 bucket. By changing a few flags you can also use it to save it to a consul cluster.
Data Sources Preview 02:50
You can use datasources to retrieve external information like AWS IP addresses, AMI IDs, and so on.
Demo: Data Sources Preview 02:14
A demo using the AWS Region IP ranges to create a security group that only allows access from eu-west-1 and eu-central-1 in AWS.
Templates Preview 03:10
You can use a template provider in terraform to render templates into strings
Templates in terraform 0.12 onwards Preview 03:47
How to use templates in terraform 0.12 onwards
Other Providers Preview 02:30
There's more than just AWS in terraform. An overview of other providers.
Modules Preview 02:50
An overview on how to use modules in terraform
Demo: An external Module Preview 03:18
A demo showing you how to use external modules. This demo will launch a full consul cluster using an external terraform module
Terraform Commands Overview Preview 05:28
An overview of useful terraform commands
Demo: Terraform Commands Preview 08:46
A demo of a few useful terraform commands, including terraform show, terraform graph, terraform import, terraform taint, terraform untaint
Quiz 2
Test your knowledge!
Introduction to VPCs Preview 02:37
An introduction to AWS VPCs (Virtual Private Cloud) - Part 1
Introduction to VPCs - Part II Preview 05:02
An introduction to AWS VPCs (Virtual Private Cloud) - Part 2
Introduction to VPCs - Part III Preview 03:25
An introduction to AWS VPCs (Virtual Private Cloud) - Part 3
Demo: VPCs and NAT Preview 05:59
A demo showing you how to launch a VPC with an internet gateway and a NAT gateway
Launching EC2 instances in the VPC Preview 04:45
Now that we have created our VPC, we can launch EC2 instances in the VPC
Demo: Launching instances in a VPC Preview 03:55
This is a demo showing you how to launch instances within a VPC
Quiz 3
Test your knowledge!
EBS Volumes Preview 03:32
This lecture shows you how to use EBS (Elastic Block Storage) with an instance
Demo: EBS volumes Preview 04:55
This demo shows you how to attach EBS volumes to EC2 instances
Userdata Preview 05:17
Userdata can be used to execute commands at launch time
Demo: Userdata Preview 07:17
In this demo userdata will be used to format and mount an EBS volume if no filesystem is present. This way EBS volumes can be persisted in an automated way when the instance needs replacement.
Static IPs, EIPs, and Route53 Preview 04:49
This lecture explains the difference between private static IPs, EIPs and DNS (Route53)
Demo: Route53 Preview 03:33
This demo shows how to use Route53 to create DNS zones in AWS
RDS Preview 07:10
This lecture explains how to spin up an RDS (relational database service) instance with terraform on AWS
Demo: RDS Preview 04:19
In this demo I will spin up an RDS instance (using RDS subnets, RDS parameter groups, and security groups) and will connect from an EC2 instance to MariaDB..
IAM Preview 05:18
IAM stands for Identity & Access Management. In this lecture I explain the different possibilities for access management. I explain users, groups, policies, and roles.
Demo: IAM users and groups Preview 00:55
In this demo I create a group with an AWS group policy and attach it to a user.
IAM Roles Preview 02:14
IAM roles can be used to assume (temporary) access. In this lecture I explain how this works.
Demo: IAM Roles Preview 04:03
IAM roles can be used to assume (temporary) access. In this lecture I show you how to attach a role to an EC2 instance that will give permissions to read/write to an S3 bucket.
Autoscaling Preview 07:46
A lecture explaining how to setup autoscaling in AWS using terraform
Demo: Autoscaling Preview 04:40
A demo of autoscaling using terraform on AWS
Introduction to Elastic Load Balancers (ELB) Preview 02:52
Introduction into Elastic Load Balancers and Application Load Balancers in AWS
ELBs in terraform Preview 04:38
This lecture explains how to use ELBs in terraform with a static list of instances and an autoscaling group
Demo: ELB with autoscaling Preview 06:47
A demo showing how to use terraform with an ELB together with autoscaling
Application Load Balancer (ALB) Preview 04:10
An introduction of how the Application Load Balancer (ALB) works in terraform
Elastic Beanstalk Preview 02:51
ElasticBeanstalk (AWS's PaaS solution) setup using Terraform
Demo: Elastic Beanstalk Preview 09:36
ElasticBeanstalk (AWS's PaaS solution) setup demo using Terraform
Quiz 4
Test your knowledge!
Introduction to Interpolation Preview 06:34
Conditionals Preview 01:31
Demo: Interpolation and Conditionals Preview 06:02
Built-in Functions Preview 08:00
Demo: Built-in Functions Preview 07:04
For and For Each Loops Preview 05:39
Since terraform 0.12 you can use loops with for and for each. This lecture explains how and when to use for/foreach
Demo: For loops Preview 06:15
For loops demo in terraform
Demo: For each loops Preview 03:56
For-each loops demo in terraform
Terraform Project Structure Preview 03:02
Demo: Project Structure in Terraform Preview 10:15
Terraform lock file Preview 04:09
The terraform providers lock file was introduced in terraform 0.14 and will from now on keep track of your provider and module dependency versions.
Manipulating state Preview 06:27
Terraform uses a state file (local / remote) that you can list resources of, read, and manipulate
Demo: Manipulating state Preview 08:55
Demo showing how to manipulate the state file in terraform
Packer introduction Preview 03:24
With packer AMIs can be created that can be used to launch an EC2 instance.
Terraform with Packer and Jenkins Preview 03:36
Where does Terraform fit in the DevOps organization? In this lecture I show you an example workflow with terraform, packer and jenkins
Demo: Packer with terraform Preview 02:55
Packer can be integrated with terraform. This workflow shows how to create a workflow where packer creates the AMI and terraform launches the EC2 instance with the correct AMI ID
Terraform with Packer and Jenkins (Part I) Preview 07:07
This demo shows a full cycle of an app in github, the building of a custom AMI with packer in Jenkins and the provisioning and deployment with Terraform
Terraform with Packer and Jenkins (Part II) Preview 15:45
This demo shows a full cycle of an app in github, the building of a custom AMI with packer in Jenkins and the provisioning and deployment with Terraform
Quiz 5
Test your knowledge
Introduction to Docker Preview 04:54
This lectures gives an introduction of Docker
Docker on AWS Preview 03:18
This lecture explains how to use Docker on AWS using terraform
Building Docker images Preview 06:16
This lecture shows how to build docker images that can be pushed on ECR
Demo: Build NodeJS app and push to ECR Preview 04:26
In this demo I show how to push a docker built image to ECR
ECS - Part I Preview 04:33
This lecture explains part I of the setup of ECS using terraform, with autoscaling and IAM roles
ECS - Part II Preview 06:19
This lecture explains part II of the setup of ECS using terraform, with autoscaling, IAM roles, ECS task definitions and ECS Service definitions
Demo: Running a NodeJS app on ECS Preview 06:06
This demo shows you how to run the pushed NodeJS app on ECS
Demo: Terraform with Jenkins, ECR and ECS Preview 10:33
In this demo I show you how to run a Jenkins workflow to build docker images, push the image to ECR, and use terraform to update ECS with the latest docker image
Introduction to Module Development Preview 01:32
ECS + ALB Module Overview Preview 04:49
Demo: ECS + ALB Module (part I) Preview 11:12
Demo: ECS + ALB Module (Part II) Preview 07:13
Demo: ECS + ALB Module (Part III) Preview 07:40
Introduction to Advanced Module Development Preview 09:12
What features were released in terraform 0.12 and 0.13 to allow us to do more advanced module development?
The difference between count and for_each Preview 04:39
This lectures explains what the difference between count and for_each is in terraform
Demo: for_each with modules Preview 15:32
Demo: Complex data types and the flatten() function Preview 20:47
This demo explains how to use the flatten() function with complex data types.
Refactoring modules Preview 09:19
Refactoring modules with the "moved" block in terraform
Introduction to AWS CodePipeline Preview 08:27
Introduction to CodePipeline with CodeCommit, CodeBuild, and CodeDeploy. Includes architecture diagrams on how to deploy to ECS with CodeDeploy
Demo: CodePipeline (part I) Preview 13:21
Demo showing how to deploy to ECS with CodePipelines, CodeCommit, CodeBuild, CodeDeploy, using green/blue deployments.
Demo: CodePipeline (part II) Preview 05:15
Demo showing how to deploy to ECS with CodePipelines, CodeCommit, CodeBuild, CodeDeploy, using green/blue deployments.
Demo: CodePipeline (Part III) Preview 14:57
Demo showing how to deploy to ECS with CodePipelines, CodeCommit, CodeBuild, CodeDeploy, using green/blue deployments.
Introduction to AWS EKS Preview 03:22
Demo: AWS EKS Preview 16:43
Introduction to the HashiCorp Infrastructure Automation Certification Preview 02:09
Introduction to the terraform certification of Hashicorp. This section will go over the learning objectives provided by Hashicorp.
Understanding Infrastructure as Code (IaC) Preview 06:38
Understanding the advantages of Infrastructure as Code and Terraform
Understanding terraform basics Preview 08:58
Understanding terraform basics like terraform core vs providers, versioning, provider parameters and the terraform block
Understanding terraform basics - provisioning Preview 05:24
When to use provisioners
Using the Terraform CLI Preview 09:42
A lecture describing how to use the terraform CLI (the terraform commands). Also contains a section on how to use debug logging in terraform
Interact with terraform modules Preview 03:48
Interact with modules in terraform
Interact with terraform modules: inputs & outputs Preview 04:13
Interact with modules in terraform: inputs & outputs explained.
The terraform module registry Preview 06:42
This lectures is about the terraform module registry, how to use modules from the registry, and how the version numbering works.
The terraform workflow Preview 05:05
Navigating the terraform workflow
Implement and maintain state (part I) Preview 06:03
This lecture talks about backends (local, remote) and locking
Implement and maintain state (part II) Preview 06:01
Standard backends, authentication methods, partial backend configuration, terraform refresh, and secrets in the state file
Read, generate and modify configuration (input variables) Preview 11:00
A lecture explaining the details of input variables (types, complex types, validation, etc)
Read, generate and modify configuration (output variables, locals) Preview 05:24
A lecture covering the details of output variables and locals
Resources and Datasources Preview 07:55
This lectures explains the difference between resources and datasources. It also shows how terraform determines dependencies.
Resources and Datasources (resource addresses) Preview 06:16
Resource addresses explained.
Resources and datasources (functions and loops) Preview 02:39
This lecture explains functions and loops
Secret Injection (Long lived vs short lived) Preview 04:46
This lecture explains the difference between long lived and short lived credentials
Terraform Cloud Preview 06:05
Explains Terraform Cloud, Sentinel, and workspaces in Terraform Cloud
Congratulations Preview 00:27
Course Completion lecture