What you will learn in Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu
Infrastructure as Code with Terraform and OpenTofu
Chapter by chapter
Concepts explained in this book
- TerraformThe Terraform language is a declarative configuration language for defining infrastructure resources and their relationships.
- moduleAn application module is a Terraform module that contains the infrastructure configuration for an application.
- deployment pipelineA CI/CD pipeline is an automated workflow that builds, tests, and delivers software through continuous integration and continuous delivery or deployment.
- Terraform testingThe Terraform testing framework is Terraform's built-in framework for defining and executing tests for Terraform configurations and modules.
- Terraform state fileA file containing Terraform's persisted representation of managed infrastructure and configuration state.
- Terraform providerA provider server is the running implementation of a Terraform provider that serves provider operations to Terraform.
- terraform resourceA Terraform resource is a configuration-defined representation of an infrastructure object that Terraform can create and manage.
- testA test case is an individual set of checks, inputs, and expected outcomes for evaluating software or infrastructure behavior.
- inputAn input value is a value supplied to configure a Terraform input variable.
- Terraform data sourceA Terraform data source is a configuration construct that reads information about existing infrastructure or external data without managing the resulting object.
- Terraform backendA Terraform configuration block that declares the backend configuration for a module.
- Terraform planThe plan phase is the stage of an infrastructure-as-code workflow that computes a proposed set of resource changes.
- count meta-argumentcount is a Terraform meta-argument that creates zero or more instances of a resource or module based on an integer expression.
- OpenTofu CLIOpenTofu is an open-source infrastructure-as-code tool derived from Terraform and designed to process Terraform-compatible configuration.
- directed acyclic graphA directed acyclic graph is a directed graph whose edges encode dependencies and whose vertices cannot be reached again by following directed paths.
- JSONJSON is a text-based data interchange format that represents structured values and objects.
- infrastructure as codeInfrastructure as code is the practice of defining and managing infrastructure through machine-readable configuration files and software development workflows.
- provisionerA Terraform provisioner is a feature that executes custom code locally or on a separate machine, typically to configure infrastructure after creation.
- TerratestTerratest is a Go library for testing infrastructure code and infrastructure deployments.
- backward compatibilityBackward compatibility is the ability of a newer software version to preserve the behavior and interfaces expected by existing users or dependent code.
- for_each meta-argumentThe for_each meta-argument creates one Terraform resource or module instance for each item in a collection or set.
- dependency version requirementA version constraint specifies the versions of a software tool that are permitted or expected to work with a project.
- MakefileA makefile is a configuration file that defines targets and the commands used to build, test, or automate tasks in a software project.
- terraform initterraform init is the Terraform CLI command that initializes a working directory, including provider, module, and backend setup.
- submoduleA submodule is a Terraform module distributed as part of another module and generally coupled to its parent module.
- openid connectOpenID Connect is an identity layer built on OAuth 2.0 that enables clients to verify a user's identity and obtain basic profile information from an authorization server.
- Terraform workspaceA Terraform Cloud workspace is an independent Terraform Cloud state and execution context that does not share code or modules with other workspaces.
- GitOpsA GitOps workflow is an infrastructure or deployment workflow in which Git repositories serve as the source of truth for declarative changes and automation applies those changes.
- HashiCorp Configuration LanguageTerraform HCL is the Terraform-specific dialect of HCL, including Terraform's syntax, resources, and functions.
- TflintTFLint is a Terraform linter that detects possible errors, deprecated constructs, and convention violations in Terraform configurations.
- provider blockA provider block is a Terraform configuration block that configures a provider's settings, such as the target cloud region.
- driftDrift is a discrepancy between the infrastructure or files Terraform expects and the resources or files actually present.
- external providerThe Terraform external provider is a provider that obtains data by executing an external program and exposes the program's output as a data source.
- Terraform outputA Terraform output is a named configuration value exposed from a module for display or consumption by its caller.
- functionA helper function is a reusable function that encapsulates a common operation for simpler use by other code.
- resource graphA Terraform resource graph is the internal graph of infrastructure resources and their dependency relationships that drives Terraform's processing order.
- CDK for TerraformThe CDKTF CLI is the command-line interface for installing, initializing, and operating CDKTF projects.
- module blockA module block is a Terraform configuration block that declares a module and its source, version, and provider settings.
- contractA defined software interface through which one system invokes operations or accesses capabilities of another system.
- credentialA credential is information used to authenticate or authorize access to a system or resource.
- terraform applyterraform apply is the Terraform command that executes the actions specified by an execution plan.
- uptimeHigh availability is a system design property that minimizes service interruption by avoiding dependence on a single failure domain.
- plan fileA plan file is a serialized Terraform execution plan containing the resource actions to perform.
- refactoringInternal refactoring is structural change confined within a program or module that preserves its external behavior and interfaces.
- evaluation suiteA test suite is a collection of tests maintained and executed together to evaluate software behavior.
- terraform show commandThe terraform show command displays information from a Terraform state file or execution plan in human-readable form and can serialize it as JSON.
- subnetworkA subnet is a logically segmented portion of an IP network with its own address range.
- private subnetA private subnet is a subnet whose resources are not directly reachable from the public internet.
- public subnetA public subnet is a subnet configured with a route that permits direct internet connectivity for its resources.
- declarative programmingA programming or configuration language in which the desired outcome or state is specified without prescribing the steps that produce it.
- ignore_changesignore_changes is a Terraform lifecycle setting that excludes specified resource attributes from change detection after resource creation.
- secret managementA secret manager is software that securely stores, controls access to, and retrieves sensitive values such as credentials and API keys.
- configurationConfiguration is a declarative specification of infrastructure resources, their properties, and their relationships.
- backup and restoreA state backup is a preserved copy of Terraform state that can be restored as a prior state snapshot.
- authenticationAuthentication is the process of verifying the identity of a user, system, or service before granting access.
- authorizationAuthorization is the process of determining which operations an authenticated identity is permitted to perform.
- deploymentA deployment is a distinct instance of infrastructure managed from a Terraform configuration and associated state.
- dataclassA dataclass is a Python class whose common data-oriented methods and initialization behavior can be generated from declared fields.
- check blockA Terraform configuration block that evaluates infrastructure assertions and reports failures without stopping Terraform execution.
- conditional logicA conditional expression is a Terraform expression that evaluates a boolean condition and returns one of two result expressions.
- validationValidation is the process of checking configuration inputs against required formats, values, or dependencies before processing them.
- security scannerA security scanner is a tool that analyzes software, configurations, or infrastructure for vulnerabilities, misconfigurations, or policy violations.
- aws_instanceaws_instance is a Terraform resource type representing an Amazon EC2 virtual machine instance.
- policyA policy is a rule set that governs technical, compliance, financial, or contractual decisions about infrastructure and software.
- terraform state pullterraform state pull is a Terraform CLI command that retrieves the latest state from the configured backend and writes it to standard output.
- refresh-only planning modeterraform plan --refresh-only is a Terraform plan mode that refreshes state and reports resulting changes without applying infrastructure modifications.
- moved blockA moved block is a Terraform configuration block that declares a change in the address or location of a managed resource so Terraform can preserve its existing state.
- makeMake is a build automation tool that executes commands defined in a makefile according to target relationships and file dependencies.
- root moduleA root module is the Terraform module defined by the configuration files in the current working directory and serving as the entry point for a Terraform operation.
- make targetA Make target is a named build-automation goal associated with prerequisites and commands, often represented by a file or directory.
- tofupytofupy is a Python library created in this book for programmatic interaction with Terraform or OpenTofu projects.
- templateA template is a text pattern containing fixed content and placeholders that can be filled with variable or expression values to produce a larger string.
- hashicorp/random providerThe random provider is a Terraform provider that creates persistent random values such as strings, numbers, names, bytes, and UUIDs.
- local valueA Terraform local variable is a module-scoped value that stores reusable or derived configuration data without exposing it externally.
- mockingA mock is a test substitute that replaces a real infrastructure provider with a fake implementation returning predetermined values without creating real infrastructure.
- module sourceA module source is the registry address, filesystem path, or repository reference from which Terraform obtains a module.
- argumentA Terraform resource argument is a named value in a resource configuration that specifies an attribute of the represented infrastructure object.
- blockA block is a Terraform HCL construct that defines a concrete configuration or infrastructure item and can contain arguments, attributes, and nested blocks.
- software templateA template repository is a repository whose contents serve as the starting point for creating new repositories.
- GoA statically typed compiled programming language designed for general-purpose software development.
- terraform blockA terraform block is a Terraform configuration block that specifies settings for Terraform itself, including provider dependencies.
- environmentAn environment is an isolated instance of a software system with independently managed infrastructure, configuration, and state.
- cidrsubnetcidrsubnet is a Terraform function that derives a numbered subnet CIDR from an input network CIDR and a requested prefix extension.
- classless inter-domain routingA CIDR block is a compact notation for an IP network and the range of addresses it contains.
- subnettingSubnetting is the process of dividing an IP network into smaller networks by extending its network prefix.
- depends_onA Terraform meta-argument that explicitly declares dependencies between resources, modules, or other configuration constructs.
- multi-tier applicationA three-tier application is an application architecture that separates presentation, application, and data responsibilities into distinct tiers.
- Terraform Provider RegistryThe Terraform Public Registry is a publicly accessible registry for publishing and obtaining Terraform modules and providers.
- network address translationNetwork address translation is a technique that translates network addresses so private-network resources can communicate with external networks.
- linter ruleA linter rule is a configurable static-analysis check that specifies a condition source or configuration must satisfy.
- NAT gatewayA NAT gateway is a network component that provides outbound internet access for resources in private subnets without allowing unsolicited inbound internet connections.
- validation blockA validation block is a Terraform configuration subblock inside a variable block that defines a condition and an error message for checking an input variable.
- dynamic blockA dynamic block is a Terraform language construct that generates zero or more nested configuration blocks from a collection of values.
- provider aliasA provider alias is a name assigned to a non-default Terraform provider configuration so resources and data blocks can select it explicitly.
- resource blockA resource block is a Terraform configuration block that declares an infrastructure resource type, identifier, and arguments.
- sensitivityA sensitive flag is metadata attached to a Terraform value that signals Terraform to prevent the value from being displayed or logged.
- test automation frameworkA testing framework is a software system that provides conventions and utilities for creating, running, and evaluating automated tests.
- dependencyA dependency is a prerequisite relationship requiring one infrastructure action or object to exist before another can proceed.
- create_before_destroycreate_before_destroy is a Terraform lifecycle setting that causes a replacement object to be created before the existing object is destroyed.
- prevent_destroyprevent_destroy is a Terraform lifecycle setting that causes plans destroying the associated resource to fail when enabled.
- replace_triggered_byreplace_triggered_by is a Terraform lifecycle setting that causes a resource to be replaced when specified resource attributes or referenced resources change.
- resource lifecycle blockA nested Terraform configuration block that contains rules governing how a resource is created, updated, replaced, and destroyed.
- resource replacementResource replacement is the lifecycle behavior in which changing a resource attribute causes the existing object to be destroyed and recreated.
- HCP TerraformHCP Terraform is HashiCorp's hosted software platform for managing Terraform workflows as a software service.
- machine typeAn instance type is a cloud virtual-machine specification that determines its available compute, memory, networking, and related capacity.
- variable blockA variable block is a Terraform configuration block that declares an input variable and its properties.
- identity and access management roleAn identity and access management role is a cloud-defined set of permissions that an identity can assume.
- identity providerAn identity provider is a system that authenticates identities and issues identity assertions or tokens to relying systems.
- OIDC tokenAn OIDC token is a signed token carrying claims about an authenticated identity for use by a relying system.
- service principalA service principal is an identity representing an application or automated service for authentication and authorization.
- matrix strategyA strategy matrix is a continuous-integration configuration that expands a job into multiple executions across specified parameter combinations.
- Terraform Automation and Collaboration SoftwareTerraform Automation and Collaboration Software is a category of platforms that automate and coordinate Terraform workflows, including state management, collaboration, and deployment.
- Terraform variable fileA tfvars file is a Terraform variable-definition file containing values that can be loaded into a configuration.
- loopIteration is the repeated processing of items in a collection or the repeated definition of infrastructure instances.
- breaking changeA breaking change is a software change that makes previously valid code, configuration, or interfaces require modification to function correctly.
- CheckovCheckov is an open-source static-analysis tool that detects security and compliance misconfigurations in infrastructure-as-code files.
- infrastructureInfrastructure is the collection of computing, networking, storage, and related resources that support systems and services.
- cloud blockA Terraform cloud block is a configuration block for connecting Terraform to Terraform Cloud or Terraform Enterprise.
- configure functionA configuration function is a provider implementation function that initializes or configures the client used to communicate with an external service.
- terraform_remote_stateterraform_remote_state is a built-in Terraform data source that reads outputs from another Terraform state without modifying that state.
- meta argumentA meta argument is a built-in Terraform argument that controls how Terraform processes a block rather than configuring the underlying infrastructure.
- source of truthA source of truth is the authoritative representation against which the state of a system is evaluated and corrected.
- diagnostics objectA Diagnostics object is a Terraform Plugin Framework response object that collects errors and other diagnostic messages for return to Terraform users.
- reconciliationReconciliation is the repeated process of comparing actual system state with desired state and applying changes to reduce their difference.
- semantic versioningA semantic version is a version identifier following major, minor, and patch precedence rules.
- terraform_dataterraform_data is a built-in Terraform resource type that represents arbitrary data and can support provisioners without being tied to a specific infrastructure object.
- subblockA Terraform subblock is a nested block without labels that can normally occur multiple times inside an enclosing block.
- circular dependencyA circular dependency is a dependency relationship in which a chain of resources forms a closed cycle, causing each resource to depend directly or indirectly on another resource in the same chain.
- local backendA local backend is a Terraform backend that stores state files directly on the local filesystem.
- CookiecutterCookiecutter is a command-line utility that generates project files and directory structures from templates.
- graphA graph is a representation of entities and the relationships between them as vertices and edges.
- lockingState locking is the coordination mechanism that prevents concurrent Terraform operations from modifying the same state simultaneously.
- condition fieldA condition argument is the boolean-valued expression argument in a Terraform precondition or postcondition block that determines whether validation succeeds.
- impure functionAn impure function is a Terraform function whose result is not guaranteed to be known during planning or to remain fixed across evaluations.
- output blockAn output block is a Terraform configuration block that declares a value exposed after Terraform operations.
- remote provisionerThe remote-exec provisioner is a Terraform provisioner that executes commands or scripts on a remote machine.
- pluginA plugin is a software component that extends a host application's capabilities through a defined extension interface.
- TFLint configuration fileA TFLint configuration file is an HCL file that declares TFLint plugins, rule presets, enabled rules, and excluded rules for a project.
- required_providers blockA required_providers block is a Terraform configuration block that declares the providers a configuration requires and can constrain their versions.
- terraform graphterraform graph is a Terraform subcommand that outputs a graph representation of the configuration or infrastructure dependency graph.
- versioningVersion control is the practice of tracking and managing successive changes to files and code.
- Terraform lineageState lineage is an identifier stored in Terraform state that distinguishes one state instance from another and helps prevent cross-environment overwrites.
- resource typeA Terraform resource type identifies the kind of infrastructure object represented by a resource and determines its supported arguments.
- terraform.Destroyterraform.Destroy is a Terratest helper function that runs Terraform destruction to remove resources managed by a test.
- aws_ami data sourceThe aws_ami data source is a Terraform AWS provider data source that retrieves an Amazon Machine Image matching specified criteria.
- schemaA schema is a data structure that defines the parameters, attributes, configuration values, types, requirements, computed status, defaults, and documentation associated with a Terraform component.
- ConsulConsul is a HashiCorp service networking platform that provides service discovery, configuration, and secure connectivity.
- partial configurationA partial configuration is a configuration that specifies only some required settings while leaving the remaining settings to be supplied separately.
- random_passwordrandom_password is a Terraform resource type from the hashicorp/random provider that generates a random password value and treats it as sensitive.
- block typeA block type is a Terraform HCL construct category that determines a block's purpose and how its contents are interpreted.
- hierarchical naming systemA hierarchical naming scheme assigns names by extending a parent component's name with identifiers for nested subcomponents.
- random_stringrandom_string is a Terraform resource type from the hashicorp/random provider that generates a random string value.
- Terraform module registryTerrareg is open-source software for hosting and distributing Terraform modules through a private registry.
- labelA label is a name attached to a Terraform block that identifies the block or specifies its subtype.
- client libraryA client library is a software library that provides programmatic interfaces for invoking and interacting with another system.
- resource targetingResource targeting is a Terraform planning feature that limits planned changes to selected resources while retaining changes required by their dependencies.
- monitoringLogging is the recording of application or infrastructure events and diagnostic information.
- AWS providerThe AWS provider is a Terraform provider that manages resources and data exposed by Amazon Web Services.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
