devops

Terraform State Explained with Examples

Learn what Terraform state is on Ubuntu — terraform.tfstate purpose, configuration vs real infrastructure, terraform show and state list, drift, sensitive data, Git rules, local vs remote state, and a full local_file …

Deepak Prasad12 min read
devops

Terraform Providers: Configuration and Aliases

Learn Terraform providers on Ubuntu — required_providers, provider blocks, aliases, terraform init installation, terraform providers, local and Docker examples, and common provider errors without cloud credentials.

Deepak Prasad14 min read
devops

terraform destroy Command with Examples

Learn terraform destroy on Ubuntu with the Docker provider — provision disposable resources, preview with plan -destroy, confirm or auto-approve teardown, use -target safely, and understand state and configuration after …

Deepak Prasad12 min read
devops

terraform validate Command with Examples

Learn terraform validate on Ubuntu — what it checks, syntax and schema errors with real output, validate -json for automation, init -backend=false for CI, and how validate differs from plan and fmt.

Deepak Prasad12 min read
devops

terraform fmt Command with Examples

Learn terraform fmt on Ubuntu — rewrite .tf files to canonical style, use -check and -diff, format recursively, enforce formatting in CI, and see how fmt differs from terraform validate.

Deepak Prasad12 min read
devops

terraform apply Command with Examples

Learn terraform apply on Ubuntu with the Docker provider — interactive approval, saved plans, -auto-approve, -var and -var-file, in-place updates, -replace, partial failure behavior, and independent resource …

Deepak Prasad13 min read
devops

terraform plan Command with Examples

Learn terraform plan on Ubuntu with the Docker provider — read execution plan output, preview create/update/replace/destroy, save plans with -out, and use -var, -destroy, -refresh-only, -detailed-exitcode, -target, and …

Deepak Prasad15 min read
devops

Terraform init Command with Examples

Learn what terraform init does on Ubuntu — backend and provider setup, module downloads, .terraform directory, .terraform.lock.hcl, common flags, and when to reinitialize a working directory.

Deepak Prasad13 min read
devops

Terraform HCL Syntax and Configuration Files

Learn Terraform HCL syntax on Ubuntu — blocks, labels, arguments, expressions, comments, .tf and .tf.json files, multi-file layouts, terraform fmt, validate, and common syntax errors with real fixes.

Deepak Prasad11 min read
devops

Set Up a Terraform Lab on Ubuntu with Docker

Prepare a single Ubuntu VM with Docker, helper tools, isolated Terraform working directories, and optional plugin cache so you can practice init, plan, apply, and destroy without cloud credentials.

Deepak Prasad14 min read
devops

Install Terraform on Ubuntu

Install Terraform on Ubuntu 26.04 from the official HashiCorp apt repository, verify with terraform version, install a specific package version or upgrade, install the release binary with checksum verification, and …

Deepak Prasad12 min read
devops

What Is Terraform? Infrastructure as Code Explained

Learn what Terraform is and how infrastructure as code works — declarative configuration, providers, resources, state, the init plan apply workflow, realistic use cases, and a local example on Ubuntu without a cloud …

Deepak Prasad10 min read
devops

Terraform Architecture: How Terraform Works

Learn how Terraform works architecturally on Ubuntu — configuration, Terraform Core, provider plugins, dependency graphs, how state differs from desired configuration, what init plan and apply do internally, resource …

Deepak Prasad12 min read
devops

HCP Terraform Workspaces and Projects

Organize Terraform in HCP Terraform on Ubuntu — how a workspace holds one collection of infrastructure with its own state and runs, how projects group and scope those workspaces, how HCP workspaces differ from Terraform …

Deepak Prasad21 min read
devops

HCP Terraform Variables and Variable Sets

Supply values to HCP Terraform runs from an Ubuntu host — how Terraform variables differ from environment variables, how workspace variables and variable sets at workspace, project, and organization scope combine, the …

Deepak Prasad25 min read
devops

HCP Terraform Tutorial: CLI and Remote Runs

