<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Cole Thienes</title>
    <description>The latest articles on DEV Community by Cole Thienes (@colethienes).</description>
    <link>https://dev.to/colethienes</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1377387%2Fdc843362-0333-4fb2-b8ed-883c3c03aeae.jpeg</url>
      <title>DEV Community: Cole Thienes</title>
      <link>https://dev.to/colethienes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/colethienes"/>
    <language>en</language>
    <item>
      <title>Stop Squinting at IaC Templates: Preview Diffs for Argo CD, Terraform, and more!</title>
      <dc:creator>Cole Thienes</dc:creator>
      <pubDate>Sat, 23 Mar 2024 13:32:55 +0000</pubDate>
      <link>https://dev.to/colethienes/stop-squinting-at-iac-templates-preview-diffs-for-argo-cd-terraform-and-more-h3d</link>
      <guid>https://dev.to/colethienes/stop-squinting-at-iac-templates-preview-diffs-for-argo-cd-terraform-and-more-h3d</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;See the GitHub project here: &lt;a href="https://github.com/infro-io/infro-core"&gt;https://github.com/infro-io/infro-core&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  IaC Templates are everywhere
&lt;/h1&gt;

&lt;p&gt;In the modern software development landscape, Infrastructure as Code (IaC) templates have become a staple. Many companies use them to manage the complexity of setting up the same infrastructure over and over, and to provide vetted, “paved-path” infrastructure setups. However, this often leads to developers not completely understanding what they’re setting up, as the details are hidden from them with layers of abstraction. Take this change for example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fasktr4l58vbqjh4xhvs1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fasktr4l58vbqjh4xhvs1.png" alt="Image description" width="800" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;From: &lt;a href="https://codefresh.io/blog/argo-cd-preview-diff/#attachment_24546"&gt;https://codefresh.io/blog/argo-cd-preview-diff/#attachment_24546&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It’s not immediately apparent how this helm template will actually change the underlying Kubernetes infrastructure. Tools like like &lt;code&gt;helm diff&lt;/code&gt;, &lt;code&gt;terraform plan&lt;/code&gt;, or &lt;code&gt;aws cdk diff&lt;/code&gt; are great for understanding exactly what will be rendered, it’s they’re manual to run and not always enforced by reviewers. This is where the need for automation comes in.&lt;/p&gt;

&lt;h1&gt;
  
  
  Searching for a solution
&lt;/h1&gt;

&lt;p&gt;Many solutions in the wild will interact with the IaC provider to publish the rendered diffs to pull requests, so reviewers can see them before approving a code change:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25bq3gch35rd4gg86svv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25bq3gch35rd4gg86svv.png" alt="Image description" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, &lt;a href="https://www.runatlantis.io/"&gt;Atlantisgo&lt;/a&gt; for Terraform, &lt;a href="https://github.com/zapier/kubechecks"&gt;Zapier’s Kubechecks&lt;/a&gt; for Argo CD, &lt;a href="https://github.com/quizlet/argocd-diff-action"&gt;Quizlet’s GitHub action&lt;/a&gt; all do something similar to this. But a generic, extensible tool for IaC providers doesn’t seem to exist. Additionally, many of them require exposing your Kubernetes cluster or other infrastructure to third-party access, webhooks, etc.&lt;/p&gt;

&lt;h1&gt;
  
  
  Enter Infro
&lt;/h1&gt;

&lt;p&gt;Infro is a generic solution that integrates with different IaC providers to provide a clear, holistic view of your changes on pull requests. For example, if you deploy both Argo CD and Terraform infrastructure in your repository, your diff make look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvc0ez43p4feesweshkl1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvc0ez43p4feesweshkl1.png" alt="Image description" width="800" height="758"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This example shows the output of the Infro GitHub Action (see setup instructions &lt;a href="https://github.com/infro-io/infro-core?tab=readme-ov-file#as-a-github-action"&gt;here&lt;/a&gt;), and requires access to the Kubernetes cluster in order to interact with the Argo CD API to generate diffs. However, the self-hosted option does not have this requirement (see setup instructions &lt;a href="https://github.com/infro-io/infro-core?tab=readme-ov-file#self-hosted"&gt;here&lt;/a&gt;). Deployed into your cluster, Infro will instead poll the GitHub API for updated pull requests in your organization or user account, and interact with the in-cluster Argo CD to publish diffs to those pull requests.&lt;/p&gt;

&lt;p&gt;Finally, there is also a cloud option which allows you to install a GitHub App on your organization or user account, add your IaC configurations, and receive PR diff comments, all without a line of code (see article &lt;a href="https://medium.com/@colethienes/argocd-pull-request-checks-c863190c5f8c?source=friends_link&amp;amp;sk=2eda79520de33483591448c6dfe8d284"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;h1&gt;
  
  
  Configuration
&lt;/h1&gt;

&lt;p&gt;Wherever it’s deployed, the Infro configuration is very extensible, allowing Infro to run diffs against multiple IaC providers and publish comments to multiple types of version control systems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;deployers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;argocd&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;ARBITRARY_NAME&amp;gt;&lt;/span&gt;
    &lt;span class="na"&gt;authtoken&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;ARGOCD_TOKEN&amp;gt;&lt;/span&gt;
    &lt;span class="na"&gt;endpoint&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;ARGOCD_ENDPOINT&amp;gt;&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;terraform&lt;/span&gt;
    &lt;span class="na"&gt;workdir&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;TERRAFORM_WORKDIR&amp;gt;&lt;/span&gt;
&lt;span class="na"&gt;vcs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github&lt;/span&gt;
  &lt;span class="na"&gt;authtoken&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;GITHUB_TOKEN&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The configuration has a set of &lt;code&gt;deployers&lt;/code&gt; which currently includes Argo CD and Terraform, but could contain other providers like AWS CDK. You configure the &lt;code&gt;vcs&lt;/code&gt;, to enable Infro to publish diffs to your version control system. Only GitHub is supported today, but this could also be GitLab, BitBucket, etc.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;And that’s it! You can find the project and more installation instructions &lt;a href="https://github.com/infro-io/infro-core"&gt;here&lt;/a&gt;. All feedback and contributions are welcome! Let’s work together to make IaC more accessible and understandable for everyone!&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>github</category>
      <category>devops</category>
      <category>infrastructureascode</category>
    </item>
  </channel>
</rss>
