WEBVTT

00:00.600 --> 00:02.020
Let's now talk about Terraform

00:02.100 --> 00:05.320
and go over some of
its features at a high level.

00:06.870 --> 00:09.700
As we discussed, Terraform
is a popular IAC tool

00:09.780 --> 00:13.080
which is specifically useful as an
infrastructure provisioning tool.

00:14.210 --> 00:16.270
Terraform is a free
and open source tool

00:16.350 --> 00:18.030
which is developed by HashiCorp.

00:18.620 --> 00:22.040
It installs as a single binary
which can be set up very quickly,

00:22.120 --> 00:23.540
allowing us to build, manage,

00:23.620 --> 00:26.330
and destroy infrastructure
in a matter of minutes.

00:27.630 --> 00:30.520
One of the biggest advantages
of Terraform is its ability

00:30.600 --> 00:33.520
to deploy infrastructure
across multiple platforms

00:33.600 --> 00:35.650
including private and public cloud,

00:35.730 --> 00:38.960
such as on-premise vSphere
cluster or cloud solutions

00:39.040 --> 00:42.240
such as AWS, GCP,
or Azure to name a few.

00:43.240 --> 00:46.890
These are just a few of the many
resources that Terraform can manage.

00:48.410 --> 00:50.070
How does Terraform
manage infrastructure

00:50.150 --> 00:52.460
on so many different
kinds of platforms?

00:53.790 --> 00:55.550
This is achieved
through providers.

00:56.020 --> 00:58.840
A provider helps Terraform
manage third-party platforms

00:58.920 --> 01:00.190
through their API.

01:01.630 --> 01:04.980
Providers enable Terraform
manage cloud platforms like AWS,

01:05.060 --> 01:07.290
GCP or Azure, as
we have just seen,

01:07.370 --> 01:11.320
as well as network infrastructure
like BigIP CloudFlare,

01:11.400 --> 01:14.750
DNS, Palo Alto
Networks, and Infoblox.

01:15.270 --> 01:18.630
As well as monitoring and data
management tools like DataDog,

01:18.710 --> 01:22.730
Grafana, Auth0,
Wavefront, and Sumo Logic.

01:22.810 --> 01:27.840
Databases like InfluxDB,
MongoDB, MySQL, PostgreSQL,

01:27.920 --> 01:31.440
and version control systems like
GitHub, Bitbucket, or GitLab.

01:32.360 --> 01:35.880
Terraform supports hundreds of
such providers, and as a result,

01:35.960 --> 01:38.720
can work with almost every
infrastructure platform.

01:40.000 --> 01:41.490
Terraform uses HCL,

01:41.570 --> 01:44.190
which stands for HashiCorp
Configuration Language,

01:44.270 --> 01:46.360
which is a simple,
declarative language

01:46.440 --> 01:48.030
to define
the infrastructure resources

01:48.110 --> 01:50.440
to be provisioned as blocks of code.

01:51.680 --> 01:53.600
All infrastructure
resources can be defined

01:53.680 --> 01:57.440
within configuration files
that has a .tf file extension.

01:58.520 --> 02:02.040
The configuration syntax is easy
to read and write and pick up

02:02.120 --> 02:02.970
for a beginner.

02:04.190 --> 02:07.510
The sample code is used to
provision a new EC2 instance

02:07.590 --> 02:09.020
on the AWS cloud.

02:10.100 --> 02:11.350
This code is declarative

02:11.430 --> 02:13.850
and can be maintained
in a version control system,

02:13.930 --> 02:16.330
allowing it to be
distributed to other teams.

02:17.940 --> 02:21.990
We cover the HCL syntax in more
detail later in this course.

02:22.070 --> 02:24.260
We also have a lot of hands-on labs

02:24.340 --> 02:27.030
where you will be practicing
working with these files

02:27.110 --> 02:29.770
and gain a lot of experience
by the end of this course.

02:31.750 --> 02:33.840
We said that the
code is declarative,

