Heap's infrastructure management utilizes AWS and Terraform, an infrastructure as code tool from Hashicorp, to automate and streamline the setup and modification of cloud resources. By using Terraform, infrastructure configurations are stored in human-readable text files, allowing them to be managed like source code with the benefits of version control and rollback capabilities. However, Terraform's data model, which involves resources and attributes, does not always align perfectly with cloud provider APIs, leading to complexities such as synthetic resources that represent multiple entities. Heap faced challenges when managing PostgreSQL clusters with multiple EBS volumes due to Terraform's inability to smoothly add additional volumes without recreating instances. They resolved this by adopting a more granular representation using separate Terraform resources for EBS volumes and their attachments, requiring significant state modifications. To ensure safety, Heap employs practices such as writing plans to files, using read-only IAM roles for planning, and considering continuous integration to automate plan validation and application. As the team grows, they aim to enhance the safety and efficiency of Terraform workflows by leveraging features like state locking and automated review processes.