[go: up one dir, main page]

0% found this document useful (0 votes)
5 views3 pages

Terraform Detailed Notes

Terraform is an open-source infrastructure as code tool by HashiCorp that allows users to manage infrastructure using HCL. It is platform agnostic, supports versioning, and provides dependency management. Key concepts include providers, resources, variables, outputs, modules, and state, with a defined workflow for writing, initializing, planning, applying, and destroying infrastructure configurations.

Uploaded by

strix202
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Terraform Detailed Notes

Terraform is an open-source infrastructure as code tool by HashiCorp that allows users to manage infrastructure using HCL. It is platform agnostic, supports versioning, and provides dependency management. Key concepts include providers, resources, variables, outputs, modules, and state, with a defined workflow for writing, initializing, planning, applying, and destroying infrastructure configurations.

Uploaded by

strix202
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Terraform Detailed Notes

Terraform - Detailed Notes

1. Introduction

Terraform is an open-source infrastructure as code (IaC) tool created by HashiCorp that enables users to

define and provision infrastructure using a high-level configuration language known as HCL (HashiCorp

Configuration Language). It allows you to manage cloud, on-premises, and SaaS infrastructure in a

consistent way.

2. Why Use Terraform?

- Platform agnostic: works with AWS, Azure, GCP, etc.

- Infrastructure versioning and reproducibility

- Dependency management and graph-based execution

3. Key Concepts

- Providers: Interface to cloud platforms (e.g., aws, azurerm, google)

- Resources: Individual components (e.g., aws_instance, aws_s3_bucket)

- Variables: Inputs for dynamic configuration

- Outputs: Exported values post-deployment

- Modules: Reusable configurations

- State: Tracks current infrastructure

4. Terraform Workflow

- Write: Define resources in .tf files

- Init: terraform init


Terraform Detailed Notes

- Plan: terraform plan

- Apply: terraform apply

- Destroy: terraform destroy

5. Sample Code

provider "aws" {

region = "us-west-2"

resource "aws_instance" "web" {

ami = "ami-0c55b159cbfafe1f0"

instance_type = "t2.micro"

6. Remote State Example

terraform {

backend "s3" {

bucket = "my-tfstate"

key = "dev/terraform.tfstate"

region = "us-west-2"

7. Best Practices
Terraform Detailed Notes

- Use remote backend with locking

- Use variables and modules for reusability

- Maintain state securely

- Validate code with terraform validate and fmt

You might also like