The goal with infrastructure as code (IaC) frameworks such as Terraform and CloudFormation is to make infrastructure provisioning more efficient. Through a combination of automation and either imperative or declarative configuration, IaC makes it easier to deploy the same environment consistently and repeatably.
IaC’s immutability and machine readability are huge advantages when it comes to building, deploying, and testing infrastructure. It allows for storing and versioning of infrastructure, making it easier to manage, collaborate, and audit. It also allows teams to test—and secure—infrastructure just as they would with any other code. But without the right approach, IaC can actually pose a disadvantage when it comes to security and compliance.