Let's now talk about Terraform
and go over some of its features at a high level.
As we discussed, Terraform is a popular IAC tool
which is specifically useful as an infrastructure provisioning tool.
Terraform is a free and open source tool
which is developed by HashiCorp.
It installs as a single binary which can be set up very quickly,
allowing us to build, manage,
and destroy infrastructure in a matter of minutes.
One of the biggest advantages of Terraform is its ability
to deploy infrastructure across multiple platforms
including private and public cloud,
such as on-premise vSphere cluster or cloud solutions
such as AWS, GCP, or Azure to name a few.
These are just a few of the many resources that Terraform can manage.
How does Terraform manage infrastructure
on so many different kinds of platforms?
This is achieved through providers.
A provider helps Terraform manage third-party platforms
through their API.
Providers enable Terraform manage cloud platforms like AWS,
GCP or Azure, as we have just seen,
as well as network infrastructure like BigIP CloudFlare,
DNS, Palo Alto Networks, and Infoblox.
As well as monitoring and data management tools like DataDog,
Grafana, Auth0, Wavefront, and Sumo Logic.
Databases like InfluxDB, MongoDB, MySQL, PostgreSQL,
and version control systems like GitHub, Bitbucket, or GitLab.
Terraform supports hundreds of such providers, and as a result,
can work with almost every infrastructure platform.
Terraform uses HCL,
which stands for HashiCorp Configuration Language,
which is a simple, declarative language
to define the infrastructure resources
to be provisioned as blocks of code.
All infrastructure resources can be defined
within configuration files that has a .tf file extension.
The configuration syntax is easy to read and write and pick up
for a beginner.
The sample code is used to provision a new EC2 instance
on the AWS cloud.
This code is declarative
and can be maintained in a version control system,
allowing it to be distributed to other teams.
We cover the HCL syntax in more detail later in this course.
We also have a lot of hands-on labs
where you will be practicing working with these files
and gain a lot of experience by the end of this course.
We said that the code is declarative,
but what does declarative mean?
The code we defined is the state that we want our infrastructure
to be in.
That's the desired state.
This on the right is the current state where there's nothing.
Terraform will take care of what is required
to go from the current state to the desired state
without us having to worry about how to get there.
How does Terraform do that?
Terraform works in three phases; Init, Plan, and Apply.
During the init phase, Terraform initializes the project
and identifies the providers to be used for the target environment.
During the plan phase,
Terraform drafts a plan to get to the target state.
Then in the apply phase, Terraform makes the necessary changes
required on the target environment to bring it to the desired state.
If for some reason the environment was to shift
from the desired state, then a subsequent Terraform apply
will bring it back to the desired state,
by only fixing the missing component.
Every object that Terraform manages is called a resource.
A resource can be a compute instance,
a database server in the cloud,
or in a physical server on-premise that Terraform manages.
Terraform manages the lifecycle of the resources
from its provisioning to configuration to decommissioning.
Terraform records the state of the infrastructure as it is seen
in the real world and based on this,
it can determine what actions to take when updating resources
for a particular platform.
Terraform can ensure that the entire infrastructure is always
in the defined state at all times.
The state is a blueprint of the infrastructure deployed by Terraform.
Terraform can read attributes
of existing infrastructure components by configuring data sources.
This can later be used for configuring other resources
within Terraform.
Terraform can also import other resources outside of Terraform
that were either created manually
or by the means of other IAC tools,
and bring it under its control
so that it can manage those resources going forward.
Terraform Cloud and Terraform Enterprise provide additional features
that allow simplified collaboration between teams
managing infrastructure, improved security,
and a centralized UI to manage Terraform deployments.
All these features make Terraform an excellent,
enterprise-grade infrastructure provisioning tool.
That was a quick introduction to Terraform at a high level.
Let's dive in and explore all of these in much more detail
in the upcoming lectures.