Okay,
I'm back here in main.tf in Visual Studio Code, and the last way I'm going to
show you how to configure Terrascan is with server mode.
So this is where you would have one instance running Terrascan
that you can access from your CI or build system.
And instead of having Terrascan run on its own in each environment,
you can have one set up with all the latest definitions that you can
then query from anywhere in your build environment.
So let's go ahead and open this up.
I'll run a terrascan server command,
and that's going to set up a web server here to run.
And you see it's set up a couple of different routes,
and I'll go into each of those a little bit more later.
For now,
let's open up a new terminal window so I can leave
that running in the background.
I'll run a few different curl commands.
First, I can run the health command to make sure that my server is running,
so I'll throw ‑i on there.
And I'm getting a 200 response back, which means my server's okay.
It's running the way it's supposed to.
Now that I've verified that, I'm going to run this command here,
which is going to send a file with curl,
specifically main.tf,
to that locally running Terrascan server, and it's going
to pass in a few different parameters.
These already might look familiar because they're the same
ones we set up in the GitHub action.
And these parameters are the IaC,
which is the type of infrastructure we're scanning,
which is Terraform, the IaC version,
so we're scanning for Terraform version 14, and the cloud policies to scan for,
which in this case are AWS.
So now that I've passed those into my curl command, let's run it.
And this will return a JSON response with all of the rule
violations that we've shown earlier.
And this can be easily consumed by another system in the
environment or in the build system where you can do
whatever you want with this data.
And if we go back to the first tab,
you can see that POST request is right there on the last line.
That's the last command this server received right
below the health endpoint check, right?
So those are all the different ways to use Terrascan.
Let's go back to the slides.