Security in IaC
Dear Friend,
IaC allows us to automate the infrastructure with speed. But when writing infrastructure as code, there's possibility for security misconfigurations.
So, what we can do ?
We can use tools like Checkov to make sure there's no surprises.
How to get started with Checkov ?
Now you can scan your code against pre-built policies that Checkov provides and in addition you can also write your own custom policy.
Let's see an example which uses built in policies.
The main.tf illustrated below requires a new VPC.
After saving the terraform, checkov extension scanned the code and throws the below message
Then I fixed the medium level policy error by implementing VPC flow logging. And I suppressed the low level policy error.
The below illustration is after fix, Checkov didn't report any policy error now.
What's Next ?
Experiment checkov at your end and share your comments.
You can integrate Checko with CI tools such as GitLab, GitHub Actions ( Link has samples )
Cloud Architect x DevOps Engineer x 3 * AWS Certifications x Full Stack Developer
2 年Thank you , those tools only help you with error and improvements in the IaC script but in your environment you should consider your cloud provider best practices and native services to help you secure your infrastructure.