<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Michael Fonseca on Medium]]></title>
        <description><![CDATA[Stories by Michael Fonseca on Medium]]></description>
        <link>https://medium.com/@fonseca.michael?source=rss-9788ac93cedd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ehgpB0cvw3X-7UlgYkE5zg.jpeg</url>
            <title>Stories by Michael Fonseca on Medium</title>
            <link>https://medium.com/@fonseca.michael?source=rss-9788ac93cedd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 02:04:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fonseca.michael/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Modern Infrastructure Lifecycle Management: The Role of the Image Factory: Part 2 — Tooling &…]]></title>
            <link>https://medium.com/hashicorp-engineering/modern-infrastructure-lifecycle-management-the-role-of-the-image-factory-part-2-tooling-c5f26436527a?source=rss-9788ac93cedd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5f26436527a</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[hashicorp-packer]]></category>
            <category><![CDATA[virtual-machine-images]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Michael Fonseca]]></dc:creator>
            <pubDate>Wed, 07 May 2025 15:47:17 GMT</pubDate>
            <atom:updated>2025-05-07T15:47:17.819Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Modern Infrastructure Lifecycle Management: The Role of the Image Factory: Part 2 — Tooling &amp; Workflow</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KoHdkTKmKn97KxRKaDiA_A.png" /><figcaption>Modern Infrastructure Lifecycle Management: The Role of the Image Factory: Part 2 — Tooling &amp; Workflow</figcaption></figure><p>Co-author:<a href="https://medium.com/u/e8850fd3fc9c"> Dan Schneider</a> — HashiCorp — Sr. Solutions Architect</p><p><strong>Building a Robust Image Factory with HashiCorp Solutions</strong></p><p><a href="https://medium.com/@fonseca.michael/9f4cd608325c?source=friends_link&amp;sk=2b22740080ab201781301eb963ae5803">Part 1</a> of this article discussed the “why” and requirements for building an “Image Build Factory.” Here, in Part 2, we review the workflow and tooling necessary for its creation. HashiCorp has observed numerous customers and organizational variations in their approaches to building image factories. With the prevalence of Packer and now HCP Packer, many have requested best practices, architectures, and recommendations from HashiCorp. As a result, HashiCorp now assists customers in building image factories through various services. Our consultations and work in this area have demonstrated that an image factory can be effectively built and supported by HashiCorp products, as will be detailed in the following sections.</p><p>HashiCorp offers a comprehensive suite of tools ideally suited for constructing a robust and scalable image factory, providing an end-to-end system of components for secure image lifecycle management.</p><p>The core building blocks of a HashiCorp-based image factory are outlined below, with further details on tool capabilities, integrations, and process flow provided in subsequent sections:</p><ul><li><strong>Version Control System (VCS):</strong> A VCS (e.g., Git) is used to maintain the codified definition (IaC) of the images to be built, enabling versioning, collaboration, and auditability.</li><li><strong>Automation Tool (CI/CD):</strong> A CI/CD tool (e.g., GitHub Actions, GitLab CI) automates the workflow, triggering actions like Nomad jobs based on VCS commits.</li><li><strong>Orchestration and Runtime (Nomad):</strong> Nomad orchestrates tooling within the factory, executing one-time and scheduled Packer jobs for image building.</li><li><strong>Secrets Management (Vault):</strong> Vault securely manages secrets for both the factory infrastructure and image builds, injecting secrets as needed.</li><li><strong>Metadata Service (HCP Packer):</strong> HCP Packer manages image metadata for versioning, revocation, discovery, and governance.</li><li><strong>Image Builder (Packer):</strong> Packer builds images for multiple platforms (e.g., Docker, VMware, Azure, AWS, GCP) using platform-specific builders and a common configuration language (HCL).</li><li><strong>Provisioner (Terraform):</strong> Terraform provisions infrastructure using the built images. HCP/Enterprise Terraform integrates with HCP Packer for image validation and secure lifecycle management.</li></ul><p><strong>Deep Dive into the HashiCorp Image Factory Implementation:</strong></p><ul><li><strong>Packer:</strong> Packer automates machine image creation for multiple platforms using a single configuration. It abstracts platform-specific processes, using HCL for consistent configuration. Packer utilizes builders, provisioners, and post-processors to streamline image creation, supporting parallel builds and CI/CD integration. In this architecture, Packer runs within containers orchestrated by Nomad. After building, Packer automatically publishes image metadata to HCP Packer.</li><li><strong>Nomad:</strong> Nomad orchestrates workloads within the image factory, scheduling Packer jobs for image creation, scheduled rebuilds, and testing. It provides a highly scalable platform for tool hosting and distributed image building across a fleet of Nomad clients. Nomad uses workload identity for secure OIDC authentication to Vault for secret retrieval.</li><li><strong>HCP Packer:</strong> HCP Packer manages the Packer image lifecycle, providing features for governance, tracking, and auditing. It enables version control, image discovery through channels, image promotion workflows, and image revocation for security and compliance. HCP Packer tracks parent-child image relationships and provides robust metadata management. Packer automatically updates HCP Packer with image metadata during the build process.</li><li><strong>Vault:</strong> Vault provides centralized secrets management, securing sensitive data used by both the image factory and the images themselves. Vault integrates with Packer to securely inject secrets during image creation and manages secrets used by the factory infrastructure. It also generates dynamic credentials for accessing cloud resources. Nomad securely accesses Vault using workload identity and OIDC.</li><li><strong>Terraform:</strong> HCP/Enterprise Terraform provisions infrastructure using the images built by Packer. It integrates with HCP Packer to validate images during provisioning and as part of drift detection. HCP/Enterprise Terraform queries HCP Packer for the correct image based on channel assignments, promoting immutable infrastructure practices and secure lifecycle management. This integration ensures that only approved and validated images are used for infrastructure deployments, mitigating security risks and ensuring compliance.</li></ul><p>By leveraging these HashiCorp tools in concert, organizations can establish a robust, secure, and highly automated image factory, streamlining infrastructure management and accelerating application delivery.</p><p><strong>The Image Factory Workflow: Build, Release, and Consumption</strong></p><p>An effective image factory implements a structured process encompassing build, release, and consumption stages to ensure efficient and secure operations. HashiCorp defines a core set of three stages: Pre-release, Release, and Consumption. Organizations can further refine these stages based on specific requirements.</p><p><strong>Stages in Detail</strong></p><p><strong>Pre-release (Build):</strong> This stage focuses on image creation:</p><ul><li>A user or automated process defines a Packer image template (IaC) and commits it to a VCS.</li><li>Automation workflows (CI/CD) trigger the build process.</li><li>Packer builds the image on a temporary compute resource within the target platform (e.g., Azure Compute Gallery, AWS AMI service, GCP Compute Engine).</li><li>Image metadata, marked as “pre-release” and assigned to a non-production channel, is published to HCP Packer.</li></ul><p><strong><em>Functional Testing:</em></strong><em> This stage occurs outside the image factory pipeline to validate the image:</em></p><ul><li><em>The image owner retrieves the pre-release image from the non-production channel in HCP Packer.</em></li><li><em>Image-specific functional or integration tests are executed manually or via a separate automated testing framework to verify that the image meets application requirements (e.g., functionality, compatibility, performance).</em></li><li><em>Results are reviewed by the image owner / automated process, and determines if the image is ready for promotion or requires adjustments (e.g., rebuilding with fixes).</em></li></ul><p><strong>Release (Promotion):</strong> This stage promotes a pre-release image to a production-ready state:</p><ul><li>An administrator or automated process initiates the promotion.</li><li>The image (or a running instance of it) undergoes security scanning. HCP/Enterprise Terraform can provision temporary resources for this scanning.</li><li>Scan results determine promotion eligibility. Upon successful scanning, the image’s metadata in HCP Packer is updated, and it’s moved to a production-ready channel.</li></ul><p><strong>Consumption (Deployment):</strong> This stage involves using the released image for infrastructure provisioning:</p><ul><li>HCP/Enterprise Terraform is used to provision infrastructure resources from the image.</li><li>HCP/Enterprise Terraform securely retrieves necessary credentials from Vault and communicates with HCP Packer to ensure provisioning from the correct release channel.</li></ul><p><strong>Detailed Workflow Example with HashiCorp Tools:</strong></p><p><strong>Pre-release (Build)</strong></p><ol><li>A Packer template is committed to VCS, triggering a CI/CD job via a webhook (or scheduled).</li><li>The CI/CD system schedules the Packer job on Nomad for execution.</li><li>Nomad uses JWT workload identity to authenticate with Vault, retrieving HCP Packer credentials and short-lived credentials for the target cloud platform(s). These secrets are injected into the Packer job template.</li><li>Packer connects to the target platform(s) and builds the image(s), storing the resulting artifacts in the platform’s configured repository.</li><li>Once built (if required), image scanning tools can be triggered to scan the image/container at initial creation. Note: We do recommend both security and functional testing of the image.</li><li>The image scan results are stored within the CI/CD and/or a data repository for future use within the release promotion process.</li><li>Packer registers the image in the designated HCP Packer bucket’s pre-release channel, associating necessary metadata and software bill of materials (SBOM).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QRllHYiYIOH5dQXzXptsuw.png" /><figcaption>Image 1. Pre-release (Build)</figcaption></figure><p><strong>Release (Promotion)</strong></p><ol><li>The CI/CD system manages a scheduled process, or a trigger (e.g., a webhook) initiates the release process.</li><li>The CI/CD system first queries HCP Packer to retrieve the current image version (and/or the version to be scanned).</li><li>The CI/CD system will then query the scan results of the current version (and/or the version to be scanned) and compare them to see if there are new and/or updated scan results. Note: Functional testing results should be included at this step if implemented as part of the process.</li><li>Based on the scan results, the CI/CD system will update the HCP Packer image channel to a released status (e.g., “prod” — note: this process will also revoke images).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jAHus4WNw2Z19DiTxt9Zow.png" /><figcaption>Image 2. Release (Promotion)</figcaption></figure><p><strong>Consumption (Deployment)</strong></p><ol><li>An HCP/Enterprise Terraform configuration is committed to VCS, triggering a CI/CD job.</li><li>The CI/CD system triggers an HCP/Enterprise Terraform run.</li><li>HCP/Enterprise Terraform uses JWT workload identity to authenticate with Vault, retrieving HCP Packer credentials and short-lived cloud platform credentials.</li><li>HCP/Enterprise Terraform queries HCP Packer for the latest Generally Available (GA) release image from the specified channel.</li><li>HCP/Enterprise Terraform connects to the target platform(s) and provisions VMs/containers using the released image.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RgIT_jT6hJLSuzAoa1XtpA.png" /><figcaption>Image 3. Consumption (Deployment)</figcaption></figure><p><strong>Conclusion</strong></p><p>Building an image factory is crucial for organizations aiming to optimize infrastructure management. HashiCorp solutions provide a streamlined workflow that enhances efficiency and reduces risk. An image factory built with Packer, HCP Packer, HCP/Enterprise Terraform, Vault, and Nomad empowers organizations to achieve true infrastructure agility and operational excellence.</p><p>For more information and to try building images for yourself:</p><ul><li>Visit the <a href="https://developer.hashicorp.com/packer">HashiCorp Packer</a> site for documentation on the types of images and containers that can be built.</li><li>Try building, controlling, and provisioning images with a Packer, HCP Packer, and HCP Terraform <a href="https://developer.hashicorp.com/packer/tutorials/cloud-production/golden-image-with-hcp-packer">tutorial</a>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5f26436527a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/modern-infrastructure-lifecycle-management-the-role-of-the-image-factory-part-2-tooling-c5f26436527a">Modern Infrastructure Lifecycle Management: The Role of the Image Factory: Part 2 — Tooling &amp;…</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modern Infrastructure Lifecycle Management: The Role of the Image Factory]]></title>
            <link>https://medium.com/hashicorp-engineering/modern-infrastructure-lifecycle-management-the-role-of-the-image-factory-9f4cd608325c?source=rss-9788ac93cedd------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f4cd608325c</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[virtual-machine-images]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[hashicorp-packer]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Michael Fonseca]]></dc:creator>
            <pubDate>Tue, 06 May 2025 22:30:05 GMT</pubDate>
            <atom:updated>2025-05-06T22:30:05.954Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Modern Infrastructure Lifecycle Management: The Role of the Image Factory: Part 1 — Requirements</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e0FOwGzadct36FVpxc0P5g.png" /><figcaption>Modern Infrastructure Lifecycle Management: The Role of the Image Factory: Part 1 — Requirements</figcaption></figure><p>Co-author: <a href="https://medium.com/u/e8850fd3fc9c">Dan Schneider</a> — HashiCorp — Sr. Solutions Architect</p><p><strong>Optimizing Infrastructure Deployment with Image Management</strong></p><p>Infrastructure as Code (IaC), particularly with tools like Terraform, has transformed infrastructure provisioning. By automating the deployment of infrastructure components, such as AWS EC2 instances, organizations have significantly reduced provisioning times and gained the agility to consume cloud resources efficiently.</p><p><strong>However, while IaC streamlines infrastructure <em>provisioning</em>, many organizations still struggle to achieve significant reductions in Mean Time To Deploy (MTTD)</strong>. DORA defines MTTD as the average time to deploy a new software release to production. The connection between software releases and underlying infrastructure is undeniable, but we observe that the time required <em>after</em> server provisioning, for configuration and application readiness, often becomes a bottleneck, negatively impacting overall MTTD. In addition, HashiCorp recommends measuring Mean Time To Deploy Initial Infrastructure (MTTDI) and other metrics found in <a href="https://medium.com/hashicorp-engineering/why-financial-institutions-should-embrace-infrastructure-automation-metrics-37df5a3484db?source=friends_link&amp;sk=f8e28b9e04f166ffb312ee9f02ffa945">Why Financial Institutions Should Embrace Infrastructure Automation Metrics</a>. While configuration management tools have improved server hardening and automation, the sheer volume and complexity of post-provisioning configuration can increase time to availability and introduce configuration errors and drift. Accomplishing configuration tasks post-provision also means these tasks must be executed for every new Virtual Machine (VM). Luckily, this multiplication of fragility and time can be avoided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xscQs5WphrrQPBvCoXio1g.png" /><figcaption><em>Image 1. Bespoke images — post-provisioning configuration — higher probability of configuration failure, drift, and incidents</em></figcaption></figure><p>Leading technology organizations address this by shifting as much as possible of the operating system and application configuration <em>into</em> the machine image creation process, minimizing the post-provisioning overhead. Depending on the application architecture and organizational maturity, some applications can be deployed using fully immutable images, enabling immediate production readiness upon deployment. A “service-based image” approach should be used when immutability isn’t feasible. This approach minimizes post-provisioning configuration to only essential settings required for application release. Both immutable and service-based image strategies “shift left” configuration into the pre-provision phase, establishing an operational model centered around an image factory to manage the image lifecycle with speed and security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Vo9YBX4B0KLY--vGZJvdQ.png" /><figcaption>Image 2. Service-based images shift configuration to pre-provisioning, reducing the probability of configuration failure, drift, and incidents</figcaption></figure><p>Mature technology organizations can achieve immutability for a portion or all of their virtual machine (VM) infrastructure, depending on the virtualization technology and operating model (on-premises or cloud provider). These organizations prioritize rapid deployment, security, and ephemeral resources, frequently adopting a “repaving” strategy to destroy and recreate VMs at defined intervals (e.g., every 14 days, often driven by patch management requirements). Fully immutable images, commonly referred to as “application images,” enable the fastest mean time to deployment (MTTD), empowering application teams to accelerate development and implement automated testing and deployment best practices, such as blue/green and canary deployments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HY1_8_2vyz6vVCv-_zXIfg.png" /><figcaption>Image 3. Application images shift the configuration to pre-provisioning, reducing the probability of configuration failure, drift, and incidents</figcaption></figure><p>Achieving rapid and scalable Infrastructure Lifecycle Management (ILM) is essential for maximizing the benefits of IaC and is a cornerstone of a robust Cloud Operating Model. A well-implemented image factory is critical for modern ILM, streamlining the creation, management, and deployment of consistent machine and container images across hybrid cloud environments. By leveraging a suite of HashiCorp tools — including Packer, HCP Packer, HCP/Enterprise Terraform, Vault, and Nomad — organizations can achieve unprecedented automation, security, and scalability in their image management processes, ultimately driving down MTTD and accelerating software delivery.</p><p><strong>The Image Factory: A Cornerstone of Effective Infrastructure Lifecycle Management</strong></p><p>Why prioritize building an image factory as the foundation of your Infrastructure Lifecycle Management (ILM) strategy? An image factory centralizes and standardizes image building, consolidating disparate, ad-hoc pipelines into a unified control plane. This approach unlocks enterprise-grade scale, standardization, security, and governance. Consider the following key IT and business benefits of implementing an image factory:</p><ul><li><strong>Enhanced Operational Efficiency:</strong> By automating image creation, an image factory eliminates manual VM configuration, saving significant time and mitigating the risks associated with human error and complex post-deployment automation. This streamlined approach allows IT teams to focus on higher-value tasks.</li><li><strong>Guaranteed Consistency and Reduced Configuration Drift:</strong> A standardized base image structure ensures that all deployed instances share a consistent system configuration, minimizing inconsistencies and configuration drift. This consistency is crucial in complex environments with numerous servers and applications, ensuring predictable behavior and reducing troubleshooting efforts.</li><li><strong>Improved Scalability and Agility:</strong> Pre-built images enable rapid provisioning of new VMs and containers, facilitating rapid scaling of infrastructure and applications. This agility is essential for responding to fluctuating demand, expanding services, and supporting rapid development cycles.</li><li><strong>Strengthened Security Posture:</strong> Standardizing on a “golden image” ensures consistent security settings and updates across all systems, significantly enhancing overall security. The image factory can automate the integration of regular updates and security patches into the image-building process, proactively addressing vulnerabilities.</li><li><strong>Reduced Operational Costs:</strong> By minimizing manual intervention and streamlining provisioning, an image factory reduces operational overhead and associated costs. This efficiency translates to tangible savings for the organization.</li><li><strong>Increased Reproducibility and Auditability:</strong> Image factories built using Infrastructure as Code (IaC) principles enforce a repeatable and auditable process. This transparency simplifies compliance efforts and enables easier troubleshooting and rollback procedures.</li><li><strong>Enabling Immutable Infrastructure:</strong> An image factory facilitates an immutable infrastructure approach. Instead of modifying existing infrastructure components, changes are implemented by deploying new image versions. This drastically reduces the risk of configuration drift, promotes predictable deployments, and simplifies rollback strategies, contributing to greater overall system stability.</li></ul><p><strong>Functional Requirements of a Robust Image Factory Platform</strong></p><p>Implementing an effective image factory requires careful consideration of several key functional requirements to ensure the platform is robust, flexible, and scalable for widespread adoption. These requirements can be categorized as follows:</p><p><strong>Core Infrastructure and Automation:</strong></p><ul><li><strong>Infrastructure as Code (IaC): </strong>Leveraging IaC principles and Version Control Systems (VCS) is crucial for defining, managing, and versioning image configurations. This ensures repeatability, auditability, and simplifies collaboration.</li><li><strong>Platform Agnosticism: </strong>The platform should support building images for a variety of operating systems (e.g., Linux distributions, Windows Server) and target multiple deployment environments, including on-premises, public cloud (e.g., AWS, Azure, GCP), and hybrid cloud deployments.</li><li><strong>Package Management Integration: </strong>Seamless integration with native package managers (e.g., apt, yum, Chocolatey) is essential for efficient software installation, updates, and dependency management within the image-building process.</li><li><strong>Customization and Extensibility: </strong>The platform should allow for the incorporation of custom scripts, configuration files, and automation workflows to tailor images to specific application requirements and organizational standards.</li></ul><p><strong>Image Management and Control:</strong></p><ul><li><strong>Image Version Control and Parameterization: </strong>Robust version control for images is essential, enabling tracking of changes, rollback to previous versions, and auditing. Parameterization of the image creation process allows for flexibility and adaptability to different use cases without requiring complete image rebuilds.</li><li><strong>Image Tagging and Metadata:</strong> Implementing a comprehensive tagging and labeling system for images simplifies identification, organization, and searchability. This metadata should include information such as image purpose, operating system, included software, and creation date.</li><li><strong>Image Registry Integration:</strong> Integration with a platform-agnostic image registry is crucial for storing, managing, and distributing built images. The registry should provide features for access control, versioning, and metadata management.</li></ul><p><strong>Integration and Operational Excellence:</strong></p><ul><li><strong>Continuous Integration/Continuous Delivery (CI/CD) Integration: </strong>Seamless integration with CI/CD pipelines enables automated image building triggered by code changes, scheduled builds, or other events. This automates the image lifecycle and ensures images are kept up-to-date.</li><li><strong>Comprehensive Documentation and Metadata: </strong>The platform should generate comprehensive documentation and metadata for each image, including usage instructions, deployment guidelines, included software versions, and other relevant information. This promotes self-service and reduces support requests.</li><li><strong>Scalability and Performance:</strong> The image factory platform must be able to handle a high volume of concurrent image creation requests. This requires robust infrastructure, load balancing, and effective error-handling mechanisms.</li><li><strong>Backup and Recovery: </strong>Implementing backup and recovery mechanisms for image configurations, metadata, and the platform itself is critical for business continuity and disaster recovery.</li></ul><p><strong>Security and Compliance in Image Factories and ILM</strong></p><p>Security and compliance are paramount considerations in any Image Factory and Infrastructure Lifecycle Management (ILM) implementation. Several key functional requirements address these crucial aspects:</p><p><strong>Secure Image Building Practices:</strong></p><ul><li><strong>Secure Image Creation and Hardening: </strong>Implementing security best practices and hardening procedures during the image creation process is essential. This includes minimizing the attack surface by removing unnecessary packages, configuring secure defaults, and applying security patches. By integrating security scanning tools (e.g., vulnerability scanners, static code analysis) into the build pipeline, you are ensuring images comply with the established security policies and are identifying potential vulnerabilities before deployment.</li></ul><p><strong>Secrets Management and Access Control:</strong></p><ul><li><strong>Robust Secret Management: </strong>Securely managing and rotating secrets is crucial for both the image factory infrastructure and the images themselves. Integrating a dedicated secrets management solution (e.g., HashiCorp Vault) allows for secure storage, access control, and dynamic injection of secrets into images during the build process, preventing secrets from being hardcoded or exposed.</li><li><strong>Granular Access Control: </strong>Implementing robust access control mechanisms is essential to secure interactions with the image factory. This includes defining roles and permissions to restrict access to sensitive operations such as image creation, modification, and deletion. This ensures that only authorized personnel can interact with the platform.</li></ul><p><strong>Image Lifecycle Governance and Validation:</strong></p><ul><li><strong>Image Revocation and Metadata Management: </strong>A robust metadata system is essential for tracking the lifecycle of images and implementing effective revocation procedures. This system should enable the marking and revocation of images that no longer meet security or compliance standards. Implementing multi-tier revocation automatically revokes parent images and related child images, ensuring consistent enforcement of security policies.</li><li><strong>Continuous Validation and Drift Detection: </strong>Establishing a system for post-deployment configuration drift detection and validation is critical. This system should continuously monitor deployed instances for deviations from the expected configuration defined in the image. Configuring alerts for failed validations, such as the deployment of revoked images, enables rapid remediation and prevents security breaches.</li></ul><p><strong>Auditing and Compliance:</strong></p><ul><li><strong>Comprehensive Audit Logging and SBOM Generation: </strong>Maintaining detailed audit logs of all image creation and update activities is essential for compliance, troubleshooting, and security investigations. This includes capturing information about who made changes when they were made, and what was changed. Generating Software Bill of Materials (SBOMs) for each image provides a comprehensive inventory of software components, facilitating vulnerability management, license compliance, and supply chain security. This data can drive automated workflows and monitoring activities, triggering alerts for suspicious or non-compliant actions.</li></ul><p>By implementing these security and compliance requirements, organizations can establish a secure and trustworthy image factory and ILM process, mitigating risks and ensuring adherence to industry best practices and regulatory requirements.</p><p><a href="https://medium.com/@fonseca.michael/c5f26436527a?source=friends_link&amp;sk=87740e447a87302d567d0717d9ededc1">Part 2</a> will present tooling, workflow, and architecture for building an Image Factory with HashiCorp solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f4cd608325c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/modern-infrastructure-lifecycle-management-the-role-of-the-image-factory-9f4cd608325c">Modern Infrastructure Lifecycle Management: The Role of the Image Factory</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why financial institutions should embrace infrastructure automation metrics]]></title>
            <link>https://medium.com/hashicorp-engineering/why-financial-institutions-should-embrace-infrastructure-automation-metrics-37df5a3484db?source=rss-9788ac93cedd------2</link>
            <guid isPermaLink="false">https://medium.com/p/37df5a3484db</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[infrastructure-management]]></category>
            <category><![CDATA[finops]]></category>
            <category><![CDATA[kpi-metric]]></category>
            <dc:creator><![CDATA[Michael Fonseca]]></dc:creator>
            <pubDate>Mon, 28 Apr 2025 21:25:59 GMT</pubDate>
            <atom:updated>2025-07-14T22:30:36.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hBgv5pgr5LutVYZ2iVEQCw.png" /><figcaption>Why financial institutions should embrace infrastructure automation metrics?</figcaption></figure><p>In today’s fast-paced financial landscape, technology organizations face mounting pressure to deliver innovative services quickly and securely. Legacy infrastructure and manual processes simply cannot keep pace with evolving market demands and regulatory requirements. HashiCorp’s infrastructure-as-code (IaC) tools, like Terraform Enterprise, offer a compelling solution, but how do financial institutions measure the <em>success</em> of their IaC implementation? This article explores key metrics that financial institutions should track to gauge the effectiveness of their infrastructure automation efforts and drive continuous improvement.</p><p><strong>Why are these metrics paramount for financial institutions?</strong></p><p>Financial institutions operate in a highly regulated and competitive environment. They handle sensitive data, process vast sums of money, and, therefore, must maintain unwavering service availability. The cost of downtime, security breaches, or compliance violations can be astronomical, both financially and reputationally. A single infrastructure failure can cost millions in lost transactions, regulatory fines, and damaged customer trust. By implementing automation and a proactive infrastructure lifecycle management strategy, organizations can significantly mitigate risks from malware, software exploits, and both internal and external threats through continuous infrastructure deployment creation, modification, and hardening.”</p><p>Traditional infrastructure management approaches, characterized by manual configurations, siloed systems, and inconsistent processes, have become increasingly inadequate for addressing these challenges. This is precisely why infrastructure metrics take on heightened significance in the financial services sector:</p><ul><li><strong>Risk mitigation</strong>: A low change failure rate and a short failed deployment recovery time are essential for minimizing the impact of infrastructure issues on critical business operations. These metrics directly address the need for stability and resilience, reducing the risk of disruptions to services like payments, trading, or customer account access. Policy compliance rate ensures adherence to strict regulatory requirements (e.g., GDPR, PCI DSS, SOX), minimizing the risk of fines and legal repercussions.</li><li><strong>Security posture</strong>: A high policy compliance rate, driven by policy-as-code, ensures that security best practices are embedded into every infrastructure change. This is crucial for protecting sensitive financial data and preventing increasingly sophisticated cyberattacks. Rapid deployment frequency enables faster patching of vulnerabilities, further strengthening the security posture in an environment where threat landscapes are evolving daily.</li><li><strong>Agility and innovation</strong>: While stability is paramount, financial institutions also need to innovate to stay competitive against both traditional competitors and fintech disruptors. A high deployment frequency and short change lead time enable faster delivery of new features and services, allowing institutions to respond quickly to market demands and evolving customer expectations. This agility is essential for remaining relevant in the rapidly evolving fintech landscape.</li><li><strong>Cost optimization</strong>: A high pattern or component reuse rate reduces development overhead and promotes consistency, leading to cost savings across large-scale operations. Efficient infrastructure management also minimizes wasted resources and improves operational efficiency, particularly important while modernizing legacy systems while managing cost. Infrastructure as Code solutions support the codification of workflow and infrastructure patterns into composable building blocks (e.g., Terraform modules) to achieve this.</li><li><strong>Operational complexity</strong>: Financial institutions often operate hybrid and multi-cloud environments that must connect with legacy systems dating back decades. This creates significant operational complexity that can only be managed effectively through infrastructure automation and standardization, with metrics providing visibility into progress and areas for improvement.</li></ul><p>The infrastructure challenges facing financial services organizations are further compounded by talent shortages in specialized skills, increasing regulatory scrutiny, and constantly evolving customer expectations for digital experiences. Infrastructure as Code offers a strategic approach to addressing these challenges, but success requires establishing the right metrics to guide the transformation journey.</p><p>Additionally, as many organizations have adopted or are evaluating DORA (DevOps Research and Assessment) metrics, we provide a mapping of general DORA concepts and outline recommended metric reporting alignment, specifically for Terraform and Infrastructure Automation initiatives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1TI1h8gWcy8ea1PoyfZ8CQ.png" /><figcaption>Image 1. DORA Metrics High-Level Overview — HashiCorp Automation Metrics</figcaption></figure><p><strong>Key metrics for measuring infrastructure automation success</strong></p><p>Here’s a breakdown of the essential metrics, definitions, value, and how to measure them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fo00CDdpaSZ61sQUmiLE8Q.png" /><figcaption>Image 2.Infrastructure Automation Metrics Overview</figcaption></figure><p><em>Impact Classification Legend</em></p><ul><li><strong><em>Risk</em></strong><em>: Strengthen Security &amp; Governance</em></li><li><strong><em>Cost</em></strong><em>: Optimize cloud operations and ROI</em></li><li><strong><em>Speed</em></strong><em>: Accelerate delivery and innovation</em></li></ul><ol><li><strong>Deployment Frequency (DF):</strong></li></ol><ul><li><strong>Definition:</strong> Measures how often an organization successfully releases infrastructure changes to production environments. This metric quantifies the cadence at which infrastructure updates, configurations, and new resources are deployed through automated processes, e.g., Terraform Enterprise.</li><li><strong>Value:</strong> For financial institutions, higher deployment frequency indicates improved operational agility — a critical capability in responding to market changes, security threats, and evolving customer expectations. Increased deployment frequency demonstrates that an organization can make smaller, safer changes more often, reducing risk while accelerating innovation. It serves as a primary indicator of DevOps maturity and automation effectiveness.</li><li><strong>Impact classification: </strong>Speed and Cost</li><li><strong>How to measure:</strong> Track the number of successful deployments within a given timeframe (e.g., per week, per month). You can also divide this metric by the total number of deployment attempts to calculate the frequency of success. Tools like your CI/CD pipeline and Terraform Enterprise can provide this data. With Terraform, this can be measured through the API by monitoring successful Terraform apply operations in each workspace. This metric should be tracked for performance improvement of Terraform-based deployments and trended/benchmarked against year-over-year comparison for seasonal variability. It should also incorporate the number of applications/resources under management to compare relative performance against scale or deployment complexity.</li><li><strong>Compare to legacy: </strong>Compare these metrics against non-Terraform-based workflows, which may include ticket-based systems, bespoke platforms, and/or cloud service provider-specific tools, typically more focused on gating and not enablement or efficiency. Consider comparing deployment frequency between on-premises and cloud environments as well. Measuring these additional metrics will better articulate the value of the Terraform investment and inform future investments in cloud and workflow transformation. <strong>The shift to measuring deployment frequency represents a fundamental change in perspective — from controlling change to enabling it safely.</strong></li></ul><p><strong>Deployment Frequency key success indicators:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2MyBwlyoNOT2SElnS9IAGw.png" /><figcaption>Image 3. Deployment Frequency (DF) key success indicators</figcaption></figure><p><strong>2. Mean Time To Deploy Initial Infrastructure (MTTDI):</strong></p><ul><li><strong>Definition: </strong>Mean Time to Deploy Initial Infrastructure (MTTDI) represents the average duration required to provision and configure a complete initial infrastructure environment using Terraform. This encompasses establishing initial onboarding procedures, setting up repositories and pipelines, defining the architectural framework, enabling Identity and Access Management (IAM), and executing the full infrastructure provisioning process. It is important to distinguish between MTTDI and Change Lead Time (CTL). MTTDI is specifically designed to provide visibility into the often protracted enablement process, whereas CTL measures the duration of changes within an already enabled environment.</li><li><strong>Value:</strong> Streamlining onboarding, pre-configuration, Identity and Access Management (IAM), and overall enablement processes significantly reduces the time from project initiation to deployment. Given that enablement processes often span days or weeks in many organizations, conducting a comprehensive business process analysis and measuring this lead time can yield substantial reductions in time, financial savings, enhanced customer satisfaction, and accelerated time-to-market.</li><li><strong>Impact classification: </strong>Speed and Cost</li><li><strong>How to measure: </strong>To accurately assess the end-to-end infrastructure provisioning timeline, measure the duration from the initial request to successful production deployment. This necessitates capturing timestamps at each process stage. Specifically, during the Terraform provisioning phase, the HCP Terraform/Enterprise API can be utilized to extract the start and end times of successful plan and apply operations, thereby providing a crucial component of the overall process measurement.</li><li><strong>Compare to legacy:</strong> Traditional tooling enablement, platform onboarding, and Identity and Access Management (IAM) processes are often characterized by manual steps, disconnected systems, and lengthy approval workflows. While Terraform can accelerate infrastructure provisioning, the overall experience for end-users remains protracted and cumbersome. To address this, organizations should establish a baseline by measuring several end-to-end processes. Subsequently, a thorough business process analysis should be conducted to identify automation and streamlining opportunities. Continuous measurement and benchmarking are essential to track the impact of implemented process efficiencies. We recommend exploring solutions such as Developer Portals to simplify onboarding across multiple systems and enhance overall enablement.</li></ul><p><strong>Mean Time To Deploy Initial Infrastructure (MTTDI) key success indicators:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gq1GTTcInCWNgejR--u0GQ.png" /><figcaption>Image 4. Mean Time To Deploy Initial Infrastructure (MTTDI) key success indicators</figcaption></figure><p><strong>3. Change Lead Time (or cycle time) (CLT):</strong></p><ul><li><strong>Definition:</strong> The time it takes for an infrastructure change, from the initial code commit to successful deployment in production. This encompasses code creation, testing, review, approval, and deployment phases.</li><li><strong>Value:</strong> Shorter change lead times enable financial institutions to respond more rapidly to security vulnerabilities, regulatory changes, and business requirements. This metric directly correlates with an organization’s ability to innovate and adapt in a competitive market. For financial institutions, reduced change lead time means faster delivery of critical infrastructure updates without compromising governance requirements.</li><li><strong>Impact classification: </strong>Speed, Risk, and Cost</li><li><strong>How to measure:</strong> Measure the time elapsed between the first code commit related to a specific change and the successful deployment to production. Make certain to track from commit to a production approval process for release. Inserting a manual production review process within the release process can increase total change time, and therefore, alternatives such as pre-approval, clear module parameter definitions, and preventative policy guardrails can reduce cycle times. Your version control system (e.g., Git) and CI/CD pipeline can provide data for these events, and Terraform Enterprise can provide data for run length and completion timestamps.</li><li><strong>Compare to legacy: </strong>Compare Terraform-based workflows against existing, non-automated, or fragmented change control processes. Legacy change workflows often rely on change management systems, ticket-driven actions, and numerous individuals involved with potential delays and errors between handoffs. In contrast, Git-based workflows, integrated with Terraform Enterprise, to provide built-in change management and CI/CD, enabling a higher degree of automation. Furthermore, Terraform modules and embedded policy-as-code solutions like Sentinel, OPA, or Cortex Cloud facilitate increased change velocity compared to legacy processes. Measuring these improvements will better demonstrate the value of the Terraform investment and inform future cloud and workflow transformation initiatives.</li></ul><p><strong>Change Lead Time (CLT) key success indicators:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OTcM5GTN2CiIudzJS7LnEA.png" /><figcaption>Image 5. Change Lead Cycle Time (CLT) key success indicators</figcaption></figure><p><strong>4. Change Failure Rate (CFR):</strong></p><ul><li><strong>Definition:</strong> Represents the percentage of infrastructure changes that result in degraded service, require remediation, or fail to deploy successfully. It measures the reliability and quality of the infrastructure change process.</li><li><strong>Value:</strong> A low change failure rate is critical for financial institutions, where downtime can have significant financial and reputational consequences. It demonstrates the stability and reliability of the infrastructure deployment process. Policy-as-code, a cornerstone of HashiCorp’s approach, helps minimize risk by ensuring compliance and preventing misconfigurations.</li><li><strong>Impact classification: </strong>Speed, Risk, and Cost</li><li><strong>How to measure:</strong> Track the number of failed deployments and divide it by the total number of deployments. Monitor HCP Terraform or Terraform Enterprise deployment logs and ship them into an incident management system to identify failures. HCP Terraform and Terraform Enterprise also provide webhook-based notifications to alert on errors or other events directly into a Slack channel, Teams, email, and more.</li><li><strong>Compare to legacy: </strong>Compare Terraform-based workflows with existing, non-Terraform processes. Legacy workflows may lack full codification and/or rely on ticket-based systems, leading to inconsistent practices, environments, and repeatability. Measuring these differences will better demonstrate the value of the Terraform investment and inform future cloud and workflow transformation initiatives.</li></ul><p><strong>Change Failure Rate key success indicators:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gBvfVHgJPi8mPqlhWiWH5Q.png" /><figcaption>Image 6. Change Failure Rate key success indicators</figcaption></figure><p><strong>5. Failed Deployment Recovery Time (FDRT):</strong></p><ul><li><strong>Definition:</strong> The time it takes to recover from a failed infrastructure deployment in production.</li><li><strong>Value:</strong> Rapid recovery is non-negotiable for financial institutions. A short recovery time minimizes the impact of failures on critical business operations and demonstrates resilience. Automated rollback capabilities, facilitated by IaC, are essential for achieving this.</li><li><strong>Impact classification: </strong>Speed and Cost</li><li><strong>How to measure:</strong> Measure the time elapsed between the detection of a failure and the restoration of the affected service. Monitor HCP Terraform/Terraform Enterprise and incident management systems to track this data.</li><li><strong>Compare to legacy: </strong>Compare Terraform-based workflows with existing, non-Terraform processes. Legacy workflows may lack full codification and/or rely on ticket-based systems, resulting in inconsistent practices, environments, and repeatability. Measuring these differences will better demonstrate the value of the Terraform investment and inform future cloud and workflow transformation initiatives.</li></ul><p><strong>Failed Deployment Recovery Time (FDRT) key success indicators:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S96oaIsXwDM6oyf8-x0sBA.png" /><figcaption>Image 7. Failed Deployment Recovery Time (FDRT) key success indicators</figcaption></figure><p><strong>6. Module Reuse Rate (MRR):</strong></p><ul><li><strong>Definition:</strong> How often pre-built and approved Terraform modules are reused across different projects and teams.</li><li><strong>Value:</strong> High module reuse promotes standardization and consistency, reduces development time, and improves the overall quality of infrastructure deployments. For financial institutions, this translates to greater security, reduced risk of errors, and streamlined compliance.</li><li><strong>Impact classification: </strong>Speed, Risk, and Cost</li><li><strong>How to measure:</strong> Track the number of times existing modules are used in new deployments and/or across Terraform Enterprise workspaces. Divide this by the total number of module deployments to establish an adoption ratio. Terraform registries, tagging, and module repositories can aid in this tracking.</li><li><strong>Compare to legacy: </strong>Compare Terraform-based workflows with existing, non-Terraform processes. Terraform modules provide reusable building blocks, simplifying and accelerating the definition of required infrastructure architecture. Legacy processes often involve teams of architects and engineers across various infrastructure disciplines coordinating on bespoke architectures. The time spent defining these architectures across teams and subsequently implementing bespoke or semi-bespoke infrastructure deployments can be substantial. Measuring this difference will better demonstrate the value of the Terraform investment and inform future cloud and workflow transformation initiatives.</li></ul><p><strong>Module Reuse Rate (MRR) key success indicators:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q7dMocnFGfwCDvJW4uVTVA.png" /><figcaption>Image 8. Module Reuse Rate (MRR) key success indicators</figcaption></figure><p><strong>7. Policy Compliance Rate (PCR):</strong></p><ul><li><strong>Definition:</strong> The percentage of infrastructure deployments that adhere to policies defined using policy-as-code tools like HashiCorp Sentinel or OPA.</li><li><strong>Value:</strong> High policy compliance is essential for financial institutions due to stringent regulatory requirements. It demonstrates that the organization is effectively enforcing its security, compliance, and operational standards, reducing the risk of violations and penalties.</li><li><strong>Impact classification: </strong>Speed, Risk, and Cost</li><li><strong>How to measure:</strong> Monitor Terraform Enterprise and track the number of deployments that pass policy checks. Divide this by the total number of deployments to calculate the compliance rate. In addition, we recommend measuring by the number of policy evaluation classifications, e.g. advisory, soft-mandatory, and mandatory, to provide granularity to the metrics and to understand security usage patterns and feedback loops for code/module improvement. Advisory policies can be used to measure and flag potential risk (e.g., number of workspaces using an out-of-compliance resource) without affecting running infrastructure.</li><li><strong>Compare to legacy: </strong>Develop a metric comparing the number of security remediations required for environments managed by Terraform Enterprise versus those not managed by Terraform Enterprise. Measuring this difference will better demonstrate the value of the Terraform investment and inform future cloud and workflow transformation initiatives.</li></ul><p><strong>Policy Compliance Rate (PCR) key success indicators:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VP8MSv2HjMg2VQZx4Rze0g.png" /><figcaption>Image 9. Policy Compliance Rate (PCR) key success indicators</figcaption></figure><p>Let’s delve deeper into why these infrastructure automation metrics are particularly crucial for financial institutions, explore what they might be measuring today, and discuss the value of adopting a more comprehensive approach.</p><p><strong>Current measurement practices and potential limitations</strong></p><p>Many financial institutions already track infrastructure-related metrics, but these often provide an incomplete picture of their infrastructure effectiveness. Traditional measurement approaches typically focus on:</p><ul><li><strong>Uptime and availability:</strong> While critical, these metrics alone don’t reveal the full story of infrastructure health. High uptime figures may mask underlying issues with deployment efficiency, change management, or recovery capabilities. An environment can appear stable while simultaneously becoming increasingly brittle and resistant to change.</li><li><strong>Mean time to resolution (MTTR)</strong>: This metric appropriately focuses on incident resolution timeframes but often fails to specifically address infrastructure deployment failures or distinguish between different types of incidents. Without proper context, MTTR becomes a blunt instrument that doesn’t drive targeted improvements in infrastructure management.</li><li><strong>Number of incidents</strong>: This reactive metric centers on problems after they occur rather than proactively preventing them. Furthermore, incident counts alone don’t account for severity, impact, or root causes, potentially missing critical infrastructure improvement opportunities.</li><li><strong>Manual change approvals</strong>: While important for governance and compliance, excessive reliance on manual approval metrics can create bottlenecks that impede deployment velocity. Organizations frequently measure approval counts and timelines without assessing whether these controls actually improve quality.</li><li><strong>Infrastructure costs</strong>: Financial institutions often track infrastructure costs meticulously but may fail to connect these expenditures to business outcomes or deployment efficiency. Cost metrics in isolation can drive counterproductive behaviors that optimize for short-term savings at the expense of long-term agility and resilience.</li><li><strong>Compliance checklists</strong>: Many institutions rely on binary compliance assessments (compliant/non-compliant) without measuring the efficiency of achieving compliance or the effectiveness of compliance controls in preventing security incidents.</li><li><strong>Staff utilization</strong>: Traditional operational metrics often focus on how busy infrastructure teams are rather than the value they deliver. High utilization rates may actually indicate inefficient processes rather than productivity.</li></ul><p>These traditional metrics, while providing some visibility, fail to capture the dynamic nature of modern infrastructure management. They tend to be siloed, retrospective, and disconnected from the broader goals of digital transformation. As financial institutions embrace infrastructure as code, they need a more comprehensive measurement framework that connects infrastructure performance to business outcomes while addressing the unique requirements of their regulated environment.</p><p><strong>Why add more metrics?</strong></p><p>The comprehensive infrastructure metrics framework described earlier represents a significant advancement beyond traditional availability and incident measurements. This approach provides a more holistic view of infrastructure automation performance by encompassing the entire lifecycle of infrastructure changes, from development to deployment and recovery. For financial institutions, this measurement evolution delivers substantial strategic value:</p><ul><li><strong>Proactive risk management</strong>: By tracking metrics such as change failure rate and policy compliance rate, institutions can identify potential issues before they impact production environments. This proactive approach is particularly valuable in financial services, where the cost of outages can reach millions of dollars per hour. Advanced metrics enable teams to predict and prevent problems rather than merely responding to them, substantially reducing operational risk exposure.</li><li><strong>Regulatory compliance assurance: </strong>Infrastructure as code, when paired with appropriate metrics, creates an auditable trail of infrastructure changes and compliance status. This documentation is invaluable during regulatory examinations, providing clear evidence of control effectiveness and compliance adherence. Metrics such as policy compliance rate and security vulnerability resolution time deliver quantifiable proof that the organization is maintaining proper controls, a critical consideration for financial regulators.</li><li><strong>Investment optimization</strong>: Infrastructure modernization requires significant capital investment. Advanced metrics provide concrete evidence of return on these investments, helping technology leaders justify expenditures and demonstrate value to senior stakeholders. Metrics that show improvements in deployment frequency and reductions in change lead time directly correlate to business agility and faster time-to-market for new financial products and services.</li><li><strong>Operational excellence</strong>: These metrics create a foundation for continuous improvement in infrastructure management. By identifying bottlenecks, inefficiencies, and areas for optimization, teams can systematically enhance their operations. For financial institutions that manage complex hybrid environments, spanning across legacy systems and modern cloud platforms, this data-driven approach to improvement is essential for long-term operational success.</li><li><strong>Cultural transformation</strong>: Perhaps most importantly, <strong>implementing these metrics fosters a culture of collaboration between development, operations, security, and compliance teams</strong>. In financial organizations where these functions have historically operated in isolation, shared metrics create common goals and mutual accountability. This cultural shift is a prerequisite for successful digital transformation in the highly regulated financial services environment.</li><li><strong>Competitive differentiation</strong> — Financial institutions that effectively measure and optimize their infrastructure capabilities gain a significant competitive advantage. They can deliver new digital services faster, respond more quickly to market changes, and maintain more reliable operations than competitors still relying on traditional infrastructure approaches. In an industry where digital experience increasingly determines customer loyalty, these capabilities translate directly to business performance.</li></ul><p>The implementation of comprehensive infrastructure metrics represents more than an IT operational improvement — it constitutes a strategic business initiative that enables financial institutions to navigate regulatory requirements while still achieving the speed and agility required to compete in today’s market.</p><p><strong>Moving beyond basic metrics: a strategic imperative</strong></p><p>Financial institutions must transcend traditional infrastructure metrics to remain competitive in today’s rapidly evolving marketplace. While basic measurements like uptime and mean time to resolution provide operational snapshots, they fail to capture the full spectrum of capabilities needed for digital excellence.</p><p>By implementing a comprehensive metrics framework — encompassing deployment frequency, change lead time, change failure rate, failed deployment recovery time, module reuse rate, and policy compliance rate — financial organizations gain unprecedented visibility into their infrastructure automation effectiveness. This holistic approach delivers several critical advantages:</p><p>First, it enables <strong><em>predictive</em></strong> rather than <strong><em>reactive</em></strong> management, allowing institutions to address potential issues before they impact customers or operations. Second, it provides the <strong><em>quantitative</em></strong> foundation necessary for continuous improvement across all aspects of infrastructure management. Third, it creates an <strong><em>alignment between technology capabilities and business objectives</em></strong>, ensuring that infrastructure investments directly support strategic priorities.</p><p>For financial institutions navigating complex regulatory requirements while pursuing digital transformation, these advanced metrics serve as both a compass and a roadmap. They illuminate the path toward infrastructure modernization while ensuring that the journey remains compliant with industry regulations and internal risk parameters.</p><p><strong>Metrics as a cornerstone of digital transformation</strong></p><p>Infrastructure as Code represents a fundamental shift in how financial institutions manage their technology foundations. However, implementation alone is insufficient — <strong>success requires rigorous measurement and data-driven optimization</strong>. By consistently monitoring and analyzing the comprehensive metrics outlined in this article, financial institutions transform infrastructure from a cost center into a strategic enabler for business innovation.</p><p>This measurement-driven approach delivers multiple benefits: it reduces operational risk through proactive management, strengthens security posture through consistent policy enforcement, increases agility through accelerated deployment capabilities, and optimizes costs through standardization and reuse. Together, these improvements empower financial institutions to deliver innovative services with both speed and confidence — a critical combination in today’s competitive landscape.</p><p>Moreover, these metrics provide technology leaders with compelling evidence of transformation progress, facilitating productive conversations with executive stakeholders about the business value of infrastructure investments. They transform technical achievements into business outcomes that resonate throughout the organization.</p><p>HashiCorp remains committed to supporting our financial services customers throughout their transformation journeys. Our solutions provide not only the tools for infrastructure automation but also the visibility needed to measure and optimize performance. HashiCorp sees an opportunity to expand offerings in the LLM and agentic space to help consolidate data for insight and looks forward to working with our customers as we move forward with solutions. We invite you to contact your account team to discuss how these metrics can be tailored to your specific strategic objectives and operational environments, ensuring that your infrastructure capabilities fully support your institution’s vision for the future.</p><p>By embracing Infrastructure as Code and implementing robust metrics to guide your transformation, your organization can build the foundation required for sustainable innovation in financial services, where security, compliance, and agility must coexist as equal priorities.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37df5a3484db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/why-financial-institutions-should-embrace-infrastructure-automation-metrics-37df5a3484db">Why financial institutions should embrace infrastructure automation metrics</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Auditing Terraform Open Source for Security, Governance, Risk & Compliance]]></title>
            <link>https://medium.com/hashicorp-engineering/auditing-terraform-open-source-for-security-governance-risk-compliance-4defed31214b?source=rss-9788ac93cedd------2</link>
            <guid isPermaLink="false">https://medium.com/p/4defed31214b</guid>
            <category><![CDATA[audit]]></category>
            <category><![CDATA[policy-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[compliance]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Michael Fonseca]]></dc:creator>
            <pubDate>Mon, 02 May 2022 08:17:14 GMT</pubDate>
            <atom:updated>2022-05-02T08:17:14.298Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XRCHp7YO0Wpx4Wp2Ws9w7Q.png" /><figcaption>Auditing Terraform for Compliance Checklist</figcaption></figure><p>With the skyrocketing usage of Terraform open source (OSS) within provisioning and CI/CD pipeline workflows, organizations are potentially exposing themselves to security risks affecting Corporate Security, and Governance, Risk, and Compliance (GRC) Standards.</p><p>Terraform OSS is a very powerful tool that is often quickly adopted by technical professionals to manage infrastructure provisioning both in the cloud and on-premises. These individuals can then streamline infrastructure provisioning, driving reduced time to market for technology solutions and increasing customer satisfaction.</p><p>In this effort to automate and deliver value to the business, it is too easy to skimp on detailed security requirements. It is important to note that there are some standard Terraform security recommendations such as storing TF state files in encrypted object storage, but in this article, I will outline additional steps enterprises must take to meet their security standards.</p><p>HashiCorp has learned a lot from our customers and 3rd party auditors as it becomes more of a business critical application and requires auditing and security in line with the rest of the Enterprise Risk &amp; Business Continuity programs. In this context, we want to up-level Security &amp; GRC teams by highlighting specific audit insights and outlining how Terraform should be audited for compliance, ultimately saving organizations from the risk of implementing non-complaint workflows or remediating them down the road.</p><p>It is important to note that the following checklist only applies to open source Terraform implementations. In both the managed Terraform Cloud and self-hosted Enterprise offerings, HashiCorp incorporated findings from our customers and 3rd party auditors to lay a security-first foundation for our customers, simplifying security and requiring a much smaller checklist than below (since more is covered by those products). The products’ <a href="https://www.terraform.io/cloud-docs/architectural-details/security-model">security principles</a> and <a href="https://www.terraform.io/cloud-docs/architectural-details/data-security">architecture</a> are outlined in their respective <a href="https://cloud.hashicorp.com/products/terraform">Terraform Cloud &amp; Enterprise</a> docs. In addition, Terraform Cloud &amp; Enterprise products have internal <a href="https://www.hashicorp.com/security">Security &amp; 3rd Party certifications</a>.</p><h4><strong>Terraform Open Source Audit Checklist:</strong></h4><p>This reference is the start of your Terraform OSS compliance efforts. This is not an exhaustive list, however, and there are likely organization-specific requirements for you to consider.</p><h4><strong>Prerequisite: Security Guardrail Risks &amp; Controls</strong></h4><p>Prior to reviewing the Risks within this section, it is important for auditors to understand the role of Policy as code within the infrastructure provisioning lifecycle. Policy as code is the use of code to define and manage rules and conditions within the infrastructure provisioning process. Policy as code can be defined in multiple programming languages and is dependent on the Policy engine that is being used. For the purposes of this article, we refer to <a href="https://www.hashicorp.com/sentinel">HashiCorp Sentinel</a> as the Policy as Code <a href="https://docs.hashicorp.com/sentinel/language">language</a> and <a href="https://www.terraform.io/cloud-docs/sentinel">engine</a> as the reference example.</p><p>HashiCorp Sentinel (i.e. policy as code) is executed in between the Plan and Apply phase of Terraform. The policy engine evaluates all of the Terraform code against the policies and conditions established within the test.</p><p>Enabling Policy within the provisioning stage reduces the risk of security vulnerabilities in deployed environments. If a vulnerability is deployed then it must be remediated which takes time and effort. In this model, we shift security left to the developer so they inherently develop secure TF code and therefore are deploying secure resources within the guardrails provided by the organization and improve developer and application deployment velocity by avoiding post deployment remediation tasks.</p><p>As depicted below, within the Terraform Cloud workflow, multiple checks for Cost Estimation, Sentinel Policies, and Run Tasks are evaluated between the Plan and Apply phase to ensure compliance prior to provisioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1sNyzbbKsviUU7Vc3QGbA.jpeg" /><figcaption>Terraform Cloud Compliance Workflow</figcaption></figure><p>Below are some example policies our users deploy:</p><ul><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/cloud-agnostic/allowed-providers.sentinel">Allowed providers</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/cloud-agnostic/prevent-non-root-providers.sentinel">Prevent providers in non-root modules</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/cloud-agnostic/require-all-modules-have-version-constraint.sentinel">Require all modules have version constraints</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/aws/restrict-ami-owners.sentinel">Restrict owners of the aws_ami data source</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/aws/restrict-ingress-sg-rule-cidr-blocks.sentinel">Disallow 0.0.0.0/0 CIDR block in security groups</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/aws/require-private-acl-and-kms-for-s3-buckets.sentinel">Require S3 buckets to be private and encrypted by KMS keys</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/azure/restrict-aks-clusters.sentinel">Enforce limits on AKS clusters</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/gcp/restrict-ingress-firewall-source-ranges.sentinel">Disallow 0.0.0.0/0 CIDR block in network firewalls</a></li><li><a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/third-generation/vmware/require-storage-drs.sentinel">Require Storage DRS on datastore clusters</a>, etc.</li></ul><p>For more examples <a href="https://www.terraform.io/cloud-docs/sentinel/examples">Terraform Sentinel</a> docs, and the <a href="https://github.com/hashicorp/terraform-sentinel-policies">HashiCorp Sentinel Library</a>.</p><h4>Security Guardrail Risks &amp; Controls</h4><h4><em>Risks (R1)</em></h4><p>R1.1. What policy-as-code guardrails are in-place to conduct static and dynamic TF code analysis before provisioning? Note: For persons not familiar with Policy as Code for Infrastructure Provisioning, <a href="https://docs.hashicorp.com/sentinel/concepts/policy-as-code">the following is a brief summary with examples</a>.</p><p>R1.1.1. What prevents users from accidentally provisioning non-compliant resources?</p><p>R1.1.2. What is the risk of provisioning non-compliant resources such as un-encrypted resources or unrestricted network access?</p><p>R1.1.3. If non-compliant resources are provisioning how is that remediated, and how do you ensure that it does not happen again?</p><p>R1.1.4. If/how are costs controlled in the provisioning phase?</p><p>R1.1.5. Are certain TF code use cases tested today?</p><p>R1.1.6. Are there known security gaps in your TF code testing pipeline?</p><p>R1.1.7. Historically, have gaps been easily identified and addressed with existing tooling and/or processes?</p><p>R1.1.8. Are there limits on scaling TF to other teams due to any known security limitations?</p><p>R1.1.9. Are any provisioning bottlenecks caused by manual security reviews, separation of duties, and/or inefficiencies that can be addressed by the repeatability of policy as code?</p><p>R1.1.10. Would your existing security practices allow you to implement self-service provisioning processes?</p><h4><em>Controls (C1)</em></h4><p>C1.1. All Terraform Code (HCL) &amp; Terraform operational execution is analyzed for security &amp; operational governance controls. For example, all resources are: encrypted, approved for provisioning, ingress &amp; egress rules are compliant, valid module versions are enforced, Terraform versions are enforced, Identity &amp; Access Management (IAM) roles are enforced, etc. There can be hundreds of Security &amp; GRC rules that should be applied to the provisioning process per Corporate guidelines.</p><p>C1.2. Policy as Code as defined above in reference to HashiCorp Sentinel, there are also other functions available within Terraform Cloud/Enterprise products such as <a href="https://www.terraform.io/cloud-docs/workspaces/settings/run-tasks">Run Tasks</a> to provide Policy as Code review from 3rd-party systems such as <a href="https://www.terraform.io/cloud-docs/integrations/run-tasks">Snyk, Bridgecrew, and HCP Packer</a>, along with standalone alternatives such as <a href="https://www.openpolicyagent.org/">Open Policy Agent</a>.</p><p>C1.3. HCL code testing tools for unit and integration testing such as <a href="https://github.com/gruntwork-io/terratest">Terratest</a>, <a href="https://github.com/newcontext-oss/kitchen-terraform">Kitchen-Terraform</a>, or <a href="https://github.com/terraform-compliance/cli/">Terraform compliance</a>. There are multiple suites available as Community additions.</p><p>C1.4. HCL &amp; Terraform operational analysis — this control refers to implementing an overall practice of assessing operational risks within the provisioning process and implementing controls. For example, when operating TF OSS, it is common to have operational issues/incidents due to manual processes such as incorrectly adding variables to TF OSS provisioning runs and/or incorrectly pushing changes meant for a non-production environment to a production environment. Operational controls that ensure the correct changes are aligned to the correct operational environment and/or production changes can only happen within certain time windows. And changes need approval or a segregation of duties for change execution.</p><p>C1.5. A well defined DevSecOps process should be defined to ensure that all security controls are implemented and people, processes, and technologies are aligned, trained, and enforced. For example, when using TF OSS (and if Policy as Code is not defined/implemented), there should be procedures/gatekeeping events to ensure that DevSecOps (or defined personnel) review certain provisioning code changes that meet a defined risk criteria. Risk criteria can be something like all changes to production environments are reviewed by a DevSecOps Engineer prior to executing the provisioning (Note: manual processes create bottlenecks and slow down the delivery process, at all times your organization should be looking towards automation such as Policy as Code). It is important to work with the technology stakeholders to define this risk criteria. If your organization has implemented Policy as Code (e.g. HashiCorp Sentinel) then the DevSecOps team should be involved with implementing and managing this risk criteria within policies.</p><p>C1.6. Terraform Cloud/Enterprise implements many of these suggested controls out of the box, providing Sentinel for Policy as Code, Cost Estimation, workspace locking, variable management and encryption, module usage enforcement and management, and Role Based Access Controls (RBAC) controls.</p><h4><strong>Data Access Risks &amp; Controls</strong></h4><h4><em>Risks (R2)</em></h4><p>R2.1. Are all state files encrypted?</p><p>R2.2. What policies are in place to control human and machine access to TF OSS state files?</p><p>R2.2.1. Does every state files (across all clouds) have IAM controls to ensure only authorized personnel has access to state?</p><p>R2.2.2. Does every state file (across all clouds) have IAM controls to ensure only authorized systems such as other TF state and/or external systems have proper access to state?</p><p>R2.3. Are all functions executed by TF OSS auditable?</p><p>R2.3.1. Are all actions taken by users and systems tracked in detail and stored in a 3rd Party for analysis &amp; reporting purposes?</p><p>R2.3.2. How long is audit data retained today? Is that sufficient to identify advanced persistent threats?</p><p>R2.3.3. Are there automated notifications to users/systems for actions taken by TF OSS?</p><h4><em>Controls (C2)</em></h4><p>C2.1. Ensure all TF state files are encrypted at rest and in transit</p><p>C2.2. Ensure rules of Least Privilege are assessed and implemented. For example, each TF state file has IAM)/RBAC controls specific to the security &amp; risk profile of state file usage. Only Users, Groups, and Machines should have restricted and tightly-scoped access to only the state files that they need. This includes ensuring that access to retrieving state files, and querying outputs and data sources across state files are restricted and scoped to authorized accessors.</p><p>C2.3. Terraform Cloud/Enterprise provides encrypted state file management, RBAC controls, API access roles, SSO, and platform notifications via email, Slack, webhooks, and more.</p><h4><strong>Secrets &amp; Credential Management Risks &amp; Controls</strong></h4><h4><em>Risks (R3)</em></h4><p>R3.1. How are secrets &amp; provider credentials managed for TF OSS? Note: Secrets &amp; Credentials can be any confidential information required to access and/or support required technology components/services within the Terraform provisioning workflow (example: keys, tokens, passwords, etc.)</p><p>R3.1.1. Are secrets &amp; credentials managed consistently or at all?</p><p>R3.1.2. By users?</p><p>R3.1.3. By a 3rd-party system?</p><p>R3.1.4. Are secrets/credentials in the state file? Note: Secrets/Credentials (e.g Cloud Service Provider credentials such as AWS Secrets Key or Azure Service Principal) defined in Terraform code will be written to the TF state file and can be accessed unless otherwise addressed by a recommended control.</p><p>R3.1.5. How are sensitive variables secured, are they encrypted?</p><p>R3.1.6. Are secrets encrypted at rest and/or dynamically generated as required? How is that done?</p><p>R3.2. How are security remediations enforced and remediated (is there a well documented process)? This question is of significant importance due to the model in which Terraform maintains state. For an explanation of the impact, if security issues are not identified and fixed prior to provisioning then, the incident is provisioned and then requires remediation. Many organizations maintain an event-driven policy remediation strategy where the security issue is immediately fixed/rolled back on the Cloud Provider Platform (CSP). If this occurs it creates several issues, one being the management of a feedback mechanism to the Developer to notify them of this remediation and the other is the fixing of Terraform code and/or Terraform state to now match the event-driven policy control on the CSP. These types of fixes can be complex and time consuming if not addressed with something like Sentinel in the pre-provisioning phase.</p><p>R3.3. How are Security, Audit, and Compliance groups provided access to the TF OSS control and data planes for inspection, remediation, and auditability? For example:</p><p>R3.3.1. Are RBAC controls transparent and easily reportable?</p><p>R3.3.2. Is there a full audit trail of all changes and intersections with TF OSS throughout the life cycle of the cloud-managed resources?</p><h4><em>Controls (C3)</em></h4><p>C3.1. Ensure secrets are not being written to TF state files</p><p>C3.2. Ensure that secrets are being stored in secure locations and removed from personal laptops and/or insecure locations or plugins</p><p>C3.3. Ensure all secrets are encrypted</p><p>C3.4. Use short-lived credentials bound by a time-to-live (TTL) for automatic expiry</p><p>C3.5. Leverage Environment Variables. Environment Variables are not recorded in the Terraform state file which can provide a level of security if Terraform state files are not properly controlled and/or removes an additional attack vector.</p><p>C3.6. Leverage secrets management tools such as HashiCorp Vault within CI/CD workflows</p><p>C3.7. Terraform Cloud/Enterprise natively encrypts variables (AES-256-GCM), secures state files, generates audit logging for monitoring security, and includes RBAC controls &amp; API access permissions, SSO, and tightly integrates with other HashiCorp products such as HashiCorp Vault &amp; 3rd party systems such as GitHub &amp; GitLab</p><h4><strong>Business Continuity &amp; Disaster Recovery Risks &amp; Controls</strong></h4><h4><em>Risks (R4)</em></h4><p>R4.1. Does TF OSS manage business-critical resources? If so:</p><p>R4.1.1. Is Vendor Support required?</p><p>R4.1.2. Has a maximum allowable downtime (aka Recovery Time Objective or RTO) for a pipeline/TF provisioning execution been defined?</p><p>R4.1.3. How is the incident and change management process integrated into the workflow (e.g. access, transparency, review, break/fix)?</p><p>R4.1.4. Have there been incidents/issues with Terraform OSS that have impacted operational delivery?</p><p>R4.1.5. How could past incidents have been avoided?</p><p>R4.1.6. Is there a Service Level Agreement (SLA) for Terraform (e.g. TF OSS platform available 99.9% of the time or <a href="https://cloud.hashicorp.com/sla">Terraform Cloud/Enterprise</a>)?</p><p>R4.1.7. Will TF OSS become increasingly important to strategic, forward-looking technology delivery? How will you insure the organization against heightened exposure?</p><p>R4.1.8. What Disaster Recovery practices for TF OSS are implemented? Do they align with other critical, business-facing systems or processes?</p><h4><em>Controls (C4)</em></h4><p>C4.1. Perform a risk assessment for TF OSS provisioning practices</p><p>C4.2. Manage TF OSS as an Enterprise application and assign governance practices like those existing in other critical business functions</p><p>C4.3. Secure financial &amp; human resources to ensure TF OSS is managed as an Enterprise application</p><p>C4.4. Implement Disaster Recovery practices and test them against Corporate Standards</p><p>C4.5. Implement internal Service Level Agreements (SLA’s)</p><p>C4.6. Terraform Cloud/Enterprise is vendor-supported with guaranteed Service Level Agreements (SLAs). Self-managed deployments can take advantage of architectural options like Active-Active mode to minimize operational impact and align to HashiCorp resiliency best practices.</p><h4><strong>Operations &amp; Change Management Risks &amp; Controls</strong></h4><h4><em>Risks (R5)</em></h4><p>R5.1. What policies are in place to ensure only approved TF modules and versions are used?</p><p>R5.2. Is a lack of automated module enforcement creating security risks, bottlenecks or technical debt?</p><p>R5.3. What policies are in place to ensure that only approved OS/Container images are allowed to be provisioned?</p><p>R5.4. Are there frequent issues with Terraform code versions in use and cross-compatibility?</p><p>R5.5. Has the Organization taken on significant technical debt because TF code is not being updated?</p><p>R5.6. What is the estimated size of the total technical debt, including human and financial investment and the average time to remediate?</p><p>R5.7. Has Terraform Open Source been assessed as part of your Supply Chain Attack risk assessment program?</p><p>R5.7.1. Do Developers manage multiple TF OSS binaries on their laptops?</p><p>R5.7.2. How are security risks remediated and binaries managed?</p><p>R5.8. How are security issues enforced and remediated?</p><h4><em>Controls (C5)</em></h4><p>C5.1. Invest time, money, and controls in managing all aspects of TF code management to avoid technical debt, security risks and bottlenecks. This usually requires a holistic set of automated processes and program management established around TF OSS</p><p>C5.2. Investigate other 3rd Party tools to manage TF code &amp; pipelines</p><p>C5.3. Leverage <a href="https://cloud.hashicorp.com/products/packer">HashiCorp HCP Packer</a> to control/enforce only approved OS/Container images are provisioned</p><p>C5.4. Leverage Policy as Code to control/enforce only approved OS/Container images are provisioned</p><p>C5.5. Terraform Cloud/Enterprise allows teams to leverage Sentinel for Policy as Code to avoid creating new technical debt, enforce module versions, enforce approved OS/container images, identify security risks and/or bottlenecks, and provide built-in audit logging for change management controls. It also centralizes binary storage and versioning, eliminating the risk of developers hosting disparate, insecure binaries.</p><h4>Conclusion</h4><p>Terraform Open Source is a highly valuable starting point in the provisioning automation journey for most organizations. However, there are inherently Enterprise-grade security requirements that companies would need to implement themselves. Auditors “don’t know what they don’t know” and this questionnaire is a starting point for Auditors looking to enable and further secure their organizations and infrastructure teams.</p><p>For additional information on HashiCorp Cloud &amp; Enterprise Solutions:</p><p><a href="https://learn.hashicorp.com/terraform">Learn Terraform</a></p><p><a href="https://www.terraform.io/cloud-docs/architectural-details/security-model">Terraform Cloud Security Model</a></p><p><a href="https://www.terraform.io/enterprise/system-overview/security-model">Terraform Enterprise Security Model</a></p><p><a href="https://www.hashicorp.com/blog/using-terraform-to-improve-infrastructure-security">Using Terraform to Improve Infrastructure Security Model</a></p><p><a href="https://www.terraform.io/cloud-docs/sentinel">Terraform Cloud &amp; Enterprise Sentinel (Policy as Code) Framework</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4defed31214b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/auditing-terraform-open-source-for-security-governance-risk-compliance-4defed31214b">Auditing Terraform Open Source for Security, Governance, Risk &amp; Compliance</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Change Management At Scale with Terraform Enterprise & Cloud for Business]]></title>
            <link>https://medium.com/hashicorp-engineering/change-management-at-scale-with-terraform-enterprise-cloud-for-business-eed4c713af6c?source=rss-9788ac93cedd------2</link>
            <guid isPermaLink="false">https://medium.com/p/eed4c713af6c</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[hashicorp-terraform]]></category>
            <category><![CDATA[change-management]]></category>
            <category><![CDATA[gitops]]></category>
            <dc:creator><![CDATA[Michael Fonseca]]></dc:creator>
            <pubDate>Sat, 12 Dec 2020 04:32:32 GMT</pubDate>
            <atom:updated>2020-12-12T04:32:32.139Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Change Management At Scale: How Terraform Helps End Out-of-Band Anti-Patterns</strong></h3><p><a href="https://www.hashicorp.com/blog/change-management-at-scale-how-terraform-helps-end-out-of-band-anti-patterns"><em>Originally published on the HashiCorp Blog.</em></a></p><p><a href="https://www.hashicorp.com/resources/what-is-infrastructure-as-code">Infrastructure as code</a> (IaC) has seen large adoption over the past several years; the benefits and importance within DevOps and the overall technology operating portfolio are no longer up for debate. Now that adoption has hit a critical scale and organizations have a large percentage or all of their technology portfolio managed by IaC, a few important questions arise:</p><ul><li><em>What happens when I need to make one change that will impact a large percentage or all of my infrastructure?</em></li><li><em>I need to make an urgent security vulnerability update to 1000 accounts/resources today, how can I do that?</em></li><li><em>How do I avoid out-of-band changes for my IaC managed infrastructure?</em></li><li><em>We have existing ITIL change management practices. How does IaC work in our existing process?</em></li><li><em>How can I easily show my Security &amp; Auditing team that changes have the proper approval, review, and completion execution?</em></li></ul><p>Many organizations operating today have not put the proper best practices in place to address changes at scale and resort to “out-of-band” changes. Instead of using an IaC tool like Terraform to make the change, they make the change directly through the cloud console/operations management system, not via code. This causes “state drift” or “<a href="https://www.hashicorp.com/resources/how-can-i-prevent-configuration-drift">configuration drift</a>” and, over time, can cause larger issues with infrastructure management.</p><p>So what are the best practices? In this blog, I’ll show how very large organizations typically use Terraform Enterprise or Terraform Cloud for Business to make infrastructure changes at scale without resorting to out-of-band anti-patterns.</p><h3>Best Practice #1: Work Toward Having All Changes Go Through Terraform</h3><p>When managing infrastructure with Terraform, you can’t stop out-of-band changes and configuration drift without mandating that all changes are managed within Terraform.</p><ul><li>Do not allow any out-of-band changes to occur. We recommend disabling any access/controls that will allow changes to an account or resources that are managed by Terraform.</li><li>If out-of-band changes are absolutely required due to current operating practices, then we recommend establishing notification/alerting systems for drift detection so changes can be identified and remediated in Terraform code or tracked as a known out-of-band management practice by the Security &amp; Auditing team moving forward.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*34QaBCry5ulMj8XBHvuB7g.png" /><figcaption>Best Practice #1 Manage all changes with Terraform</figcaption></figure><h3><strong>Best Practice #2: Module Strategies</strong></h3><p>Use Terraform Modules to clearly define discrete areas of infrastructure management that can be standardized, centralized, and applied to manage the broader core infrastructure.</p><ul><li>There is an extensive amount of information available from HashiCorp and others on the creation, usage, and value of <a href="https://www.hashicorp.com/blog/new-guides-terraform-modules">modules</a>.</li><li>Modules allow you to make a change in one place and apply it to many thus promoting code reuse. With that architecture in mind, you will develop modules in a Producer/Consumer model to have centralized change capabilities across your environments.</li></ul><p><strong>Helpful hint: </strong>Use <a href="https://www.terraform.io/docs/configuration/version-constraints.html#best-practices">Version Constraints</a> in Terraform code to ensure proper module lifecycle management.</p><p>As depicted by the image below, with a centralized VPC Module, one change to the VPC module can be applied to “N” number of VPCs or resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*LHOXyIw3Jl5Uzm0vVFsjbQ.png" /><figcaption>Best Practice #2 — Terraform Modules</figcaption></figure><h3><strong>Best Practice #3: Map Your Resources</strong></h3><p>Clearly define and align repos, workspaces, environments, and test.</p><ul><li>A clearly defined mapping and consistent usage of resources is key to understanding where changes are required and the impact of those changes.</li><li>Breaking down code repositories into simpler functional managed units (and using modules) eases the complexity of targeting and scoping changes pushed through your repository structure.</li><li>In Terraform, aligning code repositories as best as possible to a one-to-one repo-to-workspace mapping will provide a more transparent infrastructure and better change execution audibility.</li><li>There are many recommendations available for <a href="https://www.hashicorp.com/resources/terraform-workflow-best-practices-at-scale">workspace</a> best practices but, as a reminder, ensuring that those workspaces are broken down into sub-application-level environments/functional operating levels ensures that changes can be tracked and tested as they are rolled out.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjWLJtWoBb-vSsC3DnU5Iw.png" /><figcaption>Best Practice #3 Terraform Repos, Workspaces, Environments, and Test</figcaption></figure><h3><strong>Best Practice #4: Centralized Auditing</strong></h3><p>Use Terraform Enterprise/Cloud for Business for centralized workflow, state management, and auditability.</p><ul><li>A centralized workflow, view, and <a href="https://www.terraform.io/docs/enterprise/admin/logging.html">auditing</a> capability are necessary to ensure changes are happening on-time and with transparency.</li><li>Terraform Enterprise/Cloud for Business centralizes the storing of all versions of state files safely and securely with access control and encryption. Centralization enables auditors to safely inspect and validate state change via the UI and <a href="https://www.terraform.io/docs/cloud/api/state-versions.html">API</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k9gAO8mGNk9GB1Apa_aLgQ.png" /><figcaption>Best Practice #4 Terraform Workflow, State Management, and Auditability</figcaption></figure><h3><strong>Best Practice #5: Use a</strong> Module Registry</h3><p>Use the Terraform Enterprise/Cloud for Business Private Module Registry (PMR) to publish modules for Consumers.</p><ul><li>The Private Module Registry provides a Producer/Consumer self-service approach to ensure that Terraform users are using the correct and most up-to-date modules within their deployments, and when changes are made, the changes are being made and reflected within the PMR as the single source of truth.</li><li>The PMR enables module versioning, and when a large scale change needs to be made, a new module version can be <a href="https://learn.hashicorp.com/tutorials/terraform/module-private-registry">published to the PMR</a> and consumed at scale.</li><li>Note: If not using the PMR you can use a generic Git module source by selecting a <a href="https://www.terraform.io/docs/modules/sources.html#selecting-a-revision-1">revision</a> by non-default branch or tag using the reference argument.</li><li>Providing transparency and a single source of truth enables easy replication of changes across all required resources.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*psvGJB3UOsZGCBB3DTr7Wg.png" /><figcaption>Best Practice #5 Terraform Private Module Registry</figcaption></figure><h3><strong>Best Practice #6: Concurrency and Transparency</strong></h3><p>Terraform Enterprise/Cloud for Business can also help manage many changes to your infrastructure simultaneously at scale with concurrent runs.</p><ul><li>Terraform Enterprise/Cloud for Business can queue and process multiple <a href="https://www.terraform.io/docs/cloud/run/run-environment.html#concurrency-and-run-queuing">concurrent</a> runs.</li><li>Concurrency provides the capability to queue, process, and track the execution of changes with auditability.</li><li>Concurrency is key to ensuring mass-scale changes are executed with transparency across hundreds to thousands of changes in a timely manner.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SyEpGmGDlWQkTUG61xL5uQ.jpeg" /><figcaption>Best Practice #6: Terraform Concurrent Runs</figcaption></figure><h3><strong>Best Practice #7: Policy as code</strong></h3><p><a href="https://docs.hashicorp.com/sentinel/concepts/policy-as-code">Policy as code</a> is becoming critical in many enterprises to automate custom rules and guardrails so that a team or organization’s infrastructure change policies are enforced without slowing operators down by days or weeks.</p><ul><li><a href="https://www.terraform.io/docs/cloud/sentinel/index.html">Sentinel is a high-level framework and language used by Terraform Enterprise/Cloud for Business</a> to automatically inspect Terraform code in the provisioning process and enforce customizable policy as code to ensure that proper changes are being made.</li><li>Sentinel can enforce that modules can only get deployed from the PMR.</li><li>Sentinel can enforce that the correct versions of modules are being applied.</li><li>With Sentinel compliance is enforced at the provisioning and re-provisioning stage for change compliance. There is much less risk in identifying and fixing security issues pre-provisioning vs. post-provisioning.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruPC6wT74rrAOqk_fajk1g.png" /><figcaption>Best Practice #7 Terraform Sentinel Policy as Code</figcaption></figure><h3>Centralizing Your Workflow Through Version Control</h3><p>Architecting your code and workflow are key components of change management at scale. In this new model, Git (or your version control system of choice: GitHub, Bitbucket, GitLab) becomes your change management tracking or, at a minimum, your sub-tracking system operating underneath a change initiator system such as <a href="https://www.hashicorp.com/blog/announcing-servicenow-integration-for-terraform-enterprise">ServiceNow</a>.</p><p>In this new “GitOps” model supported by Terraform Enterprise/Cloud, you will focus on three clear steps to support change at scale:</p><ol><li>Use modules to drive re-usability and best practice enforcement at scale (single-point-of-change).</li><li>Use Terraform as the single point of execution for scalability and auditability.</li><li>Use Sentinel to ensure that changes are being executed and that nothing can be provisioned outside of the defined organizational security profiles.</li></ol><p>I hope this brief introduction to change management at scale gets you thinking and researching some of these practices to make life easier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eed4c713af6c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/change-management-at-scale-with-terraform-enterprise-cloud-for-business-eed4c713af6c">Change Management At Scale with Terraform Enterprise &amp; Cloud for Business</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Definitive Guide to Cloud Cost Optimization with Terraform]]></title>
            <link>https://medium.com/hashicorp-engineering/the-definitive-guide-to-cloud-cost-optimization-with-terraform-d4b7caf16cd2?source=rss-9788ac93cedd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4b7caf16cd2</guid>
            <category><![CDATA[finops]]></category>
            <category><![CDATA[tbm]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Michael Fonseca]]></dc:creator>
            <pubDate>Tue, 18 Aug 2020 23:07:58 GMT</pubDate>
            <atom:updated>2020-09-15T22:50:30.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pa6I8DxnCLU0eaOq9nNLgA.jpeg" /></figure><p><em>This article was </em><a href="https://www.hashicorp.com/blog/a-guide-to-cloud-cost-optimization-with-hashicorp-terraform"><em>cross-published</em></a><em> on the HashiCorp Blog.</em></p><p><strong>The Problem — An Engineers New Role Cloud “Financial Controller”</strong></p><p>If you’re reading this, chances are you are in DevOps (or some type of Engineering) and you are wondering why on earth do I care about Cloud Cost Optimization?…that’s not my job, I’m not in Finance right?…WRONG!</p><p>Engineers are the new cloud Financial Controllers, and if you are interested in defining this new role, automating your newfound responsibility, and implementing a process for Cloud Cost Optimization with <a href="https://www.terraform.io/docs/cloud/getting-started/cost-estimation.html">Terraform Cloud for Business &amp; Enterprise</a> read on. Now yes, Cloud Cost Optimization is important, and in this article, we will fully address it in the context of an overall model of Cloud Cost Management (also <a href="https://www.finops.org/">FinOps</a>).</p><p><strong>Please note that the majority of features reviewed in this article focus on Terraform paid functionality such as Cost Estimation and Governance &amp; Policy but the core use case around cost optimization can be achieved with open-source.</strong></p><p><strong>The New Cloud Financial Model</strong></p><p>With the continuous shift to consumption-based cost models for infrastructure and operations; i.e. Cloud Service Providers (CSPs), you pay for what you use but you also pay for what you provision and don’t use. If you do not have a process for continuous governance and optimization, then there is a potential for waste.</p><p>In a recent <a href="https://www.densify.com/resources/top-cloud-priorities">survey</a> respondents stated:</p><ul><li>45% of the organizations reporting were over-budget for their cloud spending</li><li><strong>More than 55% of the respondents are using either cumbersome manual processes, or simply do not implement actions and changes to optimize their cloud resources</strong></li><li>34.15% of respondents believe they can save up to 25% of their cloud spend and 14.51% believe they can save up to 50%. Even worse, 27.46% said, “I don’t know”.</li></ul><p><strong>First, let’s unpack why there is an opportunity and then get to the execution</strong></p><p>In moving to the cloud, most organizations have put thought into basic governance models where a team, sometimes referred to as the Cloud Center of Excellence, looks over things like strategy, architecture, operations, and, yes, cost. Most of these teams contain a combination of IT Management and Cloud technical specialists from common IT domains and Finance. Finance is primarily charged with cost planning, migration financial forecasting, and optimization. Due to financial pressures, they tend to say “<em>We need to do something about getting a handle on costs, savings, forecasting etc.</em>” but have no direct control over costs. It is now Engineers that directly manage infrastructure and the costs.</p><p>The business case is simple, it is a financial paradigm shift where:</p><ul><li>Engineers are not only responsible for Operations but now also Costs.</li><li>Engineers now have the tools and capabilities to automate and directly impact cost controls.</li><li>Cost planning and estimation of running cloud workloads are not easily understood or forecasted by Finance.</li><li>Traditional forms of financial budgeting and on-prem hardware demand planning (such as contract-based budgets and capitalized purchases) do not account for cost variability in consumption-based models.</li></ul><p>Finance lacks control in the two primary areas of cost-saving:</p><ul><li>Pre-provisioning: Limited governance and control in the resource provisioning phase.</li><li>Post-provisioning: Limited governance and control in enforcing infrastructure changes for cost savings.</li></ul><p>In the following article, we will define the people, processes, and technologies associated with managing cloud financial practices with Terraform.</p><p><strong>The People</strong></p><p>To simplify things, we will assume there is some sort of team, i.e., the Cloud Center of Excellence, that is responsible for managing the overall cloud posture.</p><p>On this team there are four core roles:</p><ul><li>IT Management</li><li>Finance</li><li>Engineering (consisting of DevOps and Infrastructure &amp; Operations)</li><li>Security</li></ul><p>In managing the “Cost of Cloud”, we will view Engineering’s role in the management of costs in the following context:</p><ul><li><strong>Planning</strong> — relating to Pre-Cloud Migration &amp; Ongoing Cost Forecasting</li><li><strong>Optimizing</strong> — Operationalizing and Realizing Continuous Cost Savings</li><li><strong>Governance</strong> — Ensuring Future Cost Savings &amp; Waste Avoidance</li></ul><p>The following RASCI model can be used as a baseline of expectations for your team and, moving forward, we will focus on the Engineers role of “Responsibility” in these three primary areas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A7VlhCf0aoY9_01Y" /><figcaption>Cloud Center of Excellence RASCI Model</figcaption></figure><p>As you can see, Engineering has a higher level of responsibility in today’s infrastructure operations. I have used this and similar models to define the roles and responsibilities of the Cloud Center of Excellence to many organizations. The RASCI model is effective but also make sure to account for Frequency and Workflow as these will differentiate from current IT cost models and you will want to set expectations accordingly.</p><p><strong>The Process — Planning, Optimization, &amp; Governance</strong></p><p>Now we are going to take a look at how Engineers can use Terraform at each level of the Cloud Cost Management process to deliver value and minimize additional work. To get started, below is a visualization of how Terraform fits into the Cloud Cost Management Lifecycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/0*-qT5dMr2Z_uTARTg" /><figcaption>Cloud Cost Management Lifecycle Terraform</figcaption></figure><p>The overall process can be summed up as:</p><ul><li>Start by identifying workloads migrating to the cloud</li><li>Create Terraform configuration</li><li>Run terraform plan to perform cost estimation</li><li>Run terraform apply to provision the resources</li><li>Once provisioned, workloads will run and Vendors will provide Optimization Recommendations</li><li>Integrate Vendor’s Optimization Recommendations into Terraform and/or CI/CD pipeline</li><li>Investigate/analyze Optimization Recommendations and implement Terraform Sentinel for Cost &amp; Security Controls</li><li>Update Terraform configuration and run plan &amp; apply</li><li>Newly optimized and complainant resources are now provisioned</li></ul><p><strong>Section 1 — Planning — Pre-Migration &amp; Ongoing Cost Forecasting</strong></p><p>Cloud migrations require a multi-point assessment to determine the potential to move an application/workload to the cloud. Primary factors for the assessment are architecture, business case, the estimated cost for the move, and the ongoing utilization costs budgeted/forecasted for the next 1–3 years on average.</p><p>Old models of capitalization and amortization for application/workload costing done by Finance are a thing of the past, and now Engineering is responsible for managing operational costs. With Terraform, users can more clearly communicate expected costs with <a href="https://www.terraform.io/docs/cloud/getting-started/cost-estimation.html">Terraform’s Cost Estimation</a> functionality.</p><p>Using Terraform configuration files as a standard definition of how an application/workload is costed, you can now use <a href="https://www.terraform.io/docs/cloud/api/cost-estimates.html">Terraform Cloud &amp; Enterprise API</a>’s to automatically supply Finance with estimated cloud financial data or use Terraform’s user interface to provide Finance direct access to review costs and, by doing so, eliminate manual engineering oversight.</p><p><strong>Planning Recommendations:</strong></p><ul><li>Use Terraform configuration files as the standard definition of costing across AWS, Azure &amp; GCP for cloud cost planning and forecasting, and provide this information via Terraform API or <a href="https://www.terraform.io/docs/cloud/workspaces/access.html">role-based access controls</a> within the Terraform user interface to provide Financial persons a self-service workflow.</li><li>Note: Many organizations conduct planning within Excel, Google Sheets, and Web-based tools. To make data usable within these systems we would recommend using <a href="https://www.terraform.io/docs/cloud/api/cost-estimates.html">Terraform’s Cost Estimates API</a> to extract the data.</li><li>Use <a href="https://www.terraform.io/docs/configuration/modules.html">Terraform Modules</a> as standard units of defined infrastructure for costing high-level assessments and cloud demand planning (for example): Define a standard set of modules for a standard Java application so module A + B + C = $X per month and we plan to move 5 Java apps this year this can be a quick methodology to assess potential application run costs prior to defining the actual Terraform configuration files.</li><li>Use Terraform to understand application/workload financial growth over time, i.e., cloud sprawl costs.</li><li>Attempt to structurally align <a href="https://www.terraform.io/docs/cloud/users-teams-organizations/organizations.html">Terraform Organization, Workspace, and Resource</a> naming conventions to the financial budgeting/forecasting process.</li></ul><p>Getting started with Terraform Cost Estimation is easy and the basic steps for Terraform Cloud for Business &amp; Enterprise are provided in our <a href="https://www.terraform.io/docs/cloud/getting-started/cost-estimation.html">Learn Guide</a>. Once enabled, when a Terraform Plan is run, Terraform will reach-out to the AWS, Azure, and GCP cost estimation APIs to present the estimated cost for that Terraform Plan which can be used accordingly within your financial workflow.</p><p><strong>Example of Cost Estimation Output in Terraform</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*iYUvlaofghAeMHju" /><figcaption>Terraform Cost Estimation</figcaption></figure><p><strong>Example of the Cost Estimation API JSON Payload from Terraform</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BQShbDm_kjuxQE2e" /><figcaption>Terraform Cost Estimation API JSON Payload</figcaption></figure><p>Now it is important to note that Terraform Cost Estimation provides costs based on a workspace view. If you would like a higher level, cross-workspace view, you will need to leverage the Terraform Cost Estimation API and a reporting tool of your choice. To give it a try there is a great little project named Tint from Peyton Casper, a HashiCorp Senior Solutions Engineer. Here is the blog to get started with <a href="https://medium.com/hashicorp-engineering/tint-multi-cloud-cost-visualization-for-terraform-ef7dff60a67b">Tint: Multi-Cloud Cost Visualization for Terraform</a> and the project is hosted on GitHub <a href="https://github.com/peytoncasper/tint">peytoncasper/tint</a>. In reality, any standard corporate reporting tool (e.g., Microsoft BI, Tableau, etc.) will work based on in-house requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ocZEf2FOJsdDIeVC" /><figcaption>Example Dashboard from Tint</figcaption></figure><p><strong>Section 2 — Optimizing — Operationalizing and Realizing Continuous Cost Savings</strong></p><p>Optimization is the continued practice of evaluating the cost-benefit ratio of usage vs. provisioned resources and then adjusting that ratio to be most advantageous to your organization.</p><p>That said, many organizations have access to optimization recommendations from Cloud Service Providers such as AWS, Azure, or GCP or popular third-party tools. The main challenge of using these optimization tools is that organizations are not properly taking advantage of the recommendations.</p><p>What we see is a disconnect from the Engineering/DevOps workflow (CI/CD pipeline) where Engineering does not engage with these optimization systems. Therefore, there is no feedback mechanism and even more, there is a high level of manual intervention in optimization consumption when they are engaged.</p><p><strong>Automating Optimization Insights into the Provisioning Workflow</strong></p><p>It is safe to say that the major CSPs (<a href="https://docs.aws.amazon.com/awssupport/latest/user/trustedadvisor.html">AWS</a>, <a href="https://docs.microsoft.com/en-us/rest/api/cost-management/">Azure</a>, <a href="https://cloud.google.com/recommender/docs/apis">GCP</a>) and the vast majority of third-party tools provide access to export optimization recommendations via an API or an alternative method. For the purposes of this guide, we are going to focus on the basic steps/approach to automate the process of ingesting optimization recommendations which will come directly from the CSPs or from third parties such as <a href="https://www.hashicorp.com/integrations/densify/terraform">Densify</a> who maintain a <a href="https://registry.terraform.io/modules/densify-dev/optimization-as-code/null/1.2.0">Terraform Module</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABH3L9M1Y_ZVL7duA-mQqA.jpeg" /><figcaption>Densify EC2 Optimization Example</figcaption></figure><p>The concepts and code can be used as a model for your own deployment. Please note that each Vendor provides a different set of recommendations, but universally all provide insights on compute, so we will focus on compute as a norm, but any insight that you receive can be consumed based on the pattern below (e.g. compute, storage, DB, etc.).</p><p><strong>Basic patterns for consuming optimization recommendations:.</strong></p><p>Establish a mechanism for Terraform to access the optimization recommendations. We see several common patterns:</p><ul><li><strong>Manual Workflow</strong> — Review of optimization recommendations from the providers portal and manually update Terraform files. Note: Not optimal — no automation, but a feed back loop for optimization must start somewhere!</li><li><strong>File Workflow</strong> — Create a mechanism where optimization recommendations are imported into a local repository via a scheduled process (usually daily).</li><li>For instance, Densify customers use a script to export recommendations into a densify.auto.tfvars file and it is downloaded and stored in a locally accessible repository.</li><li>Then Terraform <a href="https://www.terraform.io/docs/configuration/functions/lookup.html">lookup</a> function is used to look-up specific optimization updates that have been set as variables.</li><li><strong>API Workflow</strong> — Create a mechanism for optimization recommendations to be extracted directly from the Vendor and stored within an accessible data repository and use Terraform’s <a href="https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/data_source">http data_source</a> functionality to perform the dataset import reference.</li><li><strong>Ticketing Workflow</strong> — This workflow is similar to the File and API workflow but some organizations insert an intermediary step where the optimization recommendations first go to a change control system like ServiceNow or Jira. Within these systems there is workflow &amp; approval logic built-in where a flag is set for acceptable change and is passed as a variable to be consumed later in the process.</li></ul><p><strong>Terraform Code Update Examples</strong></p><p>In any of these cases, especially if automation is to take place, it will be important to maintain key pieces of resource data as variables. Optimization is a function of provisioned size and usage and the optimization provider will provide a recommendation to size the resource or service i.e. Compute, DB, Storage accordingly. As an example, we will use Compute, but the example is representative of all.</p><p>At a minimum, it is recommended that you have three variables set to perform the optimization Terraform update with some basic logic. Those variables and logic being:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*E4dgJINuZNMfMnMXRFyd-w.png" /><figcaption>Terraform Variable update recommendations</figcaption></figure><p>As an example, we will use Densify as a vendor-supported optimization process, but there are many HashiCorp customers &amp; users that create their own Providers for similar processes. <a href="https://registry.terraform.io/modules/densify-dev/optimization-as-code/null/1.2.0">Their Terraform Module</a> can be found via the Terraform Registry and the code found on GitHub <a href="https://github.com/densify-dev/terraform-null-optimization-as-code">Densify-dev</a>.</p><p>In the following, you will see some basic updates of Terraform code with variables and logic to get you started. Below is an example of the variables created.</p><pre>variable &quot;densify_recommendations&quot;{<br>  description = &quot;Map of maps generated from the Densify Terraform Forwarder. Contains all of the systems with the settings needed to provide details for tagging as Self-Aware and Self-Optimization&quot;<br>  type = &quot;map&quot;<br>}<br>variable &quot;densify_unique_id&quot; {<br>  description = &quot;Unique ID that both Terraform and Densify can use to track the systems.&quot;<br>}<br>variable &quot;densify_fallback&quot;{<br>  description = &quot;Fallback map of settings that are used for new infrastructure or systems that are missing sizing details from Densify.&quot;<br>  type = &quot;map&quot;<br>}</pre><p>Next, you will see updates with the Terraform lookup function to look-up the local optimization recommendations file (i.e. densify.auto.tfvars) for updates/changes. The optimization recommendations can also be auto-delivered by Densify using Webhooks and subscription<a href="https://www.densify.com/dev"> APIs</a>.</p><pre>locals{<br>  temp_map = &quot;${merge(map(var.densify_unique_id, var.densify_fallback),var.densify_recommendations)}&quot;<br>  densify_spec = &quot;${local.temp_map[var.densify_unique_id]}&quot;<br>  cur_type = &quot;${lookup(local.densify_spec,&quot;currentType&quot;,&quot;na&quot;)}&quot;<br>  rec_type = &quot;${lookup(local.densify_spec,&quot;recommendedType&quot;,&quot;na&quot;)}&quot;<br>  savings = &quot;${lookup(local.densify_spec,&quot;savingsEstimate&quot;,&quot;na&quot;)}&quot;<br>  p_uptime = &quot;${lookup(local.densify_spec,&quot;predictedUptime&quot;,&quot;na&quot;)}&quot;<br>  ri_cover = &quot;${lookup(local.densify_spec,&quot;reservedInstanceCoverage&quot;,&quot;na&quot;)}&quot;<br>  appr_type = &quot;${lookup(local.densify_spec,&quot;approvalType&quot;,&quot;na&quot;)}&quot;<br>  recommendation_type = &quot;${lookup(local.densify_spec,&quot;recommendationType&quot;,&quot;na&quot;)}&quot;</pre><p>Lastly, you will want to insert some logic to ensure that you are properly handling the usage reference i.e. if a recommendation is available use it, otherwise keep current. Note: Densify also adds some code in there as part of a change control process for their customers that are using ServiceNow or Jira (but this can be any change control/ticketing system). They have an option to first pass the optimization recommendation to be approved in one of these external systems and then pass an approval flag in as a variable to ensure that it is an approved change.</p><pre>instance_type = &quot;${local.cur_type == &quot;na&quot; ?<br>    &quot;na&quot; : <br>    local.recommendation_type == &quot;Terminate&quot; ? <br>      local.cur_type:<br>      local.appr_type == &quot;all&quot; ? <br>        local.rec_type : <br>        local.appr_type == local.rec_type ? <br>          local.rec_type : <br>          local.cur_type}&quot;</pre><p>For customers not using or not wanting a third party approval system, the recommendation changes will be visible on Terraform Plan. Similarly, they can also manually update a variable such as appr_type = false to avoid using the recommendation or use other similar methods via <a href="https://www.hashicorp.com/blog/terraform-feature-toggles-blue-green-deployments-canary-test/">Feature Flags</a> and <a href="https://www.terraform.io/docs/configuration/expressions.html#conditional-expressions">conditional expressions</a> in Terraform to control applied functionality.</p><p>The important point that we have gotten to here is we now have a defined process that can be partially or fully automated to make changes to our environment to optimize and save.</p><p><strong>Section 3 — Governance — Ensuring Future Cost Savings</strong></p><p>The last and critical component of the Cloud Cost Management Lifecycle is how do we stop cost overruns again?…and how do we ensure a continuous feedback loop for control? I have had this conversation with many organizations that have done optimization exercises and then costs shoot back up and it turns into a game of waste and delayed recovery, so let’s focus on waste avoidance from the start.</p><p>So how do we do that with Terraform Cloud &amp; Enterprise? It is with Sentinel, a product embedded within Terraform for governance &amp; policy. In the following steps, it is assumed that you will apply learnings from the optimization recommendations in order to apply policy for cost control.</p><p><strong>Cost Compliance as Code = Sentinel Policy as Code</strong></p><p><a href="https://www.terraform.io/docs/cloud/sentinel/index.html">Terraform Sentinel</a> is a Policy as Code engine that evaluates the resource that Terraform is managing against policy definition. <a href="https://www.hashicorp.com/sentinel/">Sentinel</a> can be used to define policy on any and all data defined within a Terraform file. Common uses of Sentinel are to ensure provisioned resources are: secure, tagged, and are within allowable usage policies and cost.</p><p>Specifically focusing on costs, Terraform customers implement policy around three primary areas: (but there is no limit…you can get creative):</p><p>Cost Controls Areas:</p><ul><li><strong>Amount</strong> — Control the amount of spend</li><li><strong>Provisioned size</strong> — Control the size/usage of the resource</li><li><strong>Time to live</strong> — Control the time to live of the resource</li></ul><p>In all three of these areas, you are able to apply policy or controls around things like Terraform Workspaces (e.g. apps/workloads), environments (e.g. prod, test, dev), and tags to ensure that spend and controls are aligned to optimize resources and avoid unnecessary spend.</p><p>The following is an example Sentinel policy output when running Terraform Plan. We will focus on three policies:</p><ol><li><strong>passed</strong> — aws-global/limit-cost-by-workspace-type</li><li><strong>advisory failed</strong> — aws-compute-nonprod/restrict-ec2-instance-type</li><li><strong>passed</strong> — aws-global/enforce-mandatory-tags</li></ol><p>Note: Sentinel has three <a href="https://docs.hashicorp.com/sentinel/concepts/enforcement-levels/">Enforcement Levels</a>: Advisory, Soft-Mandatory, and Hard-Mandatory — please refer to the provided link for definitions. The Enforcement Level will dictate workflow and resolution of policy violations. In addition, please note that Terraform Cloud for Business &amp; Enterprise is fully API enabled and users may interact with the Terraform “UI, CLI, or the API” to fully integrate into their CD/CD pipelines for policy workflow control and <a href="https://www.terraform.io/docs/providers/type/vcs-index.html">VCS</a> systems such as GitLab, GitHub, and BitBucket for policy creation and management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RL9IkN0tEGGMSLWf" /><figcaption>Terraform Policy Check</figcaption></figure><p><strong>Sentinel Cost Compliance Code Examples</strong></p><p>In the <a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/second-generation/cloud-agnostic/limit-cost-by-workspace-type.sentinel">aws-global/limit-cost-by-workspace-type</a> policy defined for this Workspace (which can be individual or globally defined), we have applied monthly limits on how much spend can be provisioned by this Workspace and also an enforcement level. A snippet of the policy is visible below where we have defined a Monthly limit of cost (Dev = $200) and an enforcement level. Again depending on enforcement level users will need to address the policy violation accordingly, but most important is that we have a mechanism to control costs before those resources are provisioned.</p><p><strong>Sentinel Cost Compliance — Monthly Limits</strong></p><pre>##### Monthly Limits #####<br>limits = {<br>  &quot;dev&quot;: decimal.new(200),<br>  &quot;qa&quot;: decimal.new(500),<br>  &quot;prod&quot;: decimal.new(1000),<br>  &quot;other&quot;: decimal.new(50),<br>}<br> <br>policy &quot;limit-cost-by-workspace-type&quot; {<br>    enforcement_level =&quot;soft-mandatory&quot;</pre><p><strong>Sentinel Cost Compliance — Instance Types</strong></p><p>As a second example, for a multitude of reasons including compliance and costs many customers will restrict what compute instance types can be provisioned and potentially configuration limits based on environment or team. An example of the full policy can be seen here: <a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/second-generation/aws/restrict-ec2-instance-type.sentinel">aws-compute-nonprod/restrict-ec2-instance-type</a>. In the example below, we have a policy that controls instance sizes on non-prod environments to ensure lower costs in these areas and we can apply a different policy to production if we so choose.</p><pre># Allowed EC2 Instance Types<br># We don&#39;t include t2.medium or t2.large as they are not allowed in dev or test environments<br>allowed_types = [<br>  &quot;t2.nano&quot;,<br>  &quot;t2.micro&quot;,<br>  &quot;t2.small&quot;,<br>]<br> <br>policy &quot;restrict-ec2-instance-type&quot; {<br>    enforcement_level = &quot;advisory&quot;</pre><p><strong>Sentinel Cost Compliance — Enforce Tagging</strong></p><p>Lastly, tagging is a critical factor in understanding costs. Tagging enables you to group, analyze, and provide policy around cost optimization.</p><p>Terraform with Sentinel provides the capability to enforce Tagging at provisioning and during updates to ensure that optimization can be targeted and governed. Tagging is managed in a simple Key/Value format and can be enforced across all CSPs. Here is a full <a href="https://github.com/hashicorp/terraform-guides/blob/master/governance/second-generation/aws/enforce-mandatory-tags.sentinel">sample policy for enforcement on AWS</a> but Sentinel is highly flexible and can be similarly configured for any cloud provider (snippet provided below).</p><pre>### List of mandatory tags ###<br>mandatory_tags = [<br>  &quot;Name&quot;,<br>  &quot;ttl&quot;,<br>  &quot;owner&quot;<br>  &quot;cost center<br>  &quot;appid&quot;,<br>]<br> <br>policy &quot;enforce-mandatory-tags&quot; {<br>    enforcement_level =&quot;hard-mandatory&quot;</pre><p><strong>Summary</strong></p><p>Yes, this article is long but the name did have a “Definitive Guide” in it, and the purpose is really to articulate that there has been an accountability shift in organizations to Engineering for Cloud Cost Management. Engineering controls the mechanism for costs and savings like never before.</p><p>In addition, as organizations continue to invest in Terraform, IaC, and Cloud Platforms, they can no longer operate in the siloed financial and operational processes as of today. To enact savings, you need to enact change and that is where Terraform comes in, reclaiming and optimizing resources moving forward as an ecosystem of solutions and feedback mechanisms.</p><p>If anyone has worked on projects in this space with Terraform that you would like to highlight or if you want more information on the subject, please feel free to reach out.</p><p><em>Note: Special thanks to </em><a href="https://www.linkedin.com/in/tonypulickal/"><em>Tony Pulickal</em></a><em> — for insight and review</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4b7caf16cd2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/the-definitive-guide-to-cloud-cost-optimization-with-terraform-d4b7caf16cd2">The Definitive Guide to Cloud Cost Optimization with Terraform</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>