WEBVTT

00:00:03.040 --> 00:00:03.560
Okay,

00:00:03.560 --> 00:00:09.170
I'm back here in main.tf in Visual Studio Code, and the last way I'm going to

00:00:09.170 --> 00:00:12.960
show you how to configure Terrascan is with server mode.

00:00:13.440 --> 00:00:17.340
So this is where you would have one instance running Terrascan

00:00:17.350 --> 00:00:20.460
that you can access from your CI or build system.

00:00:20.470 --> 00:00:25.530
And instead of having Terrascan run on its own in each environment,

00:00:25.640 --> 00:00:29.070
you can have one set up with all the latest definitions that you can

00:00:29.070 --> 00:00:31.760
then query from anywhere in your build environment.

00:00:31.940 --> 00:00:34.040
So let's go ahead and open this up.

00:00:34.050 --> 00:00:36.980
I'll run a terrascan server command,

00:00:36.980 --> 00:00:41.240
and that's going to set up a web server here to run.

00:00:41.350 --> 00:00:43.760
And you see it's set up a couple of different routes,

00:00:43.830 --> 00:00:46.190
and I'll go into each of those a little bit more later.

00:00:46.190 --> 00:00:46.570
For now,

00:00:46.570 --> 00:00:49.580
let's open up a new terminal window so I can leave

00:00:49.580 --> 00:00:51.010
that running in the background.

00:00:51.150 --> 00:00:53.220
I'll run a few different curl commands.

00:00:53.220 --> 00:00:58.610
First, I can run the health command to make sure that my server is running,

00:00:59.080 --> 00:01:01.040
so I'll throw ‑i on there.

00:01:01.050 --> 00:01:04.910
And I'm getting a 200 response back, which means my server's okay.

00:01:04.910 --> 00:01:06.350
It's running the way it's supposed to.

00:01:06.370 --> 00:01:09.890
Now that I've verified that, I'm going to run this command here,

00:01:09.890 --> 00:01:13.230
which is going to send a file with curl,

00:01:13.240 --> 00:01:14.730
specifically main.tf,

00:01:14.730 --> 00:01:19.010
to that locally running Terrascan server, and it's going

00:01:19.010 --> 00:01:21.140
to pass in a few different parameters.

00:01:21.220 --> 00:01:23.780
These already might look familiar because they're the same

00:01:23.780 --> 00:01:26.300
ones we set up in the GitHub action.

00:01:26.490 --> 00:01:28.910
And these parameters are the IaC,

00:01:28.910 --> 00:01:31.000
which is the type of infrastructure we're scanning,

00:01:31.000 --> 00:01:33.160
which is Terraform, the IaC version,

00:01:33.160 --> 00:01:38.820
so we're scanning for Terraform version 14, and the cloud policies to scan for,

00:01:38.820 --> 00:01:40.180
which in this case are AWS.

00:01:41.140 --> 00:01:45.850
So now that I've passed those into my curl command, let's run it.

00:01:46.810 --> 00:01:50.510
And this will return a JSON response with all of the rule

00:01:50.510 --> 00:01:52.460
violations that we've shown earlier.

00:01:52.840 --> 00:01:55.920
And this can be easily consumed by another system in the

00:01:55.920 --> 00:01:59.050
environment or in the build system where you can do

00:01:59.050 --> 00:02:00.360
whatever you want with this data.

00:02:00.820 --> 00:02:03.470
And if we go back to the first tab,

00:02:03.500 --> 00:02:07.440
you can see that POST request is right there on the last line.

00:02:07.440 --> 00:02:10.139
That's the last command this server received right

00:02:10.139 --> 00:02:11.960
below the health endpoint check, right?

00:02:11.960 --> 00:02:14.860
So those are all the different ways to use Terrascan.

00:02:15.340 --> 00:02:16.820
Let's go back to the slides.