02:33.920 --> 02:36.000
but what does declarative mean?

02:37.390 --> 02:40.350
The code we defined is the state
that we want our infrastructure

02:40.430 --> 02:41.320
to be in.

02:41.960 --> 02:43.370
That's the desired state.

02:44.630 --> 02:47.770
This on the right is the current
state where there's nothing.

02:48.870 --> 02:50.790
Terraform will take
care of what is required

02:50.870 --> 02:53.330
to go from the current state
to the desired state

02:53.410 --> 02:55.960
without us having to worry
about how to get there.

02:57.110 --> 02:58.490
How does Terraform do that?

02:59.690 --> 03:03.070
Terraform works in three
phases; Init, Plan, and Apply.

03:03.880 --> 03:06.710
During the init phase, Terraform
initializes the project

03:06.790 --> 03:10.270
and identifies the providers to be
used for the target environment.

03:11.090 --> 03:12.240
During the plan phase,

03:12.320 --> 03:15.350
Terraform drafts a plan
to get to the target state.

03:15.430 --> 03:18.820
Then in the apply phase,
Terraform makes the necessary changes

03:18.900 --> 03:22.320
required on the target environment
to bring it to the desired state.

03:23.740 --> 03:26.160
If for some reason the
environment was to shift

03:26.240 --> 03:29.090
from the desired state, then a
subsequent Terraform apply

03:29.170 --> 03:31.330
will bring it back to
the desired state,

03:31.410 --> 03:33.480
by only fixing the
missing component.

03:35.310 --> 03:38.620
Every object that Terraform
manages is called a resource.

03:39.280 --> 03:41.540
A resource can be
a compute instance,

03:41.620 --> 03:43.510
a database server in the cloud,

03:43.590 --> 03:46.720
or in a physical server
on-premise that Terraform manages.

03:48.160 --> 03:50.420
Terraform manages the
lifecycle of the resources

03:50.500 --> 03:53.790
from its provisioning to
configuration to decommissioning.

03:55.130 --> 03:58.020
Terraform records the state of
the infrastructure as it is seen

03:58.100 --> 04:00.560
in the real world
and based on this,

04:00.640 --> 04:03.600
it can determine what actions to
take when updating resources

04:03.680 --> 04:05.070
for a particular platform.

04:06.280 --> 04:09.130
Terraform can ensure that the
entire infrastructure is always

04:09.210 --> 04:11.260
in the defined
state at all times.

04:12.650 --> 04:16.140
The state is a blueprint of the
infrastructure deployed by Terraform.

04:17.720 --> 04:18.980
Terraform can read attributes

04:19.060 --> 04:22.860
of existing infrastructure components
by configuring data sources.

04:23.330 --> 04:25.950
This can later be used for
configuring other resources

04:26.030 --> 04:26.990
within Terraform.

04:28.600 --> 04:32.290
Terraform can also import other
resources outside of Terraform

04:32.370 --> 04:34.060
that were either created manually

04:34.140 --> 04:36.660
or by the means
of other IAC tools,

04:36.740 --> 04:38.230
and bring it under its control

04:38.310 --> 04:40.990
so that it can manage those
resources going forward.

04:42.580 --> 04:45.940
Terraform Cloud and Terraform
Enterprise provide additional features

04:46.020 --> 04:48.470
that allow simplified
collaboration between teams

04:48.550 --> 04:51.580
managing infrastructure,
improved security,

04:51.660 --> 04:54.760
and a centralized UI to
manage Terraform deployments.

04:55.860 --> 04:58.180
All these features make
Terraform an excellent,

04:58.260 --> 05:00.700
enterprise-grade infrastructure
provisioning tool.

05:02.480 --> 05:05.050
That was a quick introduction
to Terraform at a high level.

05:06.140 --> 05:08.930
Let's dive in and explore
all of these in much more detail

05:09.020 --> 05:10.480
in the upcoming lectures.

