Hashicorp Terraform – Introduction to Infrastructure as Code
Keep adding new skills with 10,000+ programs for $239 (usually $399). Save now.
Hashicorp Terraform – Introduction to Infrastructure as Code
Included with
Ask Coursera
Recommended experience
Recommended experience
What you'll learn
Master the core components and workflows of Terraform for managing cloud infrastructure.
Gain hands-on experience with Terraform and OpenTofu, from installation to deployment.
Learn best practices for structuring, maintaining, and writing reusable Terraform code.
Skills you'll gain
Tools you'll learn
Details to know
May 2026
14 assignments
See how employees at top companies are mastering in-demand skills
There are 13 modules in this course
This course features Coursera Coach!
A smarter way to learn with interactive, real-time conversations that help you test your knowledge, challenge assumptions, and deepen your understanding as you progress through the course. Dive into the world of Infrastructure as Code (IaC) with Terraform, a powerful tool for automating infrastructure management. This course takes you step by step through key concepts such as Terraform's core components, its workflow, and how to efficiently manage and scale cloud resources. You'll learn not just the technical aspects, but also the best practices for writing, maintaining, and deploying infrastructure as code using Terraform and OpenTofu. You’ll begin with the foundational concepts of Terraform, including understanding the HashiCorp Configuration Language (HCL) and the role it plays in defining infrastructure. The course progresses with hands-on demonstrations, taking you through the process of installing and configuring Terraform and OpenTofu, setting up AWS, Azure, and GitHub credentials, and understanding how to organize and structure your Terraform files for maximum efficiency. The journey continues with an exploration of Terraform's state management, CLI commands, and meta-arguments, followed by detailed tutorials on writing reusable code and working with modules. With real-world examples and expert insights, you’ll quickly build expertise in managing complex infrastructure projects. This course is designed for anyone interested in learning Terraform, whether you’re a beginner or have some experience with cloud infrastructure. Ideal for developers, DevOps engineers, and IT professionals, it requires basic understanding of cloud platforms and infrastructure. No advanced programming skills are required, but familiarity with cloud concepts will be helpful. By the end of the course, you will be able to efficiently use Terraform to manage infrastructure, implement best practices for writing reusable code, automate cloud resource management, and troubleshoot issues in Terraform configurations.
In this module, we will introduce you to the basics of Terraform, including key concepts, components, and benefits. You will also learn about HashiCorp Configuration Language (HCL) and OpenTofu, which you will use throughout this course.
What's included
6 videos1 reading1 assignment
6 videos•Total 103 minutes
- Course Introduction•14 minutes
- Introduction to Terraform•18 minutes
- Core Components and Benefits of Terraform•22 minutes
- Learn the Basics of HashiCorp Configuration Language (HCL)•33 minutes
- Introduction to OpenTofu•15 minutes
- How to Use OpenTofu in This Course•2 minutes
1 reading•Total 10 minutes
- Full Course Resource•10 minutes
1 assignment•Total 15 minutes
- Introduction - Assessment•15 minutes
In this module, we will guide you through the process of preparing your environment for Terraform and OpenTofu. This includes installation steps for various systems, setting up credentials, and configuring your IDE for efficient development.
What's included
9 videos1 assignment
9 videos•Total 40 minutes
- Section Intro - Preparing Your Environment•2 minutes
- Installing Terraform on MacOS and Linux•5 minutes
- Installing Terraform on Windows•4 minutes
- Installing Terraform Auto-Complete•4 minutes
- Installing OpenTofu on Your Local Machine•4 minutes
- Installing Microsoft Visual Studio Code (IDE)•5 minutes
- Setting Up Credentials for Terraform and OpenTofu – AWS•8 minutes
- Setting Up Credentials for Terraform and OpenTofu – Azure•4 minutes
- Setting Up Credentials for Terraform and OpenTofu – GitHub•5 minutes
1 assignment•Total 15 minutes
- Preparing Your Environment - Assessment•15 minutes
In this module, we will explore how to organize Terraform configuration files effectively. This will help you manage and maintain your infrastructure projects with ease and efficiency.
What's included
1 video1 assignment
1 video•Total 12 minutes
- Terraform File Structure and Organization•12 minutes
1 assignment•Total 15 minutes
- Terraform File Structure and Organization - Assessment•15 minutes
In this module, we will dive into Terraform state, explaining its crucial role in managing infrastructure changes and discussing how to securely store state files, both locally and remotely.
What's included
3 videos1 assignment
3 videos•Total 11 minutes
- Section Intro - Terraform State•1 minute
- Introduction to Terraform State•8 minutes
- Where Can I Store Terraform State?•2 minutes
1 assignment•Total 15 minutes
- Understanding Terraform State - Assessment•15 minutes
In this module, we will cover the core Terraform workflow. You will learn to initialize, plan, apply, and destroy infrastructure configurations using essential Terraform commands.
What's included
5 videos1 assignment
5 videos•Total 25 minutes
- Section Intro - Terraform Workflow•1 minute
- Terraform Init•6 minutes
- Terraform Plan•8 minutes
- Terraform Apply•5 minutes
- Terraform Destroy•5 minutes
1 assignment•Total 15 minutes
- Terraform Workflow - Assessment•15 minutes
In this module, we will introduce the Terraform CLI and demonstrate how to use it effectively for managing infrastructure. You’ll also learn how to maximize your efficiency with advanced CLI techniques.
What's included
5 videos1 assignment
5 videos•Total 51 minutes
- Section Intro - Terraform CLI•1 minute
- Introduction to the Terraform CLI•14 minutes
- Demo - Terraform CLI•18 minutes
- Making the Most of the Terraform CLI•9 minutes
- Demo - Making the Most of the Terraform CLI•8 minutes
1 assignment•Total 15 minutes
- Terraform CLI - Assessment•15 minutes
In this module, we will explore the different Terraform block types, including provider, resource, and output blocks, and how they define infrastructure. You'll also learn how to use variables and modules for more flexible code.
What's included
12 videos1 assignment
12 videos•Total 135 minutes
- Section Intro - Terraform Block Types•1 minute
- Introduction to Terraform Block Types•3 minutes
- Provider Block•14 minutes
- Resource Block•24 minutes
- Data Block•15 minutes
- Variable Block•15 minutes
- Variable Block - Types of Variables•12 minutes
- Variable Block - Assigning Values to Variables•13 minutes
- Output Block•7 minutes
- Terraform Block•12 minutes
- Module Block•9 minutes
- Import Block•8 minutes
1 assignment•Total 15 minutes
- Terraform Block Types - Assessment•15 minutes
In this module, we will guide you through writing your first Terraform configuration. You will gain hands-on experience in defining and deploying basic infrastructure with Terraform.
What's included
1 video1 assignment
1 video•Total 4 minutes
- Section Intro - Writing Your First Terraform Configurations•4 minutes
1 assignment•Total 15 minutes
- Writing Your First Terraform Configurations - Assessment•15 minutes
In this module, we will teach you how to use Terraform's official documentation to find solutions and examples. This will empower you to troubleshoot and enhance your Terraform configurations.
What's included
1 video1 assignment
1 video•Total 14 minutes
- Learn How to Use Terraform Documentation•14 minutes
1 assignment•Total 15 minutes
- Using Terraform Documentation - Assessment•15 minutes
In this module, we will show you how to enhance your Terraform code for reusability. You'll learn about dynamic values, locals, and meta-arguments to streamline and optimize your Terraform configurations.
What's included
18 videos1 assignment
18 videos•Total 119 minutes
- Section Intro - Making Code Reusable•2 minutes
- The "Why" Behind Reusability•6 minutes
- Enhancing Code with Dynamic Values•13 minutes
- Demo - Enhancing Code with Dynamic Values•7 minutes
- Using Locals to Avoid Code Duplication•10 minutes
- Demo - Using Locals to Avoid Code Duplication•9 minutes
- Meta-Arguments - Write Less Code, Deploy More Efficiently•7 minutes
- Using the count Meta-Argument•4 minutes
- Demo - Using the count Meta-Argument•7 minutes
- Using the for_each Meta-Argument•5 minutes
- Demo - Using the for_each Meta-Argument•7 minutes
- Using the depends_on Meta-Argument•3 minutes
- Demo - Using the depends_on Meta-Argument•5 minutes
- Using the provider Meta-Argument•6 minutes
- Demo - Using the provider Meta-Argument•4 minutes
- Using the lifecycle Meta-Argument•3 minutes
- Demo - Using the lifecycle Meta-Argument•5 minutes
- Using Built-In Functions to Standardize Code•18 minutes
1 assignment•Total 15 minutes
- Making Code Reusable - Assessment•15 minutes
In this module, we will introduce you to Terraform modules, explaining how they help organize and reuse your code. You'll also learn how to write and use your own modules for standardized, maintainable code.
What's included
4 videos1 assignment
4 videos•Total 74 minutes
- Section Intro - Modules•2 minutes
- Introduction to Modules•24 minutes
- Using the Terraform Registry•25 minutes
- Writing and Using Your Own Modules•23 minutes
1 assignment•Total 15 minutes
- Introduction to Modules - Assessment•15 minutes
In this module, we will explore how to manage and maintain your Terraform code in the long term. You’ll learn strategies for upgrading resources, targeting specific changes, and importing existing resources.
What's included
4 videos1 assignment
4 videos•Total 36 minutes
- Section Intro - Managing and Maintaining Your Code•3 minutes
- Targeting the Replacement and Removal of Specific Resources•9 minutes
- Upgrading a Provider or Module•9 minutes
- Importing an Existing Resource into Terraform•15 minutes
1 assignment•Total 15 minutes
- Managing and Maintaining Your Terraform Code - Assessment•15 minutes
In this final module, we will congratulate you on completing the course and encourage you to apply the knowledge gained to real-world projects. We’ll also provide guidance for continued learning in Terraform and IaC.
What's included
1 video2 assignments
1 video•Total 4 minutes
- You Did It!!!•4 minutes
2 assignments•Total 75 minutes
- Full Course Assessment•60 minutes
- Full Course Practice Assessment•15 minutes
Instructor
Why people choose Coursera for their career
Frequently asked questions
Infrastructure as Code (IaC) is the practice of managing and provisioning computing infrastructure through machine-readable configuration files, rather than through manual processes. IaC allows for automated, consistent, and scalable infrastructure management, which is essential in today's fast-paced development environments. HashiCorp Terraform is one of the most popular tools for implementing IaC, enabling teams to define, provision, and manage infrastructure in a declarative way.
This course provides an introduction to HashiCorp Terraform, a tool for managing infrastructure as code. It covers the basics of Terraform, including its core components, the HashiCorp Configuration Language (HCL), and how to work with both Terraform and OpenTofu. Additionally, the course delves into setting up your environment, managing Terraform state, and utilizing different block types for defining resources. You will also learn how to make your code reusable and maintainable through various Terraform workflows and modules.
After completing this course, you will have the skills to use Terraform to define and provision infrastructure. You will be able to work with both Terraform and OpenTofu, manage infrastructure resources through the Terraform CLI, and apply best practices for writing reusable and modular code. You'll also be proficient in setting up and managing your environment for Terraform development and be able to confidently manage infrastructure on cloud platforms like AWS, Azure, and GitHub.
More questions
Financial aid available,