Connect the Terraform CLI to HCP Terraform on Ubuntu — authenticate with terraform login, add a cloud block, initialize a CLI-driven workspace, trigger remote plan and apply runs that stream to your terminal, confirm …

Deepak Prasad24 min read
devops

HCP Terraform Collaboration and Governance

Understand HCP Terraform governance on Ubuntu — how teams and permissions scope access across organization, project, and workspace levels, how Sentinel and OPA policy sets evaluate plans, why teams use the private …

Deepak Prasad13 min read
devops

Terraform Provider Aliases with Modules

Pass default and aliased provider configurations into Terraform child modules on Ubuntu — provider requirements versus configurations, automatic inheritance, providers meta-argument mapping, configuration_aliases, count …

Deepak Prasad17 min read
devops

Fix Terraform "Functions May Not Be Called Here" Error

Fix Terraform Functions may not be called here on Ubuntu — reproduce the error from timestamp in a variable default, move the calculation to locals, use functions in resource expressions, dynamic null-default fallback, …

Deepak Prasad10 min read
devops

Remove a Terraform Resource Without Destroying It

Stop managing Terraform resources without deleting real infrastructure on Ubuntu — why removing a block plans destroy, removed block with destroy false, terraform state rm, independent verification with cat and docker …

Deepak Prasad12 min read
devops

Terraform Module Outputs with count and for_each

Read Terraform module outputs when count or for_each creates multiple instances — single module references, indexed and splat syntax, conditional count with one, keyed for_each access, aggregating outputs with for …

Deepak Prasad13 min read
devops

Terraform templatefile with JSON and YAML

Generate JSON and YAML from Terraform without broken escaping — templatefile basics, passing template variables, jsonencode and yamlencode for nested structures, template loops when text formatting matters, heredoc …

Deepak Prasad13 min read
devops

Terraform try vs can Functions

Compare Terraform try and can on Ubuntu — missing attribute fallbacks, can validation guards, normalization locals for decoded YAML and JSON, errors try cannot catch, lookup and optional alternatives, and common masking …

Deepak Prasad15 min read
devops

Terraform flatten with Nested Maps and for_each

Flatten nested Terraform maps into for_each-ready keyed maps on Ubuntu — nested for expressions, flatten list of lists, stable composite keys, terraform_data instances, state addresses, key stability when input shrinks, …

Deepak Prasad11 min read
devops

Terraform Optional Object Attributes and Defaults

Use Terraform optional() inside object type constraints on Ubuntu — required vs optional attributes, default values, nested optional objects, omitted vs explicit null, map(object) inputs, tfvars overrides, and common …

Deepak Prasad15 min read
devops

Terraform "(known after apply)" Explained

Understand Terraform known after apply on Ubuntu — normal computed unknowns in plan output, when unknown values break count and for_each, static map keys with apply-time values, deferred data sources, module output …

Deepak Prasad10 min read
devops

Fix Terraform "Attempt to Get Attribute from Null Value"

Fix Terraform Attempt to get attribute from null value on Ubuntu — null parent object access, optional attributes versus entire object null, default empty object patterns, conditional and try guards, nested null parents, …

Deepak Prasad14 min read
devops

Fix Terraform "Saved Plan Is Stale" Error

Fix Terraform Saved plan is stale on Ubuntu — reproduce stale saved plan after state serial changes, distinguish lineage mismatch errors, regenerate plan -out before apply, CI race causes, locking and concurrency …

Deepak Prasad10 min read
devops

Fix Terraform Undeclared Variable Errors

Fix Terraform undeclared variable errors on Ubuntu — Reference to undeclared input variable versus Value for undeclared variable, missing variable blocks, extra terraform.tfvars keys, -var and -var-file mistakes, module …

Deepak Prasad10 min read
devops

Fix Terraform "Error: Cycle" Dependency Error

Fix Terraform Error Cycle on Ubuntu — mutual resource references, module dependency loops, unnecessary depends_on chains, terraform graph with draw-cycles, breaking cycles with locals and one-direction flow, and …

Deepak Prasad10 min read