<?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 Apoorva Murde on Medium]]></title>
        <description><![CDATA[Stories by Apoorva Murde on Medium]]></description>
        <link>https://medium.com/@apoorva.murde?source=rss-31dced295a1d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q5J6FiPMvI6TC4r0rZKuEg.jpeg</url>
            <title>Stories by Apoorva Murde on Medium</title>
            <link>https://medium.com/@apoorva.murde?source=rss-31dced295a1d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:51:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@apoorva.murde/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[State Management in Terraform Cloud: Secure, Scalable, and Simple]]></title>
            <link>https://blog.searce.com/state-management-in-terraform-cloud-secure-scalable-and-simple-7e4e4d8c3f8e?source=rss-31dced295a1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e4e4d8c3f8e</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[terraform-enterprise]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Apoorva Murde]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 11:29:27 GMT</pubDate>
            <atom:updated>2025-04-24T07:17:32.393Z</atom:updated>
            <content:encoded><![CDATA[<p>CHAPTER 4</p><p>Welcome back, dear readers! In our previous blog “<em>Terraform Workspaces</em>”, we learned about the workspace management in TFC.Now lets dive in into how we can manage the state files.</p><h3><strong>Introduction:</strong></h3><p>Managing infrastructure with Terraform brings many advantages, but with those advantages come the complexities of state management. Properly managing state in a Terraform deployment is crucial to ensure that your infrastructure remains consistent and secure. In this blog, we’ll take a deep dive into how <strong>Terraform Cloud (TFC)</strong> simplifies state management, providing a secure, scalable, and simple solution. We’ll explore its remote backends, state locking, versioning, how sensitive data is handled in state files, and where and how you can view these state files, with specific reference to <strong>Google Cloud Platform (GCP)</strong> and <strong>GitHub</strong> integrations.</p><h3><strong>🗄️ How Terraform Cloud (TFC) Manages State</strong></h3><p>Terraform state files track the current configuration of the resources managed by Terraform. These files serve as the source of truth for your infrastructure, allowing Terraform to determine what has changed and what needs to be updated. By default, Terraform stores these state files locally, but this can lead to challenges when working in teams or managing large infrastructures.</p><p>This is where <strong>Terraform Cloud (TFC)</strong> steps in. TFC provides a centralized, remote backend to store state files securely, which brings several benefits over local state management, particularly in a team or enterprise environment. Let’s break down how TFC manages state and the features it offers to make your infrastructure as code (IaC) process smoother and more secure.</p><h3><strong>🌐 Remote Backends in Terraform Cloud</strong></h3><p>One of the core features of TFC is the use of <strong>remote backends</strong> for state management. With Terraform Cloud, your state is stored remotely, meaning it’s not bound to a local machine or environment. This allows for greater collaboration, stability, and security. When you configure Terraform to use Terraform Cloud as the backend, you enable remote management of your infrastructure’s state.</p><p>Here’s a sample configuration to define Terraform Cloud as your backend:</p><pre><br>terraform {<br>  backend &quot;remote&quot; {<br>    organization = &quot;Searce-organization&quot;<br>    workspaces {<br>      name = &quot;Searce-dev-workspace&quot;<br>    }<br>  }<br>}</pre><p>This configuration directs Terraform to store its state in the specified workspace on Terraform Cloud. Each workspace has its own state file, ensuring that different environments (e.g., dev, staging, prod) are separated and organised.</p><h3><strong>🔒 State Locking in Terraform Cloud</strong></h3><p>When multiple people or automation tools are working on the same infrastructure, <strong>state locking</strong> becomes crucial to prevent concurrent changes from conflicting. Terraform Cloud automatically handles state locking to ensure that only one user can modify the state at a time.</p><p>State locking prevents issues like:</p><ul><li><strong>Race conditions</strong> where two users or processes attempt to modify the same resources simultaneously.</li><li><strong>Inconsistent infrastructure state</strong> due to conflicting changes.</li></ul><p>Terraform Cloud uses locks at the workspace level to ensure that only one Terraform run is applied at a time, providing stability and predictability for your infrastructure.</p><h3><strong>🔄 State Versioning and History</strong></h3><p>Terraform Cloud doesn’t just store the current state of your infrastructure — it also manages <strong>state versioning</strong>. This means that every change to the infrastructure state is versioned and stored, providing you with a history of all infrastructure modifications.</p><p>With versioning, you can:</p><ul><li><strong>Rollback to a previous state</strong> if something goes wrong.</li><li><strong>Review what changes were made</strong>, by whom, and when.</li><li><strong>Recover from mistakes</strong> by easily reverting to a known good state.</li></ul><p>This feature is especially useful for teams, as it allows you to track changes over time and ensure that infrastructure modifications can be audited.</p><h3><strong>🛡️ Handling Sensitive Data in State</strong></h3><p>Terraform state files often include private data, including authentication credentials and secret values and passwords.</p><p>If not handled securely, the Terraform state file can become a potential security vulnerability. In <strong>Terraform Cloud</strong>, sensitive data is handled with a high level of security.</p><p>Encryption is used by TFC to safeguard state files at all times — both while being stored and transmitted. All state data is encrypted using industry-standard encryption mechanisms, ensuring that sensitive information is kept safe from unauthorised access.</p><p>Here’s how TFC addresses sensitive data management:</p><ul><li><strong>Encryption at rest and in transit</strong>: All state files and sensitive data are encrypted, preventing unauthorised users from accessing them.</li><li><strong>Access control</strong>: Terraform Cloud integrates with <strong>IAM (Identity and Access Management)</strong> to control who can access the state files, ensuring only authorised users can view or modify sensitive data.</li><li><strong>Sensitive variables</strong>: Terraform Cloud also allows you to mark specific variables as “sensitive,” which ensures that they are encrypted and not exposed in logs or UI.</li></ul><p>By leveraging these security measures, Terraform Cloud ensures that your state files — and any sensitive data they contain — are protected at all times.</p><h3><strong>🔍 How to View State Files in Terraform Cloud</strong></h3><p>To view and manage your state files in Terraform Cloud, follow these steps:</p><ol><li><strong>Sign in to Terraform Cloud</strong>:</li><li><strong>Navigate to the Workspace</strong>:</li><li><strong>Access the State Files</strong>:</li></ol><p><strong>View the Current State</strong>:</p><ul><li>From the list of state versions, you can click on a specific version to view its content.</li><li>The state content is presented in a human-readable JSON format, and you can see all the resources managed by Terraform, their current values, and any sensitive data (which is encrypted).</li></ul><p><strong>Download the State Files</strong>:</p><ul><li>If you need to download the state file, Terraform Cloud provides an option to download the state as a <strong>JSON file</strong> for offline inspection.</li><li>Click on the <strong>Download</strong> button next to the state version you wish to download.</li></ul><h3><strong>⚙️ Integrating Terraform Cloud with GitHub and GCP</strong></h3><p>Terraform Cloud enhances the automation and security of infrastructure management through integrations with <strong>GitHub</strong> and <strong>Google Cloud Platform (GCP)</strong>.</p><p><strong>🧑‍💻 GitHub Integration with Terraform Cloud</strong></p><p>When using <strong>GitHub</strong> with Terraform Cloud, the process of managing your infrastructure is seamless, allowing you to follow a standard <strong>GitHub Pull Request (PR)</strong> flow for applying changes to your infrastructure. Here’s how it works:</p><ol><li><strong>Create a Pull Request (PR)</strong>:</li></ol><ul><li>When you create a PR in GitHub, your <strong>Terraform plan</strong> runs automatically on Terraform Cloud.</li><li>The plan is displayed in the PR, allowing you to review the changes before they are applied.</li><li>This automated plan execution ensures that you are aware of any changes to your infrastructure before they happen.</li></ul><p><strong>2. Merge and Manual Apply</strong>:</p><ul><li>The PR is merged into the main branch after it passes the review and approval stages.</li><li>After merging, a <strong>manual Terraform apply</strong> is triggered in Terraform Cloud. This gives you full control over when the changes are applied, ensuring that the infrastructure changes are deliberate and controlled.</li><li>This process avoids any unintended changes and provides an additional layer of security by allowing manual approval before applying changes.</li></ul><p>By following this process, you ensure that your infrastructure changes are versioned, auditable, and thoroughly reviewed before being applied, all while benefiting from the security and scalability of <strong>Terraform Cloud</strong>.</p><h3><strong>🌩️ Google Cloud Platform (GCP) Integration</strong></h3><p>With <strong>Google Cloud Platform (GCP)</strong>, you can use Terraform Cloud to manage state files for your GCP resources. This integration enables you to automatically deploy and manage infrastructure on GCP while benefiting from Terraform Cloud’s secure state management and collaboration features.</p><ul><li><strong>Remote State Management</strong>: Store and manage your GCP infrastructure state securely within Terraform Cloud, leveraging its versioning and state locking features to prevent issues when collaborating across teams.</li><li><strong>Automated Provisioning</strong>: Use <strong>Terraform Cloud</strong> to trigger automated provisioning and management of GCP resources such as virtual machines, networking, storage, and Kubernetes clusters.</li></ul><p>Here’s a sample GCP Terraform configuration:</p><pre>provider &quot;google&quot; {<br>  project = &quot;searce-gcp-project&quot;<br>  region  = &quot;asia-south1&quot;<br>}<br><br>resource &quot;google_compute_instance&quot; &quot;default&quot; {<br>  name         = &quot;searce-instance&quot;<br>  machine_type = &quot;e2-medium&quot;<br>  zone         = &quot;asia-south1-a&quot;<br><br>  boot_disk {<br>    initialize_params {<br>      image = &quot;rhel-8.0-custom&quot;<br>    }<br>  }<br><br>  network_interface {<br>    network = &quot;default&quot;<br>    access_config {}<br>  }<br>}</pre><p>By storing the state in <strong>Terraform Cloud</strong>, you ensure that your infrastructure is always synchronized, and sensitive GCP credentials are securely handled with encrypted state files.</p><h3><strong>⏳REAL TIME SCENARIOS</strong></h3><blockquote><strong>1. Workspace State Corruption due to Manual Backend Switching</strong></blockquote><p><strong>Scenario:</strong> A user manually switches the backend from remote to local for testing, runs terraform apply, and then switches back.</p><p><strong>Root Cause :</strong> TFE doesn’t recognize local changes to state. This causes <strong>drift or resource duplication</strong>.</p><p><strong>Solution:</strong></p><ul><li>Avoid backend switching mid-workflow.</li><li>Use separate workspaces or isolated modules for testing.</li></ul><blockquote><strong>2. Stuck Runs or “Plan Queued Indefinitely”</strong></blockquote><p><strong>Scenario:</strong> A plan gets stuck in the queue during concurrent Git pushes or pipeline triggers.</p><p><strong>Root Cause: </strong>Workspace lock not released due to crashed or force-terminated runs.</p><p><strong>Solution:</strong></p><ul><li>Discard stuck runs manually using UI or CLI:</li></ul><pre>tfe run discard &lt;run-id&gt;</pre><ul><li>Avoid force kills; gracefully cancel runs.</li></ul><blockquote><strong>3. State Drift Between Workspaces Due to Incorrect Configuration</strong></blockquote><p><strong>Scenario:</strong> Multiple workspaces use the same module, but a hardcoded backend points to another workspace’s state.</p><p><strong>Root cause:</strong></p><ul><li>Cross-environment interference.</li><li>Infrastructure from one workspace may be altered by another.</li></ul><p><strong>Solution:</strong></p><ul><li>Always pass TF_WORKSPACE dynamically.</li><li>Use remote state data sources cautiously and clearly distinguish shared vs isolated state.</li></ul><blockquote><strong>4. Terraform State Exposure due to Incorrect Permissions</strong></blockquote><p><strong>Scenario:</strong> A user is granted write access to a workspace without appropriate guardrails.</p><p><strong>Risk:</strong></p><ul><li>They can modify or download sensitive state data.</li></ul><p><strong>Solution:</strong></p><ul><li>Apply least-privilege access.</li><li>Use Vault or TFE sensitive variables for secrets instead of plain text.</li></ul><blockquote><strong>5. State File Size Bloat</strong></blockquote><p><strong>Scenario:</strong> Poor module granularity or large infrastructure leads to bloated state files.</p><p><strong>Root cause:</strong></p><ul><li>Slow operations, timeouts, and locking issues.</li></ul><p><strong>Solution:</strong></p><ul><li>Use data sources for read-only references.</li><li>Split infrastructure into logical workspaces.</li><li>Avoid overusing -target flag except for emergencies.</li></ul><h3>🔚<strong> Wrapping Up</strong></h3><p>State management in <strong>Terraform Cloud</strong> offers a secure, scalable, and simple solution for teams of any size. By leveraging <strong>remote backends</strong>, <strong>state locking</strong>, <strong>versioning</strong>, and robust <strong>sensitive data management</strong>, Terraform Cloud allows you to efficiently manage your infrastructure. Integration with <strong>GitHub</strong> ensures that your infrastructure changes are version-controlled, auditable, and reviewed thoroughly before being applied, while the <strong>Google Cloud Platform (GCP)</strong> integration simplifies infrastructure provisioning and management.As your infrastructure grows, consider making the switch to <strong>Terraform Cloud</strong> for a more streamlined, secure, and scalable state management solution. Feel free to reach me on <a href="https://www.linkedin.com/in/apurva-murde-b6b38515b/">LinkedIn</a> if you have any concerns.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e4e4d8c3f8e" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/state-management-in-terraform-cloud-secure-scalable-and-simple-7e4e4d8c3f8e">State Management in Terraform Cloud: Secure, Scalable, and Simple</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Workspaces Demystified: Structuring Terraform Deployments the Smart Way]]></title>
            <link>https://blog.searce.com/terraform-workspaces-demystified-structuring-terraform-deployments-the-smart-way-52b70d3a607d?source=rss-31dced295a1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/52b70d3a607d</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[terraform-enterprise]]></category>
            <dc:creator><![CDATA[Apoorva Murde]]></dc:creator>
            <pubDate>Tue, 22 Apr 2025 16:55:22 GMT</pubDate>
            <atom:updated>2025-04-24T07:12:32.520Z</atom:updated>
            <content:encoded><![CDATA[<p>CHAPTER 3</p><h3>Introduction</h3><p>Welcome back, dear readers! In our previous blog, “<em>Navigating the Depths of Terraform Cloud’s Organization: A Definitive Handbook</em>,” we understood the organizations workflow and its settings. If you’re new to Terraform Cloud or need a refresher, I highly recommend checking out my <a href="https://medium.com/@apoorva.murde/navigating-the-depths-of-terraform-clouds-organization-a-definitive-handbook-a56f021689a2">previous blogs</a> for a comprehensive overview. So now we have understoond whats Terraform Organization, lets explore whats Terraform Workspace and its use when we use Terraform Cloud as our IAC.<br>In Terraform Cloud Enterprise (TFC-E), <strong>Workspaces</strong> are one of the most fundamental concepts that determine how infrastructure deployments are managed. In this blog, we’ll deep-dive into what workspaces are, their strategic use, and how to structure them effectively for scalability, collaboration, and maintainability.</p><h3><strong>🚀 What Are Terraform Cloud Workspaces?</strong></h3><p>At a high level, a workspace in TFC-E is a <strong>container for Terraform state files</strong>, configurations, variables, and run history. It is directly mapped to a specific infrastructure deployment.</p><p>Think of a workspace as a logical unit where Terraform plans and applies are executed with a particular set of inputs and a configuration.</p><p>Each workspace:</p><ul><li>Holds a unique state file</li><li>Can be linked to a version control system (<a href="https://en.wikipedia.org/wiki/Version_control">VCS</a>)</li><li>Maintains environment-specific variables</li><li>Can be managed with Sentinel policies and <a href="https://en.wikipedia.org/wiki/Role-based_access_control">RBAC</a></li></ul><h3><strong>⚙️ Understanding Terraform Runs in a Workspace</strong></h3><p>Each time a configuration change is made or triggered in a workspace, Terraform initiates a <strong>run</strong>, which is the lifecycle of a Terraform deployment. A run goes through several stages:</p><ol><li><strong>Plan Queueing:</strong> The run is added to the plan queue. Only one run executes at a time per workspace.</li><li><strong>Plan Phase:</strong> Terraform evaluates changes required for the infrastructure. This is non-destructive.</li><li><strong>Policy Check (Optional):</strong> If Sentinel policies are configured, they are evaluated at this stage.</li><li><strong>Plan Confirmation:</strong> Depending on workspace settings, manual approval may be required.</li><li><strong>Apply Phase:</strong> Once confirmation, changes are applied to the infrastructure, and the state file is saved.</li><li><strong>Completion:</strong> Results are stored, logs are recorded, and the state is updated.</li></ol><h3>⚙️ <strong>Run Triggers</strong></h3><p>You can define <strong>run triggers</strong> between workspaces. For example, if networking-prod changes, it can trigger a re-run in app-backend-prod to re-evaluate dependencies using terraform_remote_state.</p><p><strong>Manual vs. Automatic Runs</strong></p><ul><li><strong>Manual Runs:</strong> Initiated via UI/API/CLI</li><li><strong>Automatic Runs:</strong> Triggered by VCS changes (e.g., GitHub push to main branch)</li></ul><p>Terraform Cloud ensures that these runs are isolated, serialised (one at a time), and fully auditable.</p><h3><strong>🛠️ Creating a Workspace in Terraform Cloud: Step-by-Step</strong></h3><p>To help visualise how workspaces are created, let’s go through a step-by-step walkthrough using the Terraform Cloud UI:</p><ol><li><strong>Log in to Terraform Cloud</strong> and navigate to your organisation.</li><li>Click on <strong>“New Workspace”</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-Ehgv2LgMu-DVepT" /></figure><ol><li>Choose <strong>Version Control Workflow</strong> and connect to your GitHub (or GitLab/Bitbucket) repository.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qVHFNS9xu3v1U329" /></figure><ol><li>Select the repo that holds your Terraform configuration.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lQ-SKTpwXNfaymyr" /></figure><ol><li>Name your workspace (e.g., app-dev, app-prod) and click <strong>Create Workspace</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6AtUgENEMrHtTXla" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tf1bBF8Nj9XpvtQq" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bj8iVXc4uIsXOXka" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z-z_RPcSDGndF_Vq" /></figure><ol><li>Configure <strong>Variables</strong>, if needed:</li></ol><ul><li>Terraform Variables (e.g., region)</li><li>Environment Variables (e.g. GCP credentials)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NmhIHWdpmC_Usc-J" /></figure><p>If you need to know more about the variables, you can visit the official <a href="https://developer.hashicorp.com/terraform/cloud-docs/workspaces/variables">document</a></p><ol><li>Trigger a run by pushing changes to the connected VCS repo.</li></ol><p>This simple setup integrates your infrastructure code with Terraform Cloud and enables automated runs with every change.</p><h3>⚙️ <strong>Lifecycle of a Workspace</strong></h3><p>Let’s walk through the typical lifecycle of a Terraform workspace:</p><ol><li><strong>Creation</strong>: You start by creating a workspace using terraform workspace new &lt;name&gt;. This sets up an isolated environment with its own state file.</li><li><strong>Selection</strong>: You switch between workspaces using terraform workspace select &lt;name&gt;.</li><li><strong>Execution</strong>: You run terraform plan and terraform apply in the selected workspace. The changes are only applied to the resources tracked by that workspace’s state.</li><li><strong>Management</strong>: Over the time, you may list by using terraform workspace list, delete using terraform workspace delete, or rename the workspaces to make alterations according to the needs.</li></ol><h3>⚙️<strong>Browsing &amp; Managing Workspaces in Terraform Cloud</strong></h3><p>Terraform Enterprise Cloud provides us with a user friendly UI to <strong>browse, filter, and manage your workspaces</strong> effectively:</p><ul><li>Navigate to the <strong>Workspaces</strong> page to view all existing workspaces in your organisation.</li><li>You can <strong>filter</strong> by tags, search by name, or sort by last modified to quickly locate what you need.</li><li>Click into a workspace to view its latest runs, variables, state file, VCS linkage, and settings.</li></ul><p>This interface is especially handy in large organisations with dozens or hundreds of workspaces — quick visibility and control at your fingertips.</p><h3>⚙️ <strong>Workspace Strategies: Naming, Environment Separation, and Scaling</strong></h3><p><strong>1. Environment-Based Workspaces</strong></p><p>Each environment gets its own workspace, and the same module is reused with different variable sets. This ensures clear separation and avoids accidental changes across environments.</p><p><strong>2. Component-Based Workspaces</strong></p><p>Separate infrastructure components into different workspaces. This allows teams to manage changes independently and follow the principle of least privilege, so that we can use it without any confusions.</p><p><strong>3. Team/Project-Based Workspaces</strong></p><p>For organisations where teams own full stacks, this method works well.</p><p>RBAC makes it easy to restrict access based on team-level workspaces.</p><h3><strong>🔧 Workspace Configuration Tips</strong></h3><ul><li><strong>Variables:</strong> Define variables in TFC-E’s workspace UI or via the API. Use environment variables for sensitive data.</li><li><strong>Remote State Sharing:</strong> Use terraform_remote_state data sources to share outputs between workspaces.</li><li><strong>Version Control Integration:</strong> Link workspaces with GitHub/GitLab repos for push-triggered plans.</li><li><strong>Workspace Tags:</strong> Use tagging to organise, filter, and group workspaces by app, team, or environment.</li></ul><h3><strong>🔐 Security &amp; Collaboration Considerations</strong></h3><ul><li>Leverage <strong>Teams &amp; Permissions</strong> to assign roles (read, plan, apply) to specific users.</li><li>Enable <strong>run triggers</strong> for dependent workspaces.</li><li>Use <strong>Sentinel policies</strong> to enforce compliance on each of your environments.</li><li>Keep secrets in <strong>environment variables</strong> or Vault (if integrated).</li></ul><h3><strong>🧩 Workspace Pitfalls to Avoid</strong></h3><p>❌ Using a single workspace for too many resources to avoid negative consequences.</p><p>❌ Using multiple workspaces to manage the same set of resources (can cause state conflicts)</p><p>❌ Not considering naming conventions — leads to confusion in large orgs</p><h3><strong>🧩Best Practices</strong></h3><p><strong>✅ </strong>Adopt a consistent naming convention (e.g., &lt;app&gt;-&lt;env&gt; or &lt;team&gt;- &lt;component&gt;)</p><p><strong>✅ </strong>Isolate environments and components clearly</p><p><strong>✅ </strong>Use VCS and run triggers to automate workflows</p><p><strong>✅ </strong>Enforce security with RBAC, Sentinel, and environment variable practices</p><p><strong>✅ </strong>Regularly review unused or stale workspaces</p><h3><strong>🔚 Wrapping Up</strong></h3><p>Terraform Cloud Enterprise workspaces offer a scalable, secure, and collaborative way to manage infrastructure deployments. By structuring them smartly, you can bring order, clarity, and agility to even the most complex infrastructure ecosystems.</p><p>Next up in this series, we’ll explore <strong>State Management in Terraform Cloud: Secure, Scalable, and Simple</strong>. Stay tuned! Feel free to reach me on <a href="https://www.linkedin.com/in/apurva-murde-b6b38515b/">LinkedIn</a> if you have any concerns.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52b70d3a607d" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/terraform-workspaces-demystified-structuring-terraform-deployments-the-smart-way-52b70d3a607d">Terraform Workspaces Demystified: Structuring Terraform Deployments the Smart Way</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating the Depths of Terraform Cloud’s Organization: A Definitive Handbook]]></title>
            <link>https://medium.com/@apoorva.murde/navigating-the-depths-of-terraform-clouds-organization-a-definitive-handbook-a56f021689a2?source=rss-31dced295a1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a56f021689a2</guid>
            <category><![CDATA[terraform-cloud]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[organization]]></category>
            <category><![CDATA[version-control]]></category>
            <dc:creator><![CDATA[Apoorva Murde]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 09:32:45 GMT</pubDate>
            <atom:updated>2024-02-29T09:32:45.077Z</atom:updated>
            <content:encoded><![CDATA[<p>CHAPTER 2</p><h3>Introduction</h3><p>Welcome back, dear readers! In our previous blog, “<em>Streamlining Infrastructure Operations: A Guide to Terraform Cloud</em>,” we laid the groundwork by exploring the fundamental concepts of Terraform Cloud and its essential features. If you’re new to Terraform Cloud or need a refresher, I highly recommend checking out my <a href="https://medium.com/@apoorva.murde/streamlining-infrastructure-operations-a-guide-to-terraform-cloud-12957ba5f03d">previous blog</a> for a comprehensive overview. Now that we’ve established a solid understanding of Terraform Cloud’s fundamentals, it’s time to delve deeper into the platform’s capabilities. Join me as we navigate through the fundamental configurations to the Terraform Cloud organization settings and optimize your Terraform Cloud experience.</p><h3>Understanding Organization Settings</h3><p>Organization settings in Terraform Cloud provide administrators with granular control over various aspects of their organization’s environment. These settings encompass a wide array of configurations, ranging from access control and permissions management to workspace settings and integration preferences. By leveraging organization settings, teams can streamline their workflows, enforce security policies, and ensure consistency across infrastructure deployments.</p><h3>Brief of Organization Settings</h3><ul><li><strong><em>Creating Organizations</em></strong><em>:</em> The process of creating organizations is streamlined within Terraform Cloud. While administrators on Terraform Enterprise may have restrictions, any user on Terraform Cloud can initiate a new organization effortlessly, fostering a culture of innovation and collaboration from the outset.</li><li><strong><em>Joining and Leaving Organizations</em></strong><em>:</em> Collaboration begins with joining organizations. Users can seamlessly join organizations by accepting invitations from owners. Conversely, leaving organizations is a straightforward process managed through user account settings, ensuring flexibility and control over membership.</li><li><strong><em>Terraform Cloud API and Provider</em></strong><em>:</em> Terraform Cloud offers versatile methods for managing organizations, including the Organizations API and the tfe_organization resource within the Terraform Enterprise Provider. These tools empower administrators to automate and streamline organization management tasks, enhancing efficiency and scalability.</li><li><strong><em>Managed Resources</em></strong> Your organization’s managed resource count helps you understand the number of infrastructure resources that Terraform Cloud manages across all your workspaces. Terraform Cloud reads all the workspaces’ state files to determine the total number of managed resources. Terraform Cloud includes resources in modules and each resource created with the count or<strong> </strong><em>for_each meta-arguments </em>Terraform Cloud does not include data sources in the count.</li></ul><p><strong>Exploring Key Components:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZSnkWBtX3CN3o6Ny9Y6-fA.png" /><figcaption>Organizational Setting in Terraform Cloud</figcaption></figure><ul><li><strong>ORANIZATION SETTINGS</strong></li></ul><p><strong>General settings </strong>include fundamental configurations such as organization name, time zone settings, and default email domain. Administrators can tailor these settings to align with organizational preferences and requirements.</p><p>In <strong>Plan and Billing</strong>, the organization’s plan and past invoices can be reviewed for accuracy and efficiency. Owners have the flexibility to upgrade to a paid Terraform Cloud plan, switch to a free plan, or initiate a trial for premium features, ensuring the best fit for their needs and budget.</p><blockquote>Note: Deleting or renaming an organization can be very disruptive. Its strongly recommend against deleting or renaming organizations with active members.</blockquote><p><strong>Tags</strong> can be used to Review a list of tags for all resources across the organization centrally, deleting a tag from this page, will affect all the organization</p><p><strong>Teams </strong>allow users to collaborate on projects by grouping members with shared access permissions, facilitating efficient project management. <strong>Users</strong> are individual accounts within Terraform Cloud, each with their own login credentials and access rights, enabling granular control over who can view, modify, or manage infrastructure resources.</p><p><strong>Authorization Model</strong> <br>The authorization model in Terraform Cloud follows a role-based access control (RBAC) system. It allows administrators to assign roles and permissions to users, teams, and organizations based on their responsibilities and requirements. This model ensures that only authorized individuals or groups can perform specific actions within the platform, such as managing workspaces, executing Terraform runs, accessing sensitive data, or configuring policies. By defining roles and permissions, Terraform Cloud maintains security, compliance, and effective governance over infrastructure management activities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fyHMFWgVMMHZNDXgBeQ7FA.png" /><figcaption><strong>Authorization model for Terraform Cloud</strong></figcaption></figure><p>Users with appropriate permissions can view all available <strong>variable sets</strong> and their variables in Terraform Cloud. They can also create variable sets and assign them to multiple workspaces, facilitating efficient management of shared variables across projects. Utilizing variable sets helps streamline workflows by enabling consistent application of variables across workspaces, reducing manual effort and minimizing errors. For further details on variable types, scope, precedence, and management, users can refer to the variables overview and managing <a href="https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/organizations#variable-sets">variables documentation</a>.</p><ul><li><strong>INTEGRATIONS</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q3P7-V5z-TOGNqzVsdYFkA.png" /></figure><p><strong>Cost estimation</strong> helps users predict expenses associated with infrastructure changes before deployment. By analyzing resource configurations and cloud provider pricing data, users can make informed decisions, optimize resource allocation, and prevent unexpected costs.</p><p><strong>Policy</strong> refers to the set of rules and standards enforced to maintain compliance and security within infrastructure deployments whereas <strong>Policy Sets</strong> allow users to group related policies together and apply them across multiple workspaces, ensuring consistent governance and adherence to organizational guidelines. I would be explaining this feature in more detail in my next blog.</p><p><strong>Run tasks</strong> transmit run data to an external service during designated run stages. This service evaluates the data, determining if the run meets specified criteria, and relays the outcome back to Terraform Cloud. Based on this response and the configured enforcement level, Terraform Cloud decides whether the run can proceed, ensuring adherence to defined policies and procedures.</p><p><strong>SECURITY</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6e_rmf89r6vE2V__dH8Clg.png" /><figcaption>Terraform Agents</figcaption></figure><p><strong>Terraform Cloud Agents</strong> facilitate communication between Terraform Cloud and isolated or on-premises infrastructure. By deploying lightweight agents within your network, you establish a secure connection, enabling provisioning and management operations. This is particularly beneficial for managing on-premises environments like vSphere, Nutanix, and enterprise networking setups in protected network segments.</p><p>Terraform Cloud offers three types of <strong>API tokens:</strong> user, team, and organization tokens, each providing different levels of access. User tokens grant access to resources based on individual user permissions, team tokens provide access based on team permissions, and organization tokens offer access to resources across the entire organization, allowing for fine-grained control over API interactions and security.</p><p><strong>Authentication</strong> in Terraform Cloud involves securely verifying user identities to grant access to the platform’s features and resources. It supports various authentication methods such as username/password, SAML, OAuth, and API tokens. Users authenticate themselves to Terraform Cloud through these methods to perform actions like managing infrastructure, accessing workspaces, and interacting with the API securely and efficiently.</p><p><strong>SSH keys </strong>are used for authentication and secure access to version control systems, such as Git repositories, during Terraform runs.<strong> Single Sign-On</strong> (SSO) integration allows users to authenticate to Terraform Cloud using their existing identity provider credentials, enhancing security and streamlining user access management processes by centralizing authentication across multiple services within an organization.</p><p><strong>VERSION CONTROL</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hMGUG8Y4FPcQap0z1TpGA.png" /></figure><p><strong>Version control</strong> integrates with popular version control systems like Git, Bitbucket, Azure Devops allowing users to store, manage, and version infrastructure configurations alongside their code. This enables teams to track changes, collaborate effectively, and maintain a history of infrastructure modifications. Through version control, Terraform Cloud ensures consistency, reliability, and traceability in infrastructure provisioning and management workflows.</p><h3>BEST PRACTICES</h3><ol><li><strong>Centralized Management</strong>: Consolidate organization settings to ensure consistency and centralized management across the entire Terraform Cloud environment.</li><li><strong>Role-Based Access Control (RBAC):</strong> Implement RBAC policies to grant appropriate permissions based on user roles and responsibilities, following the principle of least privilege.</li><li><strong>Policy as Code</strong>: Leverage Sentinel policies to enforce compliance, security, and governance requirements programmatically, minimizing manual interventions and ensuring consistency.</li><li><strong>Automated Workflows</strong>: Integrate Terraform Cloud with version control systems and CI/CD pipelines to automate infrastructure deployments, testing, and validation processes.</li><li><strong>Regular Auditing and Review</strong>: Conduct periodic audits of organization settings, access controls, and policies to identify potential security risks, compliance gaps, or inefficiencies.</li></ol><h3>CONCLUSION</h3><p>Organization settings form the backbone of Terraform Cloud’s governance and configuration management capabilities, enabling organizations to orchestrate infrastructure deployments effectively while maintaining security, compliance, and operational efficiency. By understanding the significance of organization settings and adhering to best practices for configuration and management, teams can harness the full potential of Terraform Cloud to accelerate their journey towards infrastructure automation and DevOps excellence.</p><p>Hopefully, this post has provided some valuable tips and information about Terraform Cloud Organization Settings. Stay tuned to get more blogs as I would be publishing few more chapters soon!! Feel free to reach me on <a href="https://www.linkedin.com/in/apurva-murde-b6b38515b/">LinkedIn</a> if you have any concerns. Don’t hesitate to share your thoughts and suggestions in the comments below, and feel free to let me know if there’s a specific aspect you’d like to see explored in more detail in a separate blog post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a56f021689a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streamlining Infrastructure Operations: A Guide to Terraform Cloud]]></title>
            <link>https://blog.searce.com/streamlining-infrastructure-operations-a-guide-to-terraform-cloud-12957ba5f03d?source=rss-31dced295a1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/12957ba5f03d</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[terraform-cloud]]></category>
            <dc:creator><![CDATA[Apoorva Murde]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 16:15:04 GMT</pubDate>
            <atom:updated>2024-02-26T16:15:04.515Z</atom:updated>
            <content:encoded><![CDATA[<p>CHAPTER 1</p><h3>Introduction</h3><p>In today’s cloud computing world, managing infrastructure can be overwhelming and when you do it manually, sometimes it can become an headache. But to save us, we have <strong>Terraform Cloud: a superhero tool that simplifies setup and management.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TEtqZQfIhJNiFAwpO39zOA.jpeg" /><figcaption><strong>Terraform Cloud</strong></figcaption></figure><p>By using Terraform Cloud, you’re essentially taking a big step towards making your infrastructure management smoother and less prone to mistakes. Instead of manually doing everything, you’re letting Terraform <strong>automate the process </strong>for you. And that means fewer headaches and more time for the things that really matter. Ready to dive in and see how Terraform Cloud can simplify your life? Let’s go!</p><h3><strong>What is Terraform Cloud ?</strong></h3><p>Terraform Cloud is a hosted service provided by Hashi Corp, the creators of the popular infrastructure-as-code tool, Terraform. It serves as a <strong>collaboration platform</strong> for teams to manage their infrastructure configurations, version control, and execution in a centralized and secure manner.</p><p>So, what exactly is Terraform Cloud? Think of it as your trusty sidekick that helps you write down all the instructions for setting up your infrastructure in simple, easy-to-understand files. These files tell Terraform what you want your infrastructure to look like, and it goes ahead and makes it happen for you.</p><p>The best part? Terraform Cloud works the same no matter which cloud provider you’re using. Whether it’s Amazon Web Services, Google Cloud, or Microsoft Azure, Terraform has got your back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDl66_5OYmkQhv_8p6dSzA.png" /><figcaption><strong>Sign-in page of Terraform Cloud</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7I4wyFTUYssqNod_18qMxw.png" /><figcaption><strong>Home Page of Terraform Cloud after Signing in</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rduITXuRuhVkmPoySPLmsQ.png" /><figcaption><strong>Projects and Workspaces in Terraform Cloud</strong></figcaption></figure><h3><strong>Behind the Scenes: Understanding the Mechanics of Terraform Cloud</strong></h3><p>Terraform Cloud takes the complexity out of managing infrastructure by providing a reliable online platform for running Terraform commands. Instead of juggling setups on your local computer, everything happens <strong>securely in one place</strong>. It stores important data safely, like your project’s <strong>state files and any secret information</strong>, sensitive data while seamlessly integrating with <strong>VCS</strong>, fostering a development workflow.</p><p>The user interface is super easy to navigate, giving you a clear picture of what’s going on with your resources. You can even share your own Terraform tools with your team using the private registry. And if you need extra features, like<strong> controlling who can make changes or estimating costs, there are paid options available</strong>. With Terraform Cloud, collaborating on infrastructure projects becomes a breeze. You can review and approve changes with your team before making them live, and it automatically prevents any messy data mix-ups</p><h3>Key Features of Terraform Cloud</h3><ol><li><strong>Infrastructure as Code (IaC)</strong>: Terraform Cloud follows the IaC paradigm, allowing users to define their infrastructure configurations using declarative code. This code, typically written in Hashi Corp Configuration Language (HCL), describes the desired state of the infrastructure.</li><li><strong>Version Control</strong>: With Terraform Cloud, infrastructure configurations are stored in version control systems such as Git. This enables teams to track changes, collaborate effectively, and revert to previous states if necessary.</li><li><strong>Collaboration</strong>: Terraform Cloud facilitates collaboration among team members by providing a centralized platform for sharing infrastructure configurations, managing access permissions, and reviewing changes through pull requests.</li><li><strong>Remote Execution</strong>: One of the standout features of Terraform Cloud is its ability to execute Terraform configurations remotely. This means that infrastructure changes can be applied from any location, providing flexibility and scalability for distributed teams.</li><li><strong>Secure State Management</strong>: Terraform Cloud securely stores sensitive information such as API tokens and access keys, ensuring that infrastructure state files are protected. This eliminates the risk of exposing credentials in version control or other insecure locations.</li><li><strong>Cost-Efficiency: </strong>Through automation and infrastructure-as-code, Terraform Cloud enhances cost-efficiency by optimizing resource allocation and preventing unnecessary expenses, ultimately saving organizations money.</li><li><strong>Drift Detection</strong>: Continuously monitors infrastructure configurations, instantly identifying any deviations from the desired state. By alerting users to unexpected changes, it ensures that infrastructure remains consistent and compliant, minimizing risk and enhancing stability.</li><li><strong>Private Registry:</strong> Terraform Cloud’s private registry provides a secure repository for storing and sharing organization-specific Terraform modules and providers. This feature enables teams to collaborate effectively while maintaining control over their infrastructure code. With access controls and versioning, organizations can ensure the integrity and reliability of their Terraform configurations, streamlining development workflows and promoting consistency across projects.</li><li><strong>Event Notification</strong>: Sends alerts through Slack and email whenever issues with infrastructure are detected, allowing teams to promptly address them. With the ability to roll forward or roll back changes as needed, it ensures rapid response to maintain system integrity and minimize downtime, enhancing operational efficiency and reliability.</li><li><strong>Policy Control</strong>: To enhance security and compliance in Terraform runs, organizations can implement guardrails using tools like Sentinel or third-party solutions. Sentinel, an embedded policy-as-code framework in Terraform Cloud, enables organizations to define and enforce policies across infrastructure configurations. By writing Sentinel policies, teams can establish rules to govern resource provisioning, access controls, data encryption, and more, ensuring adherence to security and compliance standards.</li></ol><h3>Pricing</h3><p>In Terraform Cloud, there are four subscription models available: <strong>Free, Standard, Plus, and Enterprise</strong>. Each model offers different features and capabilities tailored to the needs of various teams and organizations, allowing users to choose the plan that best suits their requirements and budget.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hOERPlSBqFX-d8cYfzdCUg.png" /><figcaption>Pricing model for Terraform as on March 2024</figcaption></figure><h3>Conclusion</h3><p>In conclusion, Terraform Cloud emerges as a superhero in the realm of infrastructure management, alleviating the burdens of manual setup and maintenance in today’s cloud computing landscape. By automating tasks and providing a centralized platform for collaboration, it transforms infrastructure management into a streamlined and less error-prone process. Its key features, including<strong> Infrastructure as Code, Version Control, Collaboration, Remote Execution, and Secure State Management, ensure efficiency, reliability, and security in managing infrastructure configurations.</strong></p><p>Additionally, features like Cost-Efficiency, Drift Detection, Private Registry, and Event Notification further enhance its capabilities, empowering teams to maintain consistency, respond promptly to issues, and optimize resource allocation. With flexible pricing options catering to diverse needs, Terraform Cloud stands as a versatile solution for teams and organizations seeking to simplify and enhance their infrastructure management workflows.</p><p>Hopefully, this post has provided some valuable tips and information about Terraform Cloud. Stay tuned to get more blogs as I would be publishing few more chapters soon!! Feel free to reach me on <a href="https://www.linkedin.com/in/apurva-murde-b6b38515b/"><strong>LinkedIn</strong></a> if you have any concerns. Do comment your views.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12957ba5f03d" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/streamlining-infrastructure-operations-a-guide-to-terraform-cloud-12957ba5f03d">Streamlining Infrastructure Operations: A Guide to Terraform Cloud</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud Armor: Securing Google infrastructure against Web Attacks]]></title>
            <link>https://blog.searce.com/cloud-armor-securing-google-infrastructure-against-web-attacks-8fb335174978?source=rss-31dced295a1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fb335174978</guid>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[google-cloud-armor]]></category>
            <category><![CDATA[ddos-attack]]></category>
            <dc:creator><![CDATA[Apoorva Murde]]></dc:creator>
            <pubDate>Fri, 10 Jun 2022 07:34:33 GMT</pubDate>
            <atom:updated>2022-06-10T08:11:03.601Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will learn how to secure the infrastructure against <strong>DDOS Attacks and also secure web applications</strong> by enabling <strong>OWASP Rules, Rate Limiting, Geo Based Filtering using Cloud Armor Policies</strong>.</p><p>Cloud Security plays a vital role in any business regardless of the size of the enterprise. <strong>Cloud data security</strong> becomes progressively predominant as we migrate our entire infrastructure, devices, data centers, and business processes to the cloud. The spirited and developing nature of securing the infrastructure, especially in scaling applications and services, can bring a number of challenges to enterprises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*SoOyEVjrb7wbk86-dySUTQ.png" /><figcaption>Image Credit: <a href="https://medium.com/u/31dced295a1d">Apoorva Murde</a></figcaption></figure><p>Ensuring a secure cloud environment is achieved through extensive security policies, an organizational culture of security, and cloud security solutions such as <a href="https://cloud.google.com/armor"><strong>Cloud Armor</strong></a>. Google Cloud Platform makes managing web security as simple as possible with the <strong>Cloud Armor</strong> service which is generally available from <strong>September 30, 2021.</strong></p><h3>Cloud Armor with Load Balancer:</h3><p>Google Cloud Armor acts as the <a href="https://en.wikipedia.org/wiki/Web_application_firewall"><strong>web-application firewall (WAF)</strong></a><strong> and DDoS mitigation service</strong> that helps users defend their <strong>web applications and services</strong> which are configured on the <strong>edge of Google’s network.</strong></p><p>Google Cloud Armor security policies are sets of rules that govern and match attributes from <strong>Layer 3 to Layer 7</strong> to protect globally and/or externally facing applications or services behind the load balancer.</p><p>We can utilize Google Cloud Armor <a href="https://cloud.google.com/armor/docs/security-policy-overview#:~:text=Google%20Cloud%20Armor%20security%20policies%20protect%20your%20application%20by%20providing,backend%20services%20or%20backend%20buckets.">security policies</a> to protect applications running behind a load balancer from various attacks, whether the applications are deployed on Google Cloud, in a hybrid deployment, or in a multi-cloud architecture.</p><p>When an incoming request matches a condition in a security policy rule, Google Cloud Armor allows, denies, or redirects the request, based on whether the rule is an allow rule, a deny rule or a redirect rule.</p><p>Each rule is evaluated with respect to incoming traffic.</p><p>You can refer to the following image created by <a href="https://medium.com/u/9b9e67983b04">Priyanka Vergadia</a> to understand Cloud Armor in an illustrated format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pnoDGLvkioyAlNka" /><figcaption>Image Credit: <a href="https://medium.com/u/9b9e67983b04">Priyanka Vergadia</a></figcaption></figure><p>Now that we are somewhat familiar with Cloud Armor, let’s understand what do you mean by OWASP?</p><h3>What is OWASP?</h3><p>The OWASP Top 10 is an official and a standard awareness document for web application security. It represents a broad agreement about the most critical security risks to web applications and its security.</p><p>Google Cloud Armor provides you with some of the pre-configured rules to mitigate OWASP Vulnerabilities.</p><p>You can use preconfigured rules to mitigate the following attacks:</p><ul><li><strong>Broken Authentication</strong></li><li><strong>Cross-site scripting (XSS)</strong></li><li><strong>SQL injection (SQLi) attacks</strong></li><li><strong>Local file inclusion (LFI) attacks</strong></li><li><strong>Remote file inclusion (RFI) attacks</strong></li><li><strong>Remote code execution (RCE) attacks</strong></li></ul><p>Now let’s see the steps to implement this in Cloud Armor through GCP Console.</p><ul><li>Navigate to Cloud Armor.</li><li>Click on Create Policy</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uXH1giW3GjGvZ9gXwvKsqA.png" /><figcaption>Create Policy in GCP Console</figcaption></figure><ul><li>Provide Name, Description as per your convenience</li><li>Select Policy Type as Backend Security Policy.</li><li>Provide the default rule action</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D62lgJFUYOaLPNbqtXLMbg.png" /><figcaption>Configure Policy in Security Policy</figcaption></figure><ul><li>Select the Advanced Mode in Add More Rules</li><li>Provide the <em>evaluatePreconfiguredExpr</em></li><li>Set Action as Deny</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jMERRuqbvZ7u8-4_gY-u4w.png" /><figcaption>Add Advanced Rule in Security Policy</figcaption></figure><blockquote>Note: You can add as many rules as you want in this section.</blockquote><blockquote>If you just want the Rule to be set in Detection Mode only, please select Preview Only Option in the Rules Conditions section.</blockquote><ul><li>Apply policy to the targets, where your target is your load balancer backend service.</li><li>Click on Create Policy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uKZYKHq7tWXPVpM54pQFA.png" /><figcaption>Add Policy to Backend Target</figcaption></figure><p>Please find the syntax of each mitigation available in the Cloud Armor Rules as per today’s date.</p><p><strong>Broken Authentication</strong></p><pre>evaluatePreconfiguredExpr(&#39;sessionfixation-canary&#39;,[&#39;owasp-crs-v030001-id943100-sessionfixation&#39;, &#39;owasp-crs-v030001-id943110-sessionfixation&#39;, &#39;owasp-crs-v030001-id943120-sessionfixation&#39;])</pre><p><strong>SQL Injection</strong></p><pre>evaluatePreconfiguredExpr(&#39;sqli-stable&#39;, [&#39;owasp-crs-v030001-id942110-sqli&#39;, &#39;owasp-crs-v030001-id942120-sqli&#39;, &#39;owasp-crs-v030001-id942150-sqli&#39;, &#39;owasp-crs-v030001-id942140-sqli&#39;, &#39;owasp-crs-v030001-id942160-sqli&#39;, &#39;owasp-crs-v030001-id942170-sqli&#39;, &#39;owasp-crs-v030001-id942180-sqli&#39;, &#39;owasp-crs-v030001-id942200-sqli&#39;, &#39;owasp-crs-v030001-id942250-sqli&#39;, &#39;owasp-crs-v030001-id942270-sqli&#39;, &#39;owasp-crs-v030001-id942280-sqli&#39;, &#39;owasp-crs-v030001-id942210-sqli&#39;, &#39;owasp-crs-v030001-id942260-sqli&#39;, &#39;owasp-crs-v030001-id942300-sqli&#39;, &#39;owasp-crs-v030001-id942310-sqli&#39;, &#39;owasp-crs-v030001-id942330-sqli&#39;, &#39;owasp-crs-v030001-id942340-sqli&#39;, &#39;owasp-crs-v030001-id942380-sqli&#39;, &#39;owasp-crs-v030001-id942190-sqli&#39;, &#39;owasp-crs-v030001-id942220-sqli&#39;, &#39;owasp-crs-v030001-id942230-sqli&#39;, &#39;owasp-crs-v030001-id942240-sqli&#39;, &#39;owasp-crs-v030001-id942390-sqli&#39;, &#39;owasp-crs-v030001-id942400-sqli&#39;, &#39;owasp-crs-v030001-id942410-sqli&#39;, &#39;owasp-crs-v030001-id942430-sqli&#39;, &#39;owasp-crs-v030001-id942440-sqli&#39;, &#39;owasp-crs-v030001-id942450-sqli&#39;, &#39;owasp-crs-v030001-id942251-sqli&#39;, &#39;owasp-crs-v030001-id942420-sqli&#39;, &#39;owasp-crs-v030001-id942431-sqli&#39;, &#39;owasp-crs-v030001-id942460-sqli&#39;, &#39;owasp-crs-v030001-id942421-sqli&#39;, &#39;owasp-crs-v030001-id942290-sqli&#39;, &#39;owasp-crs-v030001-id942320-sqli&#39;, &#39;owasp-crs-v030001-id942350-sqli&#39;, &#39;owasp-crs-v030001-id942360-sqli&#39;, &#39;owasp-crs-v030001-id942432-sqli&#39;] )</pre><p><strong>XEE — Local file inclusion (LFI) attacks</strong></p><pre>evaluatePreconfiguredExpr(&#39;lfi-canary&#39;, [&#39;owasp-crs-v030001-id930100-lfi&#39;, &#39;owasp-crs-v030001-id930110-lfi&#39;, &#39;owasp-crs-v030001-id930120-lfi&#39;, &#39;owasp-crs-v030001-id930130-lfi&#39;])</pre><p><strong>Broken access control — Remote file inclusion (RFI) attacks</strong></p><pre>evaluatePreconfiguredExpr(&#39;rfi-canary&#39;, [&#39;owasp-crs-v030001-id931130-rfi&#39;, &#39;owasp-crs-v030001-id931110-rfi&#39;, &#39;owasp-crs-v030001-id931120-rfi&#39;, &#39;owasp-crs-v030001-id931130-rfi&#39;])</pre><p><strong>Cross-site scripting (XSS)</strong></p><pre>evaluatePreconfiguredExpr(&#39;xss-stable&#39;, [&#39;owasp-crs-v030001-id941150-xss&#39;, &#39;owasp-crs-v030001-id941110-xss&#39;, &#39;owasp-crs-v030001-id941120-xss&#39;, &#39;owasp-crs-v030001-id941130-xss&#39;, &#39;owasp-crs-v030001-id941140-xss&#39;, &#39;owasp-crs-v030001-id941160-xss&#39;, &#39;owasp-crs-v030001-id941320-xss&#39;, &#39;owasp-crs-v030001-id941170-xss&#39;, &#39;owasp-crs-v030001-id941210-xss&#39;, &#39;owasp-crs-v030001-id941220-xss&#39;, &#39;owasp-crs-v030001-id941200-xss&#39;, &#39;owasp-crs-v030001-id941330-xss&#39;, &#39;owasp-crs-v030001-id941230-xss&#39;, &#39;owasp-crs-v030001-id941240-xss&#39;, &#39;owasp-crs-v030001-id941250-xss&#39;, &#39;owasp-crs-v030001-id941260-xss&#39;, &#39;owasp-crs-v030001-id941270-xss&#39;, &#39;owasp-crs-v030001-id941280-xss&#39;, &#39;owasp-crs-v030001-id941290-xss&#39;, &#39;owasp-crs-v030001-id941300-xss&#39;, &#39;owasp-crs-v030001-id941310-xss&#39;, &#39;owasp-crs-v030001-id941350-xss&#39;, &#39;owasp-crs-v030001-id941180-xss&#39;, &#39;owasp-crs-v030001-id941190-xss&#39;, &#39;owasp-crs-v030001-id941340-xss&#39;])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BA0jst0HGQHp-ecNVyAoKw.png" /><figcaption>Example of Cloud Armor Policy — Broken Authentication</figcaption></figure><p>Having known what OWASP is and how to implement it on Cloud Armor, let’s know what DDOS is and how we can enable it in Cloud Armor.</p><h3>What is DDOS?</h3><p>One of the major concerns in today’s cloud security is the Distributed Denial of Service (DDOS) Attack. DDOS is a cyber-attack in which a malicious attempt is performed to disrupt the normal traffic of a targeted server, service, or network by overwhelming the target or its surrounding infrastructure with a flood of Internet traffic thus making the service unavailable.</p><p>DDoS protection is supported for HTTP(S) Load Balancing, SSL Proxy Load Balancing, and TCP Proxy Load Balancing, regardless of tier. The HTTP, HTTPS, HTTP/2, and QUIC protocols can be reinforced.</p><p><strong>ENABLING DDOS PROTECTION USING ADAPTIVE PROTECTION:</strong></p><p>To enable the DDOS Protection in the Cloud Armor you can use Adaptive Protection in the Cloud Armor Security Policy.</p><p>Google Cloud Armor Adaptive Protection helps you protect your infrastructure in Google Cloud against L7 distributed denial-of-service (DDoS) attacks such as HTTP floods and another high-frequency layer 7 (application-level) malicious activity. This is achieved by building machine-learning models that do the following:</p><ol><li><strong><em>Detect and alert anomalous or malicious activity</em></strong></li><li><strong><em>Generate a signature describing the potential attack</em></strong></li><li><strong><em>Create a custom Google Cloud Armor WAF rule to block the signature</em></strong></li></ol><p>Alerts then can be found in the Security Command Center under the Adaptive Protection.</p><blockquote>If you want to know more about DDoS Protection and Mitigation Best Practices, please refer to the <a href="https://cloud.google.com/files/GCPDDoSprotection-04122016.pdf">link</a></blockquote><h3>GEO BASED ACCESS CONTROL</h3><p>Cloud Armor also offers you Geo based Access Control that means geolocation-based access controls for incoming traffic. This helps IT and security administrators to allow and block incoming traffic from certain geographic locations, e.g., countries in which their companies do not have their stakeholders or employees, or from which they spectate a high number of attacks.</p><p>This can be achieved using origin.ip and/or origin.region_code in the Advanced mode Option in the Rules Conditions section of Cloud Armor.</p><pre>origin.region_code == “CN” &amp;&amp; !inIpRange(origin.ip, ‘1.2.3.0/24’)</pre><p><em>The above expression matches requests from the region CN that are not in the specified IP range</em></p><blockquote>Note: The Unicode country code that is associated with the origin IP, such as IN. If you are creating a rule or expression that uses <a href="https://www.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166–1 alpha 2</a> country or region codes, Google Cloud Armor treats each code independently. Google Cloud Armor rules and expressions explicitly use those region codes to allow or deny requests.</blockquote><h3>RATE LIMITING:</h3><p>Rate Limiting or Rate-based rules protects your infrastructure from a immense volume of requests that flood your instances and block access for legitimate users.</p><p><strong>Rate limiting can do the following:</strong></p><ul><li>Prevent any particular client from exhausting application resources.</li><li>Protect your application instances from erratic and unpredictable spikes in the rate of client requests<strong>.</strong></li></ul><p><strong>Google Cloud Armor has two types of rate-based rules:</strong></p><ol><li><strong>Throttle: </strong>This helps to enforce a maximum request limit per client or across all clients by throttling individual clients to a user-configured threshold.</li><li><strong>Rate-based ban:</strong> This helps you to apply rate limit requests that match a rule on a per-client basis and then temporarily ban / deny the access of those clients for a configured period of time if they exceed a user-configured threshold.</li></ol><p><strong><em>Example</em></strong>: <em>The following example creates Cloud Armor Rule of Throttling using rate limiting where the request header contains ‘test.armor.org’ host and path matches /test</em></p><pre>gcloud compute security-policies rules create 103 \</pre><pre>— security-policy=policy-name \</pre><pre>— expression=”request.headers[‘host’].contains(‘test.armor.org’) &amp;&amp; request.path.matches(‘/test’)”</pre><pre>— action=throttle \</pre><pre>— rate-limit-threshold-count=15 \</pre><pre>— rate-limit-threshold-interval-sec=60 \</pre><pre>— conform-action=allow \</pre><pre>— exceed-action=deny-429 \</pre><pre>— enforce-on-key=HTTP-HEADER \</pre><pre>— enforce-on-key-name=’User-Agent’</pre><p><strong><em>Example 2</em></strong><em>: The following example creates Cloud Armor Rule of Ban the IP for 180 seconds using rate limiting on the /app-server path with a rate limit of 10 requests per 1 minute.</em></p><pre>gcloud compute security-policies rules create 100 \</pre><pre>— security-policy=policy-name \</pre><pre>— expression=”request.path.matches(‘/app-server’)” \</pre><pre>— action=rate-based-ban \</pre><pre>— rate-limit-threshold-count=10 \</pre><pre>— rate-limit-threshold-interval-sec=60 \</pre><pre>— ban-duration-sec=180 \</pre><pre>— conform-action=allow \</pre><pre>— exceed-action=deny-404 \</pre><pre>— enforce-on-key=IP</pre><h3>Google Cloud Armor Limitations:</h3><ul><li>Cloud Armor cannot be applied on non-HTTP Load balancers. If you have Cloud CDN enabled on your HTTP load balancers, then you cannot enable Cloud Armor on that particular Load Balancer.</li><li>You cannot enable Cloud Armor on HTTP Load Balancer which has backend as buckets instead of backend services.</li></ul><p><strong>References: </strong><a href="https://cloud.google.com/armor"><strong>https://cloud.google.com/armor</strong></a></p><p>Hopefully, this post has provided some valuable tips and information about Cloud Armor. Stay tuned to get more blogs and feel free to reach me on <a href="https://www.linkedin.com/in/apurva-murde-b6b38515b/">LinkedIn</a> if you have any concerns. Do comment on your views on this post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fb335174978" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/cloud-armor-securing-google-infrastructure-against-web-attacks-8fb335174978">Cloud Armor: Securing Google infrastructure against Web Attacks</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started: Atlantis with Terraform and GitHub]]></title>
            <link>https://blog.searce.com/getting-started-atlantis-with-terraform-and-github-4e99ab190655?source=rss-31dced295a1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e99ab190655</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Apoorva Murde]]></dc:creator>
            <pubDate>Tue, 11 Jan 2022 06:31:21 GMT</pubDate>
            <atom:updated>2022-01-11T12:26:56.957Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will learn the integration of Atlantis with GitHub and Terraform.</p><figure><img alt="Atlantis Integration with Terraform and Github" src="https://cdn-images-1.medium.com/max/796/1*ztJBDzBDDWWkO10eM9hYgA.png" /><figcaption>Credit: Apoorva Murde</figcaption></figure><p>Terraform and GitHub has played an important role in our <strong>DevOps </strong>job and its simplex structure has made complex commands run in a simpler way making Terraform more flexible and a popular tool.</p><blockquote>Have you ever faced challenges like managing your multiple projects/repos in Terraform, facing difficulty while enforcing peer review, versioning control and too many sets of privileged credentials, even if we have <a href="https://clickup.com/">click-up</a>, <a href="https://mail.google.com/mail/u/0/#inbox">Gmail</a>, <a href="https://slack.com/">slack</a> environment integrated with each other OR when you have already deployed the code and after the review is done, we face challenges in altering them? <em>😟</em>Then you should definitely try this solution called <a href="https://www.runatlantis.io/">Atlantis</a><em>❗️</em></blockquote><p>Atlantis helps you to run commands using GitOps where you can merge Atlantis, create a Pull Request, get approvals and also run the terraform commands so that your entire team is aware of what changes are being made to the infrastructure.</p><p>To deploy Atlantis, you need to know the basics of <a href="https://www.terraform.io/">Terraform</a>, <a href="https://kubernetes.io/">Kubernetes</a>, <a href="https://helm.sh/">Helm</a>, <a href="https://github.com/">GitHub</a>, and <a href="https://webhookrelay.com/">Webhook Relay</a>.</p><p>By the end of this blog, you will be able to know what is Atlantis, how to deploy it in <a href="https://cloud.google.com/kubernetes-engine">Google Kubernetes Engine (GKE)</a> using Helm, how to use Atlantis and why Atlantis is preferred more️?</p><h3>So, let&#39;s start with what is Atlantis?</h3><p>Atlantis is an open-source technology that allows the engineer/approver to review the changes in the infrastructure as well as evaluate that the proposed change is the actual change that will be executed on your infrastructure before applying it. Atlantis used with <a href="https://www.terraform.io/"><em>Terraform</em></a> can be used as a <a href="https://en.wikipedia.org/wiki/CI/CD#:~:text=In%20software%20engineering%2C%20CI%2FCD,testing%20and%20deployment%20of%20applications.">CICD</a> for Infrastructure as Code (IAC).</p><p>Atlantis is compatible with <a href="https://github.com/"><strong>GitHub</strong></a><strong>, </strong><a href="https://about.gitlab.com/"><strong>GitLab</strong></a><strong>, </strong><a href="https://bitbucket.org/product"><strong>Bitbucket Cloud, </strong></a><strong>and </strong><a href="https://azure.microsoft.com/en-in/services/devops/"><strong>Azure DevOps.</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*guSr-MCtSaCSGpdNhYegUw.png" /><figcaption>Atlantis Overview</figcaption></figure><h3>How does Atlantis work with Terraform?</h3><p>Atlantis is an automation application that responds to <a href="https://www.terraform.io/">Terraform</a> pull requests via web callback or webhooks and automates the terraform init, plan, and apply the workflow.</p><p>The following sequence diagram illustrates the sequence of actions described above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/0*3KS05b0LueiFAagJ" /><figcaption>Sequence diagram for Atlantis</figcaption></figure><p>When you need to review the code before making any final changes, you can just do an “<strong><em>Atlantis plan</em></strong>” and check for the infrastructure changes.</p><p>It runs a terraform plan and comments with the output back on the pull request. And after your evaluation has been done, you can just comment “<strong><em>Atlantis apply</em></strong>” on the pull request, and Atlantis will run terraform apply and comment back with the output.</p><p>The Atlantis installation process then adds hooks to the repository which allows communication to the Atlantis server during the Pull Request (PR) process.</p><p>You don’t need heavy packages and large VM’s to deploy Atlantis, it can be done in a <strong>container or a small virtual machine </strong>— the only requirement is that the Terraform instance should communicate with both your version control (e.g., GitHub) and infrastructure (e.g., <a href="https://aws.amazon.com/">AWS</a>/<a href="https://cloud.google.com/">GCP</a>/<a href="https://azure.microsoft.com/en-in/">Azure</a>) you’re changing.</p><p>Once Atlantis is configured for a particular repository, it then executes as follows:</p><ol><li><em>A developer generates a feature branch in git, builds some changes, and </em><strong><em>creates a Pull Request (GitHub) or Merge Request (GitLab)</em></strong><em>.</em></li><li><em>The developer writes “</em><strong><em>Atlantis plan</em></strong><em>” in a Pull Request (PR) comment.</em></li><li><em>Atlantis locally </em><strong><em>runs terraform plans</em></strong><em> via the installed </em><a href="https://en.wikipedia.org/wiki/Webhook"><em>webhooks</em></a><em>. If there are no other Pull Requests in progress, Atlantis adds the resulting plan as a comment to the Merge Request and if there are any other Pull Requests in progress, the resulting command fails as we can’t assure that the plan will be valid once applied.</em></li><li><em>The developer checks if the plan executes, provides the output as expected, and </em><strong><em>adds reviewers to the Merge Request</em></strong><em>.</em></li><li><em>Once the Pull Request has been approved by the approver, the developer writes “</em><strong><em>Atlantis apply</em></strong><em>” to apply in a PR comment. This will trigger Atlantis to run terraform apply and then the changes will be deployed to your infrastructure.</em></li></ol><p>The command fails if the <a href="https://docs.github.com/en/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request">Merge Request</a> has not been approved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*oNZwSHgoqdnjL2pn4XOuKQ.jpeg" /><figcaption>Credit: <a href="https://miro.medium.com/max/1400/1*0ROddgc8Kax8Q-Es3a4x0g.jpeg">Link</a></figcaption></figure><p>Having known the process of Atlantis, let&#39;s check how to deploy Atlantis and make use of it. There are many ways via which you can deploy Atlantis, but in this blog, we are using GKE and GitHub. You can refer to their <a href="https://www.runatlantis.io/docs/deployment.html">official doc</a> for more deployment options.</p><h3>Deploying Atlantis on Google Kubernetes Engine Using Helm</h3><h3>Pre-requisites:</h3><ul><li><a href="https://kubernetes.io/">Kubernetes</a> environment and kubectl configured on your machine. For this blog, I am using GKE Cluster, but you can also use Mini Kube or EKS</li><li><a href="https://helm.sh/">Helm</a> CLI — a Kubernetes package manager.</li><li><a href="https://my.webhookrelay.com/">Webhook Relay account</a> — webhook forwarding solution to our internal Kubernetes environment.</li><li><a href="https://github.com/">GitHub</a> Organizational Account</li><li><a href="https://www.runatlantis.io/docs/access-credentials.html#create-an-atlantis-user-optional">Git host access credentials</a> — Make sure you save the access token; we will need it in the next step.</li><li><a href="https://docs.github.com/en/actions/security-guides/encrypted-secrets">GitHub Secret</a> — Make sure you save the secret; we will need it in the next step.</li><li><a href="https://my.webhookrelay.com/tokens">Webhook Relay operator</a> — Make sure you save the Relay Key and Relay secret; we will need it in the next step.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dr9ZfDozm67W8WeL7lERZg.jpeg" /><figcaption>Credit: <a href="https://miro.medium.com/max/1200/0*nmk-SeYfXnmGDFRG.jpg">Link</a></figcaption></figure><p>There are multiple ways for deploying Atlantis, the official document for the same is in this <a href="https://www.runatlantis.io/docs/deployment.html#deployment">link</a></p><p>Let&#39;s follow the GitHub Deployment on GKE:</p><ol><li>Create a namespace</li></ol><pre>kubectl create namespace atlantis </pre><p>2. Switch context to Atlantis namespace</p><pre>kubectl config set-context $(kubectl config current-context) --namespace=atlantis</pre><p>3. Add repositories</p><pre>helm repo add stable https://kubernetes-charts.storage.googleapis.com</pre><p>4. Update helm repository</p><pre>helm repo update</pre><p>5. Use the following command to run Atlantis</p><pre>helm upgrade --install atlantis stable/atlantis --version 3.12.2 \<br>  --set=github.user=GitHub-Username \<br>  --set=github.token=******* \<br>  --set=github.secret=***** \<br>  --set=service.type=ClusterIP \<br>  --set=ingress.enabled=false \<br>  --set=orgWhitelist=&quot;github.com/atlantis/*&quot;</pre><p>Here, the variables are:</p><ul><li>github.user — your GitHub username</li><li><a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-token">github.token</a> — your GitHub personal access token</li><li>github.secret — shared secret that will have to be shared with Atlantis</li><li><a href="https://cloud.google.com/kubernetes-engine/docs/concepts/service">service.type </a>— making sure Atlantis is not exposed as a <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/service#service_of_type_nodeport">Node Port service</a></li><li><a href="https://cloud.google.com/kubernetes-engine/docs/concepts/ingress">ingress.enabled</a> —We have set it to false, i.e. disabled ingress</li><li>orgWhitelist — which repositories should be processed</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1G_PQ_AjcE2e0mRMsgwtKA.png" /><figcaption>Install Atlantis using Helm</figcaption></figure><p>6. Get the status of the pod and service</p><pre>kubectl get pods</pre><pre>kubectl get svc</pre><p>7. Export your Webhook Operator</p><pre>export RELAY_KEY=xxxxxxxxxxxx<br>export RELAY_SECRET=xxxxx</pre><p>8. Add the webhook relay operator to your helm repository and update the helm repo</p><pre>helm repo add webhookrelay https://charts.webhookrelay.com<br>helm repo update</pre><p>9. Install Helm</p><pre>helm upgrade --install webhookrelay-operator webhookrelay/webhookrelay-operator \<br>  --set credentials.key=$RELAY_KEY \<br>  --set credentials.secret=$RELAY_SECRET</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JBp2bpNPFyAzTTkRGpCVFg.png" /><figcaption>Install Webhook Relay Operator</figcaption></figure><p>10. We should now see two pods running in our Atlantis namespace:</p><p>11. Next step is to configure webhook forwarding to the Atlantis service:</p><blockquote><em>Use vim to create a new yaml file &amp; press i to insert the following deployment file and :wq! to save the </em><strong>atlantis-cr.yaml<em> </em></strong><em>file</em></blockquote><pre>apiVersion: forward.webhookrelay.com/v1<br>kind: WebhookRelayForward<br>metadata:<br>  name: forward-to-atlantis<br>spec:<br>  buckets:<br>  - name: github-to-atlantis<br>    inputs:<br>    - name: public-endpoint<br>      description: &quot;Endpoint for GitHub&quot;<br>      responseBody: &quot;OK&quot;<br>      responseStatusCode: 200<br>    outputs:<br>    - name: atlantis-pod<br>      destination: <a href="http://atlantis/">http://atlantis:80</a></pre><p>12. Create the deployment using the apply command</p><pre>kubectl apply -f atlantis-cr.yaml</pre><p>13. We should now see three pods running in our atlantis namespace:</p><pre>kubectl get pods<br>kubectl get svc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*3s2VJXrVDxJ6ePhXyR6-mQ.png" /><figcaption>Pod and Service Status</figcaption></figure><blockquote>To check the public webhooks URL refer this <a href="https://my.webhookrelay.com/buckets">link</a> and copy the Atlantis bucket URL</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CKGmOJz5Dzxe-vbKEP5_sg.png" /><figcaption>Webhook Relay URL</figcaption></figure><p>14. Go to <a href="https://github.com/"><strong>GitHub</strong></a> → Your Repo → Settings →Webhooks<br>Set payload URL to the bucket URL and make sure to add <strong>/events</strong> in the end. Set the content type to <strong>application/JSON; </strong>set the <strong>secret </strong>to webhook secret got in point no.7.</p><p>Check the following checkboxes ✅</p><p>✔️<em>Pushes</em></p><p>✔️<em>Pull request reviews</em></p><p>✔️<em>Issue comments</em></p><p>✔️<em>Pull requests</em></p><p><em>Make sure the </em><strong><em>Active checkbox</em></strong><em> remains checked and click on Save.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rbvUsOBwse92S4mP_t1ftw.png" /><figcaption>Manage Webhooks in GitHub</figcaption></figure><p>You can also refer to <a href="https://github.com/sethvargo/atlantis-on-gke">GitHub Repository</a>, where you can Clone the repo in your local system and run Terraform Commands, and configure Atlantis.</p><p>Once Atlantis is configured, you can try it out on GitHub by creating a Pull Request and commenting on the Atlantis plan and Atlantis apply.</p><h3>Benefits of Atlantis:</h3><ul><li><strong><em>Manage Multiple Projects</em></strong>⚡️ We have to manage multiple projects in AWS/GCP/Azure and other clouds. A single <a href="https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests">Pull Request</a> can run terraform plans in each directory in which it will copy and paste the planned output into the PR comment, and then apply locally before merging the Pull Request. Automating that process with Atlantis immediately improves productivity and thus we can manage multiple projects at the same time.</li><li><strong><em>No More “It worked on my machine” </em></strong><em>👻 </em>We always end up with this quote that “it worked on my machine”, it should work on yours as well, here we don’t need to do anything locally, everything can be tested on a single platform.</li><li><strong><em>Increased Audit Trail: </em></strong>🔏 Each pull request which has been raised, holds detailed logs of what infrastructure changes were made when the changes were made, who made the change, and who approved it.</li><li><strong><em>Secure Workflow: </em></strong>🔐 Atlantis can be configured to require a Pull Request (PR) to be approved and merged before the changes can be applied. Atlantis can add an extra layer of protection that prevents engineers from accidentally applying changes before they’re approved by the approver</li><li><strong><em>Reduction of </em></strong><a href="https://cloud.google.com/iam/docs/permissions-reference"><strong><em>IAM Permissions</em></strong></a><strong><em> provided to Engineers:</em> </strong>✋ We are often required to provide highly privileged credentials to perform Terraform actions, and the greater the number of principals you have with privileged access, there is a higher chance of attacking risks.</li><li><strong><em>Formalize the delivery process: </em></strong>👍 Atlantis makes sure that it locks the directory/workspace until the pull request is merged or the lock is deleted by manual intervention. This makes sure that changes are applied in the order as they are expected.</li></ul><h3>Limitations</h3><ul><li>Atlantis excels at all the things that we have seen till now, like the terraform init / plan / apply workflow, but it is not designed to handle more complex tasks, like importing terraform resources or running terraform state commands. Those operations still require manual intervention as of now.</li><li>Atlantis lets us work efficiently and effectively, increasing productivity. We do not have to wait for opening a pull request, executing terraform commands. We are now able to make infrastructure changes to n number of environments in analogy.</li></ul><blockquote>Note: If you’re new to Atlantis, you can run <a href="https://www.runatlantis.io/guide/test-drive.html"><strong>Test Drive of Atlantis</strong></a> where you can test the Atlantis working using the Atlantis executable files. Also, you can go through the <a href="https://www.youtube.com/watch?v=TmIPWda0IKg&amp;t=135s"><strong>official walkthrough</strong></a> of Atlantis to gain more insights.</blockquote><p>Hopefully, this post has provided some valuable tips and information about Atlantis. Stay tuned to get more blogs and feel free to reach me on <a href="https://www.linkedin.com/in/apurva-murde-b6b38515b/">LinkedIn</a> if you have any concerns. Do comment your views.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e99ab190655" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/getting-started-atlantis-with-terraform-and-github-4e99ab190655">Getting Started: Atlantis with Terraform and GitHub</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>