Terraform
Browse all articles, tutorials, and guides about Terraform
About Terraform
Provision and manage cloud infrastructure using Terraform. Follow examples that demonstrate best practices for infrastructure as code.
Posts
How to Create a Folder in an AWS S3 Bucket Using Terraform
Learn how to create a folder in an AWS S3 bucket using Terraform by leveraging the `aws_s3_object` resource.
How to Use the AWS account_id Variable in Terraform
Learn how to dynamically retrieve and use the AWS account_id variable in Terraform for your configurations.
Terraform Conditionals: Handling Non-Existent Variables
Learn how to use Terraform conditionals to handle cases where a variable does not exist or is not defined.
Best practices when using Terraform?
Discover essential best practices for using Terraform to manage your infrastructure effectively and securely.
How to create an SSH key in Terraform?
Learn how to generate and manage SSH keys in Terraform for secure access to your infrastructure.
Should I commit .tfstate files to Git?
Understand why committing .tfstate files to Git is not recommended and explore best practices for managing Terraform state.
Specifying an API Gateway Endpoint with a Variable in Terraform
Learn how to dynamically specify an API Gateway endpoint with a variable in Terraform for flexible configurations.
Conditional Attributes in Terraform
Learn how to use conditional expressions to dynamically set resource attributes in Terraform.
Managing Different Environments in Terraform
Learn how to manage different environments in Terraform using workspaces, variable files, and directory structures.
Should .terraform.lock.hcl Be in .gitignore? (The Answer Might Surprise You)
The .terraform.lock.hcl file causes confusion for many Terraform users. Learn why you should commit it to version control and how to handle it properly.
Conditional Resource Creation in Terraform Based on .tfvars Variables
Learn how to conditionally create Terraform resources using variables from .tfvars files. Learn count, for_each, and dynamic blocks for flexible infrastructure.
terraform.tfvars vs variables.tf: What is the Difference?
Understand the difference between terraform.tfvars and variables.tf in Terraform and how to use them effectively.
Use Terraform to set up a Lambda function triggered by a scheduled event source
Learn how to use Terraform to create an AWS Lambda function triggered by a scheduled event source, such as a cron job.
How to Fix "Error acquiring the state lock: ConditionalCheckFailedException"
Learn how to diagnose and fix Terraform state lock errors that prevent your infrastructure deployments from running.
How to Load Input Data from a File in Terraform
Learn how to load input data from a file in Terraform using the `file` function and external data sources.
Terraform: Error Creating IAM Role. MalformedPolicyDocument: Has Prohibited Field Resource
Learn how to resolve the 'MalformedPolicyDocument: Has prohibited field Resource' error when creating an IAM role in Terraform.
How to Ignore Change of an Attribute in Terraform Blocks
Learn how to use the `lifecycle` block with the `ignore_changes` argument to ignore changes to specific attributes in Terraform.
How to Split a Terraform File (main.tf) into Several Files (No Modules)
Organizing Terraform configurations by splitting a single main.tf file into multiple files can improve readability and maintainability. Learn how to do this without using modules.
How to Execute Terraform Actions Without the Interactive Prompt
Learn how to automate Terraform workflows by bypassing the interactive prompt for commands like apply and destroy.
How do you do simple string concatenation in Terraform?
Learn how to perform string concatenation in Terraform using interpolation and the join function.
How to for_each through a list(objects) in Terraform
Learn how to use the for_each construct in Terraform to iterate through lists of objects and dynamically create resources.
How to Attach Multiple IAM Policies to IAM Roles Using Terraform
Learn how to attach multiple IAM policies to a single IAM role in Terraform to manage permissions effectively.
Fixing the "Invalid Legacy Provider Address" Error in Terraform
Learn how to resolve the 'Invalid legacy provider address' error in Terraform by upgrading your provider configurations.
Variables Within Variables in Terraform
Learn how to use variables within variables in Terraform to create dynamic and reusable configurations.
How to Display Sensitive Data Output Variables in Terraform
Learn how to handle and display sensitive data output variables in Terraform safely and effectively.
Determining Minimum AWS Permissions for Terraform Configurations
Learn how to identify the minimum AWS permissions required for your Terraform configurations to enhance security and compliance.
Terraform + DynamoDB: All Attributes Must Be Indexed
Learn how to handle the 'all attributes must be indexed' requirement in DynamoDB when using Terraform.
Fixing "A Reference to Resource Type Must Be Followed by At Least One Attribute Access" in Terraform
Learn how to resolve the error 'A reference to resource type must be followed by at least one attribute access' in Terraform.
Using a Git Branch as a Source for Terraform Modules
Learn how to use a specific Git branch as the source for Terraform modules to manage versioning and development workflows.
Getting an Environment Variable in Terraform Configuration
Learn how to retrieve and use environment variables in Terraform configurations using the `env` function and input variables.
Is there an AND/OR Conditional Operator in Terraform?
Learn how to use AND/OR conditional operators in Terraform to create dynamic configurations.
Refactoring modules: Error: Provider configuration not present
Learn how to resolve the 'Provider configuration not present' error when refactoring Terraform modules.
How can I remove a resource from Terraform state?
Learn how to safely remove a resource from Terraform state without affecting the actual infrastructure.
How are data sources used in Terraform?
Understand how to use data sources in Terraform to fetch information about existing resources.
Upgrade Terraform to Specific Version
Learn how to upgrade Terraform to a specific version on your system, ensuring compatibility with your infrastructure.
Initial setup of Terraform backend using Terraform
Learn how to configure a Terraform backend for secure and efficient state management.
Terraform Infrastructure as Code Best Practices
How to write scalable and maintainable Terraform code for your cloud infrastructure.
I would like to run Terraform only for a specific resource
Learn how to target specific resources in Terraform to save time and avoid unnecessary changes.
How to Migrate Terraform State Between Projects
Learn how to safely migrate Terraform state between projects using the `terraform state` command.
Terraform - Delete All Resources Except One
Learn how to delete all resources managed by Terraform except for a specific resource by using targeted commands and state manipulation.
How to Write an if, else, elsif Conditional Statement in Terraform
Learn how to use if, else, and elsif conditional statements in Terraform to create dynamic configurations.
Terraform Failing with Invalid for_each Argument / The Given "for_each" Argument Value is Unsuitable
Learn how to troubleshoot and fix the "Invalid for_each argument" error in Terraform.
Can Terraform Be Used to Provision On-Premises Servers?
Learn how Terraform can be used to provision on-premises servers by integrating with tools like VMware vSphere, Ansible, and bare-metal providers.
Concatenate a String with a Variable in Terraform
Learn how to concatenate strings with variables in Terraform to create dynamic configurations.
Modules + Output from for_each
Learn how to use for_each with modules in Terraform to dynamically create resources and manage outputs.
Terraform Statefile is Locked: How to Unlock It
Learn how to unlock a locked Terraform statefile using the `force-unlock` command and best practices to avoid future locks.