Head First Iac - Terraform
Introduction
Terraform is an open-source tool that allows users to define, provision, and manage infrastructure as code. It is designed to work with a wide variety of infrastructure providers, including popular cloud providers like AWS, Azure, and Google Cloud, as well as on-premises providers like VMware and OpenStack.
One of the key features of Terraform is its ability to create and manage infrastructure resources in a consistent and predictable way. By using Terraform, users can define their infrastructure as code, which allows them to version, review, and collaborate on changes to their infrastructure. This makes it easy to track changes and roll back to a previous state if needed.
Another key feature of Terraform is its ability to create and manage infrastructure resources across multiple providers. This allows users to create a single definition of their infrastructure, and then use that definition to create and manage resources across multiple providers. This can help to reduce the complexity of managing resources across different providers and ensure consistency across different environments.
Terraform also provides a number of advanced features such as remote state management, workspaces and modules which provide a way to organize and reuse code and manage the state of infrastructure.
In addition to its core features, Terraform also has a large and active community that creates and shares custom modules and providers, which can be used to manage additional types of resources and services. This can make it easy for users to add new resources and services to their infrastructure without having to write custom code.
Overall, Terraform is a powerful tool for creating and managing infrastructure as code. Its ability to create and manage resources across multiple providers, and its advanced features such as remote state management, make it a valuable tool for teams that are looking to automate and manage their infrastructure in a consistent and predictable way.
Usage
Configure token
Initialize
terraform init
In the process of initializing the project, Terraform will parse the *.tf files in the directory and load the relevant provider
plugins.
Initializing the backend...
Initializing provider plugins...
- Reusing previous version of hashicorp/azurerm from the dependency lock file
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Plan
terraform plan
Apply
terraform apply
Destroy
terraform destroy
Reference
https://www.terraform.io
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here