<?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 Driftctl on Medium]]></title>
        <description><![CDATA[Stories by Driftctl on Medium]]></description>
        <link>https://medium.com/@cloudskiff?source=rss-a0713349ea37------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gQsG2m7dwUiPEHVQmtILOw.png</url>
            <title>Stories by Driftctl on Medium</title>
            <link>https://medium.com/@cloudskiff?source=rss-a0713349ea37------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 23:13:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cloudskiff/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[Security Group Rules : small changes, bitter consequences]]></title>
            <link>https://faun.pub/security-group-rules-small-changes-bitter-consequences-6297705f2259?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/6297705f2259</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-drift]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Wed, 05 May 2021 07:21:06 GMT</pubDate>
            <atom:updated>2021-05-06T17:23:42.364Z</atom:updated>
            <content:encoded><![CDATA[<h3>Security Group Rules: small changes, bitter consequences</h3><h3>How a simple manual change in an AWS Security Group using the AWS Web Console can have bitter security consequences</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASPBhrkU3gNrEtT6mcXyUg.png" /></figure><p>In this article, we’ll show how a simple manual change in an AWS Security Group using the AWS Web Console can have bitter security consequences. This one is based on many first-hand experiences and user feedback, in a production context with infrastructure-as-code.</p><h3>Allowing PgSQL (with Terraform)</h3><p>For this article, we’ll take the example recently experienced by a team we know. They secured access to their PgSQL instances with this simple Terraform configuration, allowing only the web servers subnet:</p><pre>// Secure the PgSQL RDS cluster using a dedicated SG<br>resource &quot;aws_security_group&quot; &quot;pgsql&quot; {<br>  name        = &quot;PgSQL Security Group&quot;<br>  description = &quot;PgSQL Security Group&quot;</pre><pre>  tags = {<br>    Name = &quot;PgSQL Security Group&quot;<br>  }<br>}</pre><pre>// PgSQL can only be accessed from the WWW network (10.0.0.0/8)<br>resource &quot;aws_security_group_rule&quot; &quot;pgsql&quot; {<br>  type              = &quot;ingress&quot;<br>  from_port         = 5432<br>  to_port           = 5432<br>  protocol          = &quot;tcp&quot;<br>  cidr_blocks       = [&quot;10.0.0.0/8&quot;]<br>  security_group_id = aws_security_group.pgsql.id<br>}</pre><p>They had a scheduled terraform plan as a GitHub Action for the whole infrastructure, so if something changed, it was reported right away. The “GitOps” workflow also included some linters, a terraform plan, followed by a terraform apply after a merge on the main branch.</p><p>It worked well and satisfied the initial basic security requirements. Good job!</p><h3>That one Security Group temporary change</h3><p>A couple of years later, to win a new major customer, they agreed to allow a pentesting audit. Long story short, one auditor was pentesting from the internet, while the other worked from different internal networks of the company.</p><p>Oddly enough, they didn’t come back with the same results: the external audit came clean, while the internal one basically opposed a strict “no-go” to the commercial deal. Reason: the auditor reported he gained access to every customer database in a matter of minutes. With proof.</p><p>How could it happen?</p><p>One day, someone from the team needed to quickly test something on a customer database who experienced a bug. A single value to change. Going through the hassle of switching to the secure network, then connecting to the corporate VPN, then going through the Bastion using a smartcard for authentication, probably also having to explain soon to the security team why he connected and what he did…this was definitely too much. Especially when he could simply allow the company’s office outgoing IPv4 on the “PgSQL” security group! And remove it after the change. Moreover, he would <em>necessarily</em> remember about it, as all the Security Groups were 100% managed by Terraform on CI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*vCF8_i3Mm2YUzH-F" /></figure><p>And it worked well! That team member fixed the customer issue in the database quickly.</p><p>And forgot to remove the security group rule, until it was discovered by the auditor, so that he could:</p><ol><li>connect painlessly to the customer databases from the office</li><li>then easily find passwords using a tool like <a href="https://tools.kali.org/password-attacks/hydra">hydra</a> against PostgreSQL.</li><li>profit.</li></ol><h3>How we ended up there?</h3><p>Here’s the context in which this team worked:</p><ul><li>a team member had AWS Web Console credentials large enough to make Security Group changes</li><li>they assumed Security Group Rules were represented similarly on AWS and Terraform</li><li>they wrote their Security Groups rules a certain way using Terraform</li></ul><p>We can’t do much about the first issue: it’s the harsh reality of most companies today. Surely enough they need to adopt a proper full GitOps workflow, but most aren’t there yet (and won’t be for a while).</p><h3>The lists are not what they seem</h3><p>The second assumption is confusing because of what can the UI lead you to believe. As developers, we know that cidr_blocks = [&quot;10.0.0.0/8&quot;] is a list and that adding an element to it will make it different.</p><p>As a developer, I can also easily believe that such a design in the AWS Console would also generate a list, both IPs are listed under the same line, exactly as if I read [&quot;10.0.0.0/8&quot;, &quot;96.202.220.106/32&quot;]:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/0*DUQRua9yNyn3ncYg" /></figure><p>The thing is, in the end, on the AWS side, they really are two elements of a list, but in the Terraform model, they end up being two distinct resources and not two elements. This difference in models between the cloud provider and Terraform can sometimes be misleading for users and can have major consequences.</p><h3>The way you write your Terraform matters</h3><p>The third and final situation here is the way the Terraform configuration was written.</p><p>Can you guess what happened in CI for months after the manual change wasn’t reverted? Nothing.</p><pre>$ terraform apply<br>aws_security_group.pgsql: Refreshing state... [id=sg-0b6af725ba7e7691b]<br>aws_security_group_rule.pgsql: Refreshing state... [id=sgrule-3696232291]</pre><pre>Apply complete! Resources: 0 added, 0 changed, 0 destroyed.</pre><p>To be more precise, something happened. The manual Security Group rule change was added without anyone being notified about it in the terraform.tfstate right when the next terraform apply ran in CI:</p><pre>&quot;ingress&quot;: [<br>              {<br>                &quot;cidr_blocks&quot;: [<br>                  &quot;10.0.0.0/8&quot;<br>                ],<br>                &quot;description&quot;: &quot;&quot;,<br>                &quot;from_port&quot;: 5432,<br>                &quot;ipv6_cidr_blocks&quot;: [],<br>                &quot;prefix_list_ids&quot;: [],<br>                &quot;protocol&quot;: &quot;tcp&quot;,<br>                &quot;security_groups&quot;: [],<br>                &quot;self&quot;: false,<br>                &quot;to_port&quot;: 5432<br>              },<br>              {<br>                &quot;cidr_blocks&quot;: [<br>                  &quot;96.202.220.106/32&quot;<br>                ],<br>                &quot;description&quot;: &quot;&quot;,<br>                &quot;from_port&quot;: 5432,<br>                &quot;ipv6_cidr_blocks&quot;: [],<br>                &quot;prefix_list_ids&quot;: [],<br>                &quot;protocol&quot;: &quot;tcp&quot;,<br>                &quot;security_groups&quot;: [],<br>                &quot;self&quot;: false,<br>                &quot;to_port&quot;: 5432<br>              }<br>            ], </pre><p>Yes, you will end up with a Terraform state with way more information and resources than you intended from the code, as the Terraform state job is not to represent your intention, but to <a href="https://www.terraform.io/docs/language/state/purpose.html">map the real world with your config</a>.</p><p>The way Security Group Rules were written couldn’t help discovering the change (not to mention notifying anyone). You could add a billion rules and it would be the same.</p><p>Fortunately, in this case, if you read Terraform’s documentation for the AWS provider (currently v3.36), you’ll find 2 options to configure Security Groups:</p><ol><li>Use the <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group">aws_security_group</a> resource with inline egress {} and ingress {} blocks for the rules.</li><li>Use the <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group">aws_security_group</a> resource with additional <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule">aws_security_group_rule</a> resources.</li></ol><p>In this case, using the first option would have been better for this team, from a more DevSecOps point of view. See how the next terraform apply in CI would have had the expected effect:</p><pre>$ terraform apply<br>aws_security_group.pgsql: Refreshing state... [id=sg-03a12201c68c38d92]</pre><pre>An execution plan has been generated and is shown below.<br>Resource actions are indicated with the following symbols:<br>  ~ update in-place</pre><pre>Terraform will perform the following actions:</pre><pre>  # aws_security_group.pgsql will be updated in-place<br>  ~ resource &quot;aws_security_group&quot; &quot;pgsql&quot; {<br>        id                     = &quot;sg-03a12201c68c38d92&quot;<br>      ~ ingress                = [<br>          - {<br>              - cidr_blocks      = [<br>                  - &quot;96.202.220.106/32&quot;,<br>                ]<br>              - description      = &quot;Allow PgSQL from WWW&quot;<br>              - from_port        = 5432<br>              - ipv6_cidr_blocks = []<br>              - prefix_list_ids  = []<br>              - protocol         = &quot;tcp&quot;<br>              - security_groups  = []<br>              - self             = false<br>              - to_port          = 5432<br>            },<br>            # (1 unchanged element hidden)<br>        ]<br>        name                   = &quot;PgSQL Security Group&quot;<br>        tags                   = {<br>            &quot;Name&quot; = &quot;PgSQL Security Group&quot;<br>        }<br>        # (6 unchanged attributes hidden)<br>    }</pre><pre>Plan: 0 to add, 1 to change, 0 to destroy.</pre><p>Unfortunately, it’s often too late when you realize it, and this kind of option doesn’t exist for every resource out there. What was a DevOps discussion (<em>“let’s automate those deployments and ship that on CI!”</em>) can quickly become a DevSecOps discussion now (<em>“how should we write our Terraform configuration according to our goals?”</em>).</p><h3>The driftctl option</h3><p>That’s why using driftctl is always a good option. As the tool compares your Terraform state to the reality of your AWS account, you can deploy the tool at 2 important places of your workflow:</p><ol><li>as a scheduled run (like an hourly cronjob), so you get reports when something changes</li><li>as a pre-condition to a terraform apply step in CI: so you ensure you’re working with an unmodified Terraform state (as by design the refresh part of the apply can modify it). You may also want to parallelize this driftctl step with a terraform plan.</li></ol><p>Here’s a driftctl run when the activity is as expected on the AWS account:</p><pre>$ driftctl scan<br>Scanned resources:    (54)<br>Found 2 resource(s)<br> - 100% coverage<br>Congrats! Your infrastructure is fully in sync.<br>$ echo $?<br>0</pre><p>Here’s a driftctl run with the above manual change:</p><pre>$ driftctl scan<br>Scanned resources:    (55)<br>Found resources not covered by IaC:<br>  aws_security_group_rule:<br>    - Type: ingress, SecurityGroup: sg-0ce251e7ce328547d, Protocol: tcp, Ports: 5432, Source: 96.202.220.106/32<br>Found 3 resource(s)<br> - 66% coverage<br> - 2 covered by IaC<br> - 1 not covered by IaC<br> - 0 missing on cloud provider<br> - 0/2 changed outside of IaC<br>$  echo $?<br>1</pre><p>This output clearly shows:</p><ul><li>a resource NOT on the Terraform state, of type aws_security_group_rule, for the Security Group sg-0ce251e7ce328547d, that allows TCP/5432 for 96.202.220.106/32. This should trigger an alarm!</li><li>some metrics for your own reference.</li></ul><p>This output can be exported as JSON too, so you can easily manipulate it and integrated it into your other tools and notification systems. There’s a ton of other options and integrations you can use with driftctl, but that will be for another article!</p><p>Reference:</p><ul><li><a href="https://driftctl.com/">driftctl.com</a></li><li><a href="https://github.com/cloudskiff/driftctl">driftctl GitHub</a></li><li><a href="https://docs.driftctl.com/">driftctl Documentation</a></li><li>Terraform AWS Provider resources documentation: <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule">aws_security_group_rule</a> and <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group">aws_security_group</a></li></ul><p>Driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift</strong></p><p><a href="https://driftctl.com/?utm_source=medium&amp;utm_medium=medium&amp;utm_campaign=medium">More info about us</a></p><figure><a href="https://faun.to/i9Pt9"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t_MOgMTr_f1N4qHN_R7KVA.png" /></a></figure><p>Join FAUN: <a href="https://faun.to/i9Pt9"><strong>Website</strong></a><strong> </strong>💻<strong>|</strong><a href="https://faun.dev/podcast"><strong>Podcast</strong></a><strong> </strong>🎙️<strong>|</strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong>|</strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong>|</strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷|<a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook Group</strong></a><strong> </strong>🗣️<strong>|</strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin Group</strong></a><strong> </strong>💬<strong>|</strong> <a href="https://faun.dev/chat"><strong>Slack</strong></a> 📱<strong>|</strong><a href="https://thechief.io/"><strong>Cloud Native</strong> <strong>News</strong></a><strong> </strong>📰<strong>|</strong><a href="https://linktr.ee/faun.dev/"><strong>More</strong></a><strong>.</strong></p><p><strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6297705f2259" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/security-group-rules-small-changes-bitter-consequences-6297705f2259">Security Group Rules : small changes, bitter consequences</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Codecov bash uploader security issue]]></title>
            <link>https://cloudskiff.medium.com/codecov-bash-uploader-security-issue-1eb00f17e77b?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/1eb00f17e77b</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[circleci]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Tue, 04 May 2021 15:26:08 GMT</pubDate>
            <atom:updated>2021-05-04T15:26:08.713Z</atom:updated>
            <content:encoded><![CDATA[<h3>How minimizing our attack surface with CircleCI Contexts helped us pass the Codecov bash uploader security issue unharmed</h3><h3>What is Codecov</h3><p>For those who don’t know Codecov, it is an online platform for hosted code coverage reports and statistics founded in 2014. According to their website, over 29,000 organizations and more than 1 million developers use their tools. The list includes Google, Atlassian, The Washington Post, RBC, and Procter &amp; Gamble Co.</p><p>Its main tool, the Bash Uploader, is used to send code coverage reports to the platform. Those reports help developers measure how well their source code is covered by tests. This is the main reason why it is widely used among developers and organizations.</p><h3>What about the breach?</h3><p>On April 15th, 2021, Codecov reported in a press release that someone had gained unauthorized access to its script and modified it without its permission.</p><p><em>“Our investigation has determined that beginning Jan. 31, 2021, there were periodic, unauthorized alterations of our Bash Uploader script by a third party, which enabled them to potentially export information stored in our users’ continuous integration environments. This information was then sent to a third-party server outside of Codecov’s infrastructure”</em> the company said.</p><p>According to Codecov, the hacker gained access to:</p><ul><li>Any credential, token, or key that customers passed through their continuous integration runner that would be accessible when the Bash Uploader script was executed;</li><li>Any service, datastore, and application code that could be accessed with these credentials, tokens, or keys;</li><li>The git remote information (URL of the origin repository) of repositories using the Bash Uploader to upload coverage to Codecov in their continuous integration.</li></ul><p>For those potential threats, Codecov is strongly encouraging developers to immediately re-roll all of their credentials, tokens, or keys located in the environment variables in their CI process.</p><h3>Why are we safe from that at CloudSkiff?</h3><p>We use CircleCI to continuously build, test and deploy our open-source drift detection CLI, <a href="https://github.com/cloudskiff/driftctl">driftctl</a>. Like most projects, we need to manipulate sensitive environment variables which could mean that this event could impact us.</p><p>But, <a href="https://circleci.com/">CircleCI</a> provides a simple and secure way to store and share those sensitive environment variables across projects and jobs (or pipelines, or steps in other CI), it is called <a href="https://circleci.com/docs/2.0/contexts/">a context</a>. As an Organization in CircleCI, you can, in your settings, create and manage contexts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*qGttjueM5xdLQgnG" /></figure><p>You can use the context key in the workflows section of a project config.yml file to give any jobs access to the environment variables associated with the context.</p><pre>version: 2.1</pre><pre># Jobs declaration for build, test and deploy not displayed</pre><pre>workflows:<br>  build-test-deploy:<br>    jobs:<br>      - build<br>      - test<br>      - deploy:<br>          context: restricted-context<br>          requires:<br>            - build<br>            - test</pre><p>In the example above, only the deploy job has access to the environment variables created in the restricted-context context. On the other hand, the build and test jobs don’t have any access to the sensitive variables in their execution.</p><p>That’s basically what we do as of today in our CircleCI config.yml file. Every time we need to call our test job to execute the Codecov Bash Uploader script (e.g. every push, pull request, and release workflows), since we don’t attach any context to it, the hacker has no access to our secret variables.</p><p>We try to keep our jobs as small as possible to reduce the attack surface by separating concerns, and CircleCI context is well suited to assist in this good practice.</p><h3>We could have avoided that threat</h3><p>One way we could have avoided that is the same way Codecov started investigating the attack. The company reported on the morning of April 1, 2021, that one customer was using the shasum that is available on its Bash Uploader to confirm the integrity of the uploader fetched from <a href="https://codecov.io/bash">https://codecov.io/bash</a>.</p><p>Indeed, as stated on its documentation website, “it can be validated for correctness by calculating the shasum on download and comparing to the result we store in the GitHub repository”.</p><p>An example could be:</p><pre>$ curl -s -o codecov https://codecov.io/bash \<br>&amp;&amp; VERSION=$(grep &#39;VERSION=\&quot;.*\&quot;&#39; codecov | cut -d&#39;&quot;&#39; -f2) \<br>&amp;&amp; shasum -a 512 -c --ignore-missing &lt;(curl -s <a href="https://raw.githubusercontent.com/codecov/codecov-bash/$%7BVERSION%7D/SHA512SUM)">https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA512SUM)</a></pre><p>This simple script could be run on each test job before running the Bash Uploader. If we were doing it that way we could have seen sooner the hack, and we could have reported it sooner to Codecov.</p><p>Our final test job looks like this:</p><pre>test:<br>docker:<br>  - image: golang:1.16<br>steps:<br>  - checkout<br>  - run: make install-tools<br>  - run: make test<br>  - run:<br>      name: Check Codecov<br>      command: |<br>        curl -s -o codecov https://codecov.io/bash \<br>          &amp;&amp; VERSION=$(grep &#39;VERSION=\&quot;.*\&quot;&#39; codecov | cut -d&#39;&quot;&#39; -f2) \<br>          &amp;&amp; shasum -a 512 -c --ignore-missing &lt;(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA512SUM)<br>  - run:<br>      name: Codecov upload<br>      command: |<br>        chmod +x codecov<br>        ./codecov</pre><p>Driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift</strong></p><p><a href="https://driftctl.com/?utm_source=medium&amp;utm_medium=medium&amp;utm_campaign=medium">More info about us</a></p><p>Reference:</p><ul><li><a href="https://about.codecov.io/security-update/">Codecov Press Release</a></li><li><a href="https://circleci.com/docs/2.0/contexts/">CircleCI Context</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1eb00f17e77b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Our commitments to the community]]></title>
            <link>https://cloudskiff.medium.com/our-commitments-to-the-community-2dac997f2e32?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dac997f2e32</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Thu, 18 Mar 2021 13:14:39 GMT</pubDate>
            <atom:updated>2021-03-18T13:14:39.401Z</atom:updated>
            <content:encoded><![CDATA[<h3>Here’s why we bring a new open source DevOps tool</h3><p>As we celebrated the initial release of <a href="https://github.com/cloudskiff/driftctl">driftctl</a> 3 months ago, we certainly hoped for some sort of acknowledgement or favorable opinion from those who would use it, but we were not prepared for such a warm welcome.</p><p>Reflecting on the first steps of the project, the fast moving star history and the contributions and interactions we have benefited from, we are both grateful and humbled by the support we receive from the open source community.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/0*CfVgh9gT2m0KXlf7" /></figure><h3>Why we launched this DevOps tool in the first place</h3><p>At CloudSkiff, we are all fans of GitOps. We are big believers in the power of Infrastructure as Code and all its benefits.</p><p>We like it so much that we decided to build a tool to help DevOps, SREs, infrastructure teams and all cloud practitioners, collaborate over Infrastructure as Code. As a team, we’re a bunch of seasoned people and we all gathered a lot of experience on cloud infrastructures automation. But we wanted to know more. We wanted to make sure that what we were building was truly helping.</p><p>So we decided to talk to as many people as possible. We interviewed dozens of IaC practitioners across several geographies: teams of various sizes, levels of expertise, and cloud automation progress status. They all had one thing in common: because Ops life is what it is, and despite their best efforts and process, they had a hard time reconciling their infrastructure code with the reality of their IaaS accounts. They were facing issues with drift.</p><p>Drift can be driven by human input, poor configuration, applications making unwanted changes, etc. It has consequences on toil and efficiency, forces teams to put in place strict controls that decrease flexibility, and can have security and compliance impacts. Even as an experienced Terraform user, as your infrastructure team and codebase grows, it often becomes harder to track drift.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*6xDhFlag-yyUEXr6" /></figure><p>Of course, we knew about drift, having oftentimes faced it ourselves, but we were not aware that it was such a widespread issue. So we decided to try and bring a solution to this problem with <a href="https://driftctl.com/product">driftctl, a free and open-source CLI</a> that tracks, analyzes, prioritizes, and warns of infrastructure drift.</p><h3>What OSS means to us and why we went open source in the first place.</h3><p>Being part of the DevOps ecosystem, we are very close to a community of tools situated within the <a href="https://www.cncf.io/">Cloud Native Computing Foundation</a>’s orbit. Those of you who had a glimpse at its landscape know that the CNCF drives a thriving ecosystem of tools in its wake, some of them open source.</p><p>Major open source projects such as Kubernetes, OPA (Open Policy Agent), Chef, Puppet, Ansible, Istio… paved the way for us and it was only natural to be in keeping with this trend and give back to the community.</p><p>But beyond that, it is our firm belief that an open source first approach is key not only to the widest diffusion of a solution to an issue, but more importantly to the best and most comprehensive elaboration of this solution.</p><p>Being only 3 month old, driftctl already benefits from contributions from all over the world with major commits, issues and discussions from Asia, Europe, North America… Only truly open projects can federate such goodwill and efficiency.</p><p>This is why we released driftctl under the <a href="https://github.com/cloudskiff/driftctl/blob/main/LICENSE.md">Apache 2.0</a> license, and we already gathered the best retributions out of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*NRNa-DQXPbBYJaR7" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/0*i5jyRBtvPob897Jq" /></figure><h3>Our commitments to the open source community.</h3><p>In concrete terms, what does it mean for us to be an open source project? Well, being OSS means first and foremost transparency and sharing:</p><h4>1) Full transparency from master to release</h4><p>Obviously, our code is open source. But it is important to us that the on-going developments are also made publicly available. Anyone who wants to know what’s cooking can <a href="https://github.com/cloudskiff/driftctl/pulls?q=is%3Aopen">access </a><a href="https://github.com/cloudskiff/driftctl/pulls?q=is%3Aopen">master, and see real “work in progress” on our code</a> and not some copy/paste of a finished version waiting to be released from a private repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*__YHo1HjqsZRuFvg" /></figure><h4>2) Live coding sessions</h4><p>Because we like coding and sharing, we open live coding sessions on a regular basis. Almost daily, anyone on our <a href="https://discord.gg/NMCBxtD7Nd">community discord server</a> and/or <a href="https://www.twitch.tv/driftctl">on Twitch</a> can see someone from the engineering team live coding and sharing his screen. Feel free to come say “Hi!”.</p><h4>3) Live release demos</h4><p>Transparency also means showing and discussing what we do, which is why each major release comes with a live release demo where we showcase new features, discuss the most interesting issues we had, and talk about what is coming next on the roadmap. Those releases happen on Twitch and <a href="https://www.youtube.com/channel/UCqUCM6vQKkq08amsqf_vKzg">YouTube live</a> and are available on replay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*fzgfm3SwB0k2Kbxm" /></figure><h4>4) Live chats within the engineering team</h4><p>Being a remote first (and remote only) organization, we do not have any offices or headquarters, which means that any member from the Engineering team can work from any place of his/her liking and that sync and async communication is paramount.</p><p>While most of the asynchronous communication within the team goes through our GitHub repositories where we store and share all of our resources, we found that a simple engineering chat does the trick to ensure live exchanges within the team whenever we need to work together on something, or even often do some pair programming. Those chats are also publicly accessible to all on our community discord server.</p><h4>5) Open issues and roadmap discussions</h4><p>Our foreseeable roadmap is accessible to all in the ROADMAP.md file on GitHub. All issues (internal and external) are also listed and accessible on this account. Anyone can join in a discussion to propose or upvote a feature.</p><p>Indeed, we also try to prioritize items on the roadmap according to the feedback we get. Typically, so far driftctl supports both the AWS and the GitHub providers and we see a lot of discussions around which provider should come next (Azure or GCP). You are welcome to <a href="https://github.com/cloudskiff/driftctl/discussions">take part to the vote here</a>.</p><h4>6) Extended support time frame</h4><p>In this early phase of the project, it is critical that we clearly understand what people expect from the tool, how they use it and what kind of issues they face (not to mention the usual early phase debugging period…). This is why <strong>we are extremely grateful for any feedback, any question, any suggestion</strong> from our users.</p><p>Being still a young organization with limited geographical outreach we decided to set up support on call rotation within the team to cover as many time zones across the globe as possible, and make sure we make the most out of each interaction we can get on our community discord server. This is why you are sure to have someone answering your questions from 7:00 am to 11:00 pm CET.</p><h3>What’s coming next?</h3><p>While we know that there are a lot more actions to take, so far we’ve sincerely tried to do our best to share our project with the open source community.</p><p>Raising awareness on the issue is one of our very strong focuses. Over the last months, we were lucky enough to be invited to talk about drift issues at some major conferences, such as Fosdem, Hashitalks or the CNCF London meetup and it was really great to share our views and experience on this topic. For those who would like to catch up, <a href="https://driftctl.com/replays">most of the talks are accessible on replay</a>.</p><p>As we move forward in the process of building driftctl, we frequently discover new potential security threats due to forgotten or unnoticed changes on infrastructures. This is why our next efforts will be centered on demonstrating how teams need to complement their DevSecOps Day 2 toolbox and how ensuring the parity of their code and their infras is a prerequisite to shifting security to the left.</p><p>Driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift</strong></p><p><a href="https://driftctl.com/?utm_source=medium&amp;utm_medium=medium&amp;utm_campaign=medium">More info about us</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/30/0*P55YgRsMIRAxuR2C" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dac997f2e32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infrastructure drifts aren’t like Pokemons…]]></title>
            <link>https://faun.pub/infrastructure-drifts-arent-like-pokemons-a98c9c37de7?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/a98c9c37de7</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Wed, 03 Mar 2021 08:01:24 GMT</pubDate>
            <atom:updated>2021-03-03T12:38:00.618Z</atom:updated>
            <content:encoded><![CDATA[<h4>…You can’t catch ’em all</h4><figure><img alt="Fosdem talk about infrastructure drift" src="https://cdn-images-1.medium.com/max/836/1*TQHSjLOzeZoR8ULN2UxNNA.png" /><figcaption>This blog post is a written transcript of the FOSDEM Talk: “Infrastructure drifts aren’t like Pokemon, you can’t catch ’em all”, by Stephane Jourdan — CTO and founder</figcaption></figure><p><strong>This talk covers three major topics:</strong></p><ol><li>Infrastructure as Code: all the good intentions and the ideal world each of us expected when we started using it, and how it’s actually going in everyday’s Ops life. We will see that how it started is probably different from how it is going and from what we expected.</li><li>We will then “drift” together, using Terraform and AWS and share some war stories that we heard from infrastructure teams, and how things sometimes went really wrong for them.</li><li>We will finally present driftctl, our open source answer to infrastructure drift problems.</li></ol><h3>Infrastructure drift: definition</h3><p>Let’s first agree on what is infrastructure drift: infrastructure drift is what happens when the reality of your infrastructure doesn’t match your expectations. This phenomenon is also known as<em> </em><strong><em>“Oh my god”</em></strong><em> </em>in production when things unexpectedly go wrong.</p><h3>Infrastructure as code: an ideal world</h3><h4>How it all started</h4><p>When it all started, we had this vision of an ideal world, and a bright future that Infrastructure as Code was to offer us, like Plato’s Republic was for society a while ago.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*IQkK_hV-TuN3QPaq" /></figure><p>With Infrastructure as code, we were supposed to have one single source of truth (the state file in the case of Terraform).</p><p>We were supposed to have versioning of the code with git. The code was to be so great that it would be self-documenting.</p><p>In this ideal world, we would have testing everywhere: on the pipelines before and after tdd and bdd etc, like the rest of engineering. Collaboration would be a bliss between teams. Infrastructure would be immutable: we could scale it up and down and throw the rest away.</p><p>GitOps would be everywhere: CI/CD for infrastructure, no more locally running things. And basically all the credentials would be under control and multi-cloud would solve all our problems because you know what they say: “API everywhere”… and we would have the skills to handle all those APIs, and the time to do this greatly.</p><h4>How it is actually going</h4><p>Marcus Aurelius, the roman emperor a few centuries after Plato wrote to himself: <strong><em>“Do not expect Plato’s ideal Republic”</em></strong><em>. </em>As it happens we are not Roman emperors but our ideal Republic is not to be expected either. How it started is not exactly how we see it going.</p><p>In our team, many of us were quite experienced but we wanted more feedback on what we were building. So we just asked hundreds of infrastructure teams, SREs… etc around the world where they were standing in their Infrastructure as Code journey.</p><p>Basically what they told us was that changes were still happening outside of their Infrastructure as Code: mainly manual changes and scripts that are changing tags, or lambdas updating things after deployment, etc… A lot of changes are still happening outside of their Infrastructure as Code scope, be it Terraform or Pulumi or whatever infrastructure tool they use, it doesn’t matter.</p><blockquote><em>Do not expect Plato’s ideal Republic</em></blockquote><blockquote><em>Marcus Aurelius</em></blockquote><h4>A bunch of other things go wrong for them as well.</h4><p>The scope of their changes is not very often fully committed because of broken processes.</p><p>People are still changing things manually on their AWS web console and then backporting the changes in Terraform until Terraform starts “screaming”, which means that people are still running Terraform locally with the right access keys on their own laptop. Terrible processes… and everybody knows that once you click everywhere on your console, a lot of other things are deployed in the background and so your Terraform code doesn’t reflect exactly what’s actually deployed online.</p><p>Many people we talked to were aware of the good practices about testing requirements. They knew frameworks like Terratest, etc… but most of them never had the time to either learn or write those tests. Sometimes they were just too costly to run for them.</p><p>The lack of communication obviously makes things worse: even in these Covid19 times, “Async” communication is still a major issue between teams.</p><p>Immutable infrastructure also is still a great struggle to achieve. A lot of the new projects are running more or less around this principle, but people also still have legacy to deal with, like thousands of VMs running every day.</p><p>Lots of people are still gaining console access. And guess what ? <strong><em>People with AWS console access tend to change things</em></strong> unless you lock them down completely, which is sometimes just not possible because they are your boss or your customer, or because they are “this very special co-worker” who needs to do “that special thing” manually on the web console… That’s where problems happen.</p><p>Many people are also facing skill issues. For example, if a full team very skilled on GCP has a new project that for some reason needs to run on Azure, as all the specifics of this provider are not immediately mastered, they often end up with bad practices in their Infrastructure as Code deployments.</p><p>And basically for lots of them, everything that has an API is still not under infrastructure code: we heard terrible stories about GitHub accesses, or DNS records or anything that can be used with Terraform that wasn’t yet by far deployed with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*j1nAyzurCB2za3PJ" /></figure><h3>Drift happens</h3><p>All those behaviors have something in common: they generate drift. While drift is pretty cool for cars, the discrepancy between intention and reality can lead to major issues, disasters, or security misconfiguration.</p><p>Drift can be a real major pain. To deal with it, most of the people that we met put something in place like terraform plan and apply in a cron tab or in CI/CD somewhere before and after some commits, but were still missing things.</p><pre>$ terraform apply<br>Apply complete! Resources: 0 added, 0 changed, 0 destroyed</pre><h4>We love Terraform and all Hashicorp products.</h4><p>Terraform is an excellent provisioner but it’s not fair to use it for something it’s not meant to do. If anything is outside its scope, it’s just normal that Terraform doesn’t catch it. There are a lot of changes that cannot be seen by Terraform.</p><p>Many of us expected terraform plan in cron tabs or in CI/CD to report changes because some of the resources were managed by it, but unfortunately as we are going to see, it is not always the case.</p><h3>Stories from the trenches</h3><p>The following stories are based on real stories that we heard while interviewing infrastructure teams. We simplified them to make them easy to understand with some code.</p><h4>How an intern with read-only access ended up with rogue administrative access and keys (without anyone noticing)</h4><p>The first story is about an intern with read-only access, ending up with access keys controlled by no one. Those keys were linked to an administrative policy, which nobody noticed.</p><p>To gain a better understanding of this story, let’s look at this very simple Terraform configuration file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*uaiUDSAsswlVeCZm" /></figure><p>We have a user with a key and a policy attachment for read-only.<br>Let’s apply this configuration:</p><pre>$ terraform apply<br>Apply complete! Resources: 9 added, 0 changed, 0 destroyed</pre><p>Now let’s move to the AWS console: here we can see again this intern user and the key that was created by our own code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*5RID3gTlHu9JUluv" /></figure><p>The story goes like this:</p><p>This intern went to the DevOps folks and complained that he couldn’t use his key for whatever reason. The team was in a rush, so they quickly logged in to the management console, they deactivated the first key and created a new one, perfectly sure they were going to remember it and add it to Terraform in just a few moments.</p><p>On top of that, Terraform was to notify them if they forgot anyway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*KXXSJiKuu8arjpl0" /></figure><p>What do you think happened? Let’s check with a terraform apply on this user.</p><pre>$ terraform apply<br>Apply complete! Resources: 0 added, 0 changed, 0 destroyed</pre><p>Basically nothing…</p><p>While this very simple use case may have led you to think that this specific key and user would be noticed and reported it was not the case.</p><p>So the story continues with this intern:</p><p>The intern comes back one hour later complaining that he still couldn’t do what he needed to do. As the infrastructure team did not have the time to look into it, they just gave him administrative access so that he could change whatever he needed to, thinking they would revert through his permissions quickly after.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*VOCuUcNjx_CWDq3N" /></figure><p>What do you think Terraform found in this case with a terraform apply , as we have a policy attached to the IAM user and everything is managed by terraform?</p><p>This team was sure that this was to be reported in terraform plan or terraform apply. But it wasn’t the case because basically it’s out of the control of Terraform. It’s just an attached resource, it doesn’t work like that.</p><pre>$ terraform apply<br>Apply complete! Resources: 0 added, 0 changed, 0 destroyed</pre><p>So the team forgot about it, they went on with the day and it was only weeks after that they realized they had an intern with an administrative key out there in the wild, uncontrolled by anyone, not even mentioned as “deactivated” on the code.</p><h4>How an intern with rogue Administrative access opened everything to anyone on IPv4 and IPv6 (still without anyone noticing)</h4><p>The next story starts with a process: as you know, you can have lambdas, scripts etcetera that have administrative access to some resources on a very limited scope.</p><p>In this case someone with an administrative access just opened everything to anyone on IPv4 and IPv6 and no one noticed anything. So how did it go?</p><p>Let’s go into the console &gt; VPC &gt; us-east-1 &gt; Security groups</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*OloKxWinyVi6Ixpb" /></figure><p>So we have our super secure security group that we created using Terraform, with a rule that is attached to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/0*bNkcF49HgrqfTkCn" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/0*SZ0qdPakqps-mY45" /></figure><p>As we can see in the AWS console, we have our “super secure security group” and we have our ssh rule for allowing ssh to this local network</p><p>For the sake of simplicity we are doing this demo manually here, but someone or something could change this specific super secure security group and could allow anything anywhere on any kind of networks on IPv4 etc… and name it very, very carefully “temp” <em>(you know, like those temporary rules that we’ll remember soon to change…)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*e3mq8I0r9EuUxIO1" /></figure><p>So what happened here is that something, with the correct access rights allowed anything to anywhere on this network behind this security group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*5vENU5A36ezxS8dH" /></figure><p>This team expected any kind of rules that was added or modified to be reported on terraform and <strong>while it is true for a rule it is not true for a new rule</strong> and basically the support team went weeks or months with such a rule live on their system without any notification.</p><pre>$ terraform apply<br>Apply complete! Resources: 9 added, 0 changed, 0 destroyed</pre><h4>How a scripting issue created a billing nightmare</h4><p>Our last story is about a team that was building a lot of stuff on S3. They were putting a lot of their binaries there and removing them. So obviously they removed the versioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/0*rhfg9KdWoSpggmvR" /></figure><p>For some reason (long story short) someone activated versioning on all the buckets for the company including this one but they were pretty sure that it wasn’t going to be an issue because it’s the default on Terraform to not be versioned. But the code didn’t explicitly say it so.</p><p>Let log in on the AWS console and go to S3&gt; bucket</p><p>Now we are on this bucket that we created using the terraform code above, and basically we are going do manually what they did through script: we are just going to enable bucket versioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*38DpPkyYevXkaRoo" /></figure><p>So now Bucket versioning is enabled. Let’s check with a terraform apply what was reported:</p><pre>$ terraform apply<br>Apply complete! Resources: 9 added, 0 changed, 0 destroyed</pre><p>Nothing. So this poor team versioned for weeks hundreds and hundreds of terabytes a day of binaries until they received the bill…</p><h3>Solutions at hand</h3><p>There are a lot of solutions in our ecosystem to work around the kind of things that we just saw:</p><ul><li>CI/CD Integration (Jenkins, Terraform Cloud, Atlantis, env0…)</li><li>Static Analysis (Checkov, TFLint, TFSec,…) are there to help you analyze your code before you actually push to your CI system (or if they are deploying the CI/CD systems, they are there to prevent you to push things like “allow anything to anyone” directly on the code)</li><li>Testing &amp; Verification like Terratest (written in Go), InSpec (for the “older” of us, it’s written in Ruby and comes from the Chef days).</li><li>Policy &amp; Compliance (Sentinel…) They are a very different set of tools, very cool and very protective.</li></ul><h3>Enters driftctl</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwAgdgAATX6-qMz5VvHBRQ.png" /></figure><p>That’s where drift control enters: we built driftctl to manage this drift and be alerted on all the discrepancies between the state and the reality on the AWS accounts.</p><p>Let’s just use the same terminal and the same session that we had previously. drift control will basically report you all the changes that you could not see with terraform plan or a terraform apply .</p><pre>$ driftctl scan --from tfstate://./s3/terraform.tfstate --from tfstate://./vpc/terraform.tfstate --from tfstate://./iam/terraform.tfstate<br>Terraform provider initialized (name=aws, alias=us-east-1)<br>Terraform provider initialized (name=aws, alias=eu-west-3)<br>Terraform provider initialized (name=aws, alias=eu-north-1)</pre><pre>Found deleted resources:<br> - Table: rtb-0c5a9bb483ee6eaaf, Destination: <a href="https://www.google.com/url?q=http://10.0.1.0/24&amp;sa=D&amp;source=editors&amp;ust=1614683869756000&amp;usg=AOvVaw3mt8mKEET3obX8AAtRPp5D">10.0.1.0/24</a></pre><pre>Found unmanaged resources:<br>  aws_security_group_rule:<br>  - Type: ingress, SecurityGroup: sg-0746ca93f95fcc338, Protocol: All, Ports: All, Source: ::/0<br>  - Type: ingress, SecurityGroup: sg-0746ca93f95fcc338, Protocol: All, Ports: All, Source: <a href="https://www.google.com/url?q=http://0.0.0.0/0&amp;sa=D&amp;source=editors&amp;ust=1614683869756000&amp;usg=AOvVaw2umDoMvApX_SsgfP22bUtn">0.0.0.0/0</a><br>  aws_iam_access_key:<br>  - AKIASBXWQ3AYRSNQN5EY (User: INTERN-8mszmf)</pre><pre>Found drifted resources:<br>  - AKIASBXWQ3AYWWYX72GX (User: INTERN-8mszmf) (aws_iam_access_key):<br>     ~ Status: &quot;Active&quot; =&gt; &quot;Inactive&quot; (computed)</pre><pre>Found 26 resource(s)<br>- 84% coverage<br>- 22 covered by IaC<br>- 3 not covered by IaC<br>- 1 deleted on cloud provider<br>- 1/22 drifted from IaC</pre><p>Now, we can see the rules that allowed “anything to anywhere” on IPv4 and IPv6 and we know that there are rules that were not expected. <br>We also have the policy attachment of that intern we talked about.</p><p>So probably with your eyes of administrative people, DevOps, whatever you are, it doesn’t match. It should ring a bell that something is wrong here actually: what about this new access key? Even if you’re not a security person, if you have a new access key created out of nowhere, reported to you, this should ring a bell.</p><p>Let’s go ahead and create a new bucket and call it “Fosdem 2031”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*ij6dA0duDjHPGFUi" /></figure><p>Obviously this bucket is not in Terraform because we just created live on the console. It’s perfectly normal for Terraform not to report you that this specific bucket was created right now. But this is the job of driftctl to report that you have <strong>both unmanaged resources that were created and deltas from managed resources</strong>.</p><pre>$ driftctl scan --from tfstate://./s3/terraform.tfstate --from tfstate://./vpc/terraform.tfstate --from tfstate://./iam/terraform.tfstate<br>Terraform provider initialized (name=aws, alias=us-east-1)<br>Terraform provider initialized (name=aws, alias=eu-west-3)<br>Terraform provider initialized (name=aws, alias=eu-north-1)</pre><pre>Found deleted resources:<br>  aws_route:<br>  - Table: rtb-0c5a9bb483ee6eaaf, Destination: <a href="https://www.google.com/url?q=http://10.0.1.0/24&amp;sa=D&amp;source=editors&amp;ust=1614674194048000&amp;usg=AOvVaw3D80Zc5czyA8iDpAvb61zo">10.0.1.0/24</a></pre><pre>Found unmanaged resources:<br>  aws_s3_bucket:<br>  - fosdem2031<br>  aws_security_group_rule:<br>  - Type: ingress, SecurityGroup: sg-0746ca93f95fcc338, Protocol: All, Ports: All, Source: ::/0<br>  - Type: ingress, SecurityGroup: sg-0746ca93f95fcc338, Protocol: All, Ports: All, Source: <a href="https://www.google.com/url?q=http://0.0.0.0/0&amp;sa=D&amp;source=editors&amp;ust=1614674194048000&amp;usg=AOvVaw00rswNHGCuK2ZVSP4oVZAl">0.0.0.0/0</a> <br>  aws_iam_access_key:<br>  - AKIASBXWQ3AYRSNQN5EY (User: INTERN-8mszmf)</pre><pre>Found drifted resources:<br>  - AKIASBXWQ3AYWWYX72GX (User: INTERN-8mszmf) (aws_iam_access_key):<br>    ~ Status: &quot;Active&quot; =&gt; &quot;Inactive&quot; (computed)</pre><pre>Found 27 resource(s)<br>  - 81% coverage<br>  - 22 covered by IaC<br>  - 4 not covered by IaC<br>  - 1 deleted on cloud provider<br>  - 1/22 drifted from IaC</pre><p>Let’s focus on the VPC here: if we change an existing rule…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*xw2hTIo_tIXse2KV" /></figure><p>… we can see it in the diffs in driftctl</p><pre>$ driftctl scan --from tfstate://./s3/terraform.tfstate --from tfstate://./vpc/terraform.tfstate --from tfstate://./iam/terraform.tfstate</pre><pre>Terraform provider initialized (name=aws, alias=us-east-1) <br>Terraform provider initialized (name=aws, alias=eu-west-3) <br>Terraform provider initialized (name=aws, alias=eu-north-1)</pre><pre>Found deleted resources:<br>  aws_route: <br>  - Table: rtb-0c5a9bb483ee6eaaf, Destination: 10.0.1.0/24</pre><pre>Found unmanaged resources: <br>  aws_s3_bucket: <br>  - fosdem2031<br>  aws_security_group_rule: <br>  - Type: ingress, SecurityGroup: sg-0746ca93f95fcc338, Protocol: All, Ports: All, Source: ::/0 <br>  - Type: ingress, SecurityGroup: sg-0746ca93f95fcc338, Protocol: All, Ports: All, Source: 0.0.0.0/0<br>  aws_iam_access_key: <br>  - AKIASBXWQ3AYRSNQN5EY (User: INTERN-8mszmf)</pre><pre>Found drifted resources:<br>  - AKIASBXWQ3AYWWYX72GX (User: INTERN-8mszmf) (aws_iam_access_key): <br>    ~ Status: &quot;Active&quot; =&gt; &quot;Inactive&quot; (computed)<br>  aws_S3_bucket: <br>    -fosdem2031</pre><pre>Found 14 resource(s)<br>- 50% coverage<br>- 7 covered by IaC <br>- 4 not covered by IaC <br>- 1 deleted on cloud provider <br>- 1/14 drifted from IaC</pre><p>The other things we can do with drift control is ignore some resources that you do not want to see reported for whatever reason you have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*SxZ0PKLSoL-XTP3F" /></figure><p>So you can also filter using the same system as AWS CLI. For example, you can filter just for S3 buckets if you are not interested in the rest.</p><pre>$ driftctl scan --filter &quot;Type==&#39;aws_s3_bucket&#39;&quot;</pre><pre>$ driftctl scan --from tfstate://./s3/terraform.tfstate --from tfstate://./vpc/terraform.tfstate --from tfstate://./iam/terraform.tfstate --filter &quot;Type==&#39;aws_s3_bucket&#39;&quot;<br>Terraform provider initialized (name=aws, alias=us-east-1)<br>Terraform provider initialized (name=aws, alias=eu-west-3)<br>Terraform provider initialized (name=aws, alias=eu-north-1)</pre><pre>Found unmanaged resources:<br>  aws_s3_bucket:<br>   — fosdem2031</pre><pre>Found 2 resource(s)<br>– 50% coverage<br>– 1 covered by IaC<br>– 1 not covered by IaC<br>– 0 deleted on cloud provider<br>– 0/1 drifted from IaC</pre><p>It’s pretty cool for auditing purposes, for monitoring purposes etc…</p><h3>And that’s a wrap!</h3><p>Thank you very much for reading through all this talk transcript.<br>If you wish to gain a better understanding of driftctl, please visit our <a href="https://driftctl.com/product">product page</a> or our <a href="https://driftctl.com/advanced-tutorial">advanced tutorial</a>. We also have a series of short <a href="https://driftctl.com/product/demo-videos/">demo videos</a> that you can watch to get started in minutes.</p><p>For any questions, feel free to open a discussion on GitHub or visit us <a href="https://driftctl.com/d">discord</a>.</p><p>Driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift</strong></p><p><a href="https://driftctl.com/?utm_source=medium&amp;utm_medium=medium&amp;utm_campaign=medium">More info about us</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p>👋 <a href="https://faun.dev/join"><strong>Join FAUN today and receive similar stories each week in your inbox!</strong></a><strong> </strong>️ <strong>Get your weekly dose of the must-read tech stories, news, and tutorials.</strong></p><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬</p><figure><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cT0_laE4iPcqW1qrbstAg.gif" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a98c9c37de7" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/infrastructure-drifts-arent-like-pokemons-a98c9c37de7">Infrastructure drifts aren’t like Pokemons…</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to catch your infrastructure drift in minutes using driftctl.]]></title>
            <link>https://faun.pub/how-to-catch-your-infrastructure-drift-in-minutes-using-driftctl-d22802998b06?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/d22802998b06</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Mon, 08 Feb 2021 16:55:42 GMT</pubDate>
            <atom:updated>2021-02-09T22:40:49.553Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Learn how to use driftctl in a real-life environment, with multiple Terraform states and output filtering.</strong></p><p>Whether it’s a script gone wild, a bad API call from a trusted Lambda, or just the daily SNAFU, you want to know about the situation.<br>Driftctl will do just that. In this guide, you will learn how to use <a href="https://github.com/cloudskiff/driftctl">driftctl</a> an open source tool that tracks and warns of infrastructure drift, in a realistic real-life environment, with multiple Terraform states and output filtering. We will demonstrate how manual changes can impact drift detection and how driftctl complements Terraform plan!</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*teDmTHYfb67b7lSL" /></figure><h3>Requirements</h3><p>We recommend using an AWS account dedicated to testing.</p><ul><li>An AWS account with IAM keys (<a href="https://aws.amazon.com/">AWS Homepage</a>). See <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html">this AWS CLI documentation</a> for a quick start.</li><li>Terraform 0.14.x (<a href="https://www.terraform.io/downloads.html">download link</a>)</li><li>Driftctl (<a href="https://github.com/cloudskiff/driftctl">github</a>)</li><li>Example Terraform code for this lab (<a href="https://github.com/cloudskiff/driftctl-advanced-aws-tutorial">here</a>)</li></ul><h3>Create a test AWS environment</h3><p>Clone the example Terraform code and execute it with Terraform. This Terraform configuration will simply create a VPC and a basically locked down security group.</p><p><em>Disclaimer: we used simple Terraform resources using the AWS provider: we did not try to create the most advanced, useful or complete Terraform configuration.</em></p><pre>$ git clone <br>git@github.com:cloudskiff/driftctl-advanced-aws-tutorial.git<br>$ cd driftctl-advanced-aws-tutorial</pre><p><a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html">Export your AWS variables</a> (or AWS_ACCESS_KEY_ID / AWS_SECRET_KEY pair):</p><pre>$ export AWS_PROFILE=&quot;your-profile&quot;</pre><p>Initialize both Terraform environments : app_env_1 &amp; app_env_2</p><pre>$ cd app_env_1<br>$ terraform init<br>[...]<br>Terraform has been successfully initialized!</pre><p>Run Terraform:</p><pre>$ terraform apply<br>[...]<br>Apply complete! Resources: 4 added, 0 changed, 0 destroyed.<br>$ cd ..</pre><p>Do the same for the second environment:</p><pre>$ cd app_env_2</pre><pre>$ terraform init<br>[...]<br>Terraform has been successfully initialized!</pre><pre>$ terraform apply<br>[...]<br>Apply complete! Resources: 4 added, 0 changed, 0 destroyed.<br>$ cd ..</pre><p>Congrats, your AWS account now includes:</p><ul><li>A VPC with a random name (from app_env_1)</li><li>A security group with a single rule (from app_env_2)</li></ul><h3>An overview of driftctl scanning options</h3><p>As of this writing, driftctl can scan for AWS resources and complement Terraform in drift detection. More providers are on their way!</p><p>Using driftctl, you can:</p><ul><li>Select one or multiple Terraform states, locally or on S3 (with --from &lt;statefiles&gt;)</li><li>Ignore some resources or fields by design (filling the .driftignore)</li><li>Filter the output to choose only some resources or tags (with --filter &lt;expression&gt;)</li><li>Format the output for readability or further processing (with --output &lt;format&gt;)</li></ul><h3>Driftctl with multiple local Terraform states</h3><p>The small lab we created above is simulating 2 different “environments” (in real life it can be different applications, environments, or teams), with distinct Terraform states.</p><p>If we run driftctl with a single state, resources from the other state will be detected as drifts, or more precisely, unmanaged resources, which is not true and not what we want.</p><p>Here’s how to use driftctl with multiple states:</p><pre>$ driftctl scan <strong>--from</strong> tfstate://./app_env_1/terraform.tfstate <strong>--from</strong> tfstate://./app_env_2/terraform.tfstate<br>Scanning AWS on region: us-east-1<br>Found 3 resource(s)<br>- 100% coverage</pre><h3>Create a Security Group drift and catch it</h3><p>Let’s manually add a rule to the security group we created, so we can detect it using driftctl:</p><ol><li>Go to the <a href="https://console.aws.amazon.com/vpc/home?#securityGroups:">VPC Security Group</a> in the AWS console.</li><li>Select the security group named “Super Secure Security Group”</li><li>Click on “Edit inbound rules” in the “Inbound rules” tab</li><li>Click on “Add Rule”</li></ol><ul><li>Select “All Traffic”, from “Anywhere”, add a random description</li><li>Click on “Save Rules”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*cz3Vxg_PRK3g6e_M" /></figure><p>Run Terraform from the folder where the security group is managed and confirm it doesn’t catch the manual change:</p><pre>$ cd env_app_2<br>$ terraform apply<br>aws_security_group.supersecure: Refreshing state... [id=sg-0d04a4ce8ff6a74d3]<br>aws_security_group_rule.supersecure_sg_rule_1: Refreshing state... [id=sgrule-1254751605]<br>Apply complete! Resources: 0 added, 0 changed, 0 destroyed.</pre><p>Now run driftctl again:</p><pre>$ cd ..<br>$ driftctl scan --from tfstate://./app_env_1/terraform.tfstate --from tfstate://./app_env_2/terraform.tfstate<br>Scanning AWS on region: us-east-1<br><strong>Found unmanaged resources:<br>aws_security_group_rule:<br>- sgrule-619247160 (Type: ingress, SecurityGroup: sg-0d04a4ce8ff6a74d3, Protocol: All, Ports: All, Source: ::/0)<br>- sgrule-1309243877 (Type: ingress, SecurityGroup: sg-0d04a4ce8ff6a74d3, Protocol: All, Ports: All, Source: 0.0.0.0/0)<br></strong>Found 5 resource(s)<br>- 60% coverage<br>- 3 covered by IaC<br>- <strong>2 not covered by IaC<br></strong>- 0 deleted on cloud provider<br>- 0/3 drifted from IaC</pre><p>Holy cow, driftctl caught the drift!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*teDmTHYfb67b7lSL" /></figure><h3>Ignore resources with .driftignore</h3><p>In many cases, you’ll want driftctl to ignore some resources forever, to stop being notified about their existence, and also stop lowering the coverage score. Those reasons can include the very IAM key you use to run this lab (by definition it can’t be in this Terraform repo), resources that can’t or won’t be managed by Terraform, resources managed from teams sharing the same AWS account but not using Terraform, some legacy resources, or simply manual tests running a bit longer than expected. This is exactly the same approach as the usual .gitignore : you simply add to this file all the resources you want to be ignored.</p><h3>Create an unmanaged S3 bucket, catch it, ignore it.</h3><p>To proceed with this step:</p><ol><li>Go to the <a href="https://console.aws.amazon.com/s3">S3 dashboard</a></li><li>Manually create an S3 bucket that you’ll name however you like</li></ol><p>Obviously, as this is completely done outside of its control, this bucket can’t be detected as a drift by Terraform, so we’re in the dark, as expected.</p><p>Confirm driftctl detects the manually created bucket:</p><pre>$ driftctl scan --from tfstate://./app_env_1/terraform.tfstate --from tfstate://./app_env_2/terraform.tfstate<br>Scanning AWS on region: us-east-1<br>Found unmanaged resources:<br>[...]<br>aws_s3_bucket:<br>- randomBucket514<br>[...]</pre><p>Open the .gitignore file at the root of the repository, where we execute driftctl and add a line like aws_s3_bucket (in my case: aws_s3_bucket.randomBucket514) Now run driftctl again:</p><pre>$ driftctl scan --from tfstate://./app_env_1/terraform.tfstate --from tfstate://./app_env_2/terraform.tfstate<br>[...]</pre><p>Now the manually created S3 bucket is ignored forever!</p><h3>Output filters for better accuracy</h3><p>It’s often helpful to be able to filter the output dynamically, to see results only for one type of resource (like only IAM users) or a specific tag (like only a specific environment).</p><p>Filtering in driftctl is implemented as in the AWS CLI: you won’t be lost! (hint: it’s JMESPath).</p><p>Let’s filter only VPC resources:</p><pre>$ driftctl scan --from tfstate://./app_env_1/terraform.tfstate --from tfstate://./app_env_2/terraform.tfstate <strong>--filter &quot;Type==&#39;aws_vpc&#39;&quot;<br></strong>Scanning AWS on region: us-east-1<br>Found 1 resource(s)<br>- 100% coverage<br>Congrats! Your infrastructure is fully in sync.</pre><p>Let’s now filter only for anything matching the “app_env_1” <em>“Environment”</em> tag on EC2:</p><pre>$ driftctl scan --from tfstate://./app_env_1/terraform.tfstate --from tfstate://./app_env_2/terraform.tfstate <strong>--filter &quot;Attr.Tags.Environment == &#39;app_env_1&#39;&quot;<br></strong>Scanning AWS on region: us-east-1<br>Found 1 resource(s)<br>- 100% coverage<br>Congrats! Your infrastructure is fully in sync.</pre><p>You now can collect data only for the exact setup you want! Perfect for those reports</p><h3>JSON output manipulation</h3><p>We’ve covered driftctl human-readable output, but it’s also often useful to process it further. That’s why driftctl can output to JSON!</p><p>Here’s how to generate a JSON file directly:</p><pre>$ driftctl scan --from tfstate://./app_env_1/terraform.tfstate --from tfstate://./app_env_2/terraform.tfstate <strong>--output json://driftctl.json</strong></pre><p>Take a look at the generated JSON file:</p><pre>$ cat output.json<br>{<br>  &quot;summary&quot;: {<br>  &quot;total_resources&quot;: 5,<br>  &quot;total_drifted&quot;: 0,<br>  &quot;total_unmanaged&quot;: 2,<br>  &quot;total_deleted&quot;: 0,<br>  &quot;total_managed&quot;: 3<br>  },<br>[...]<br>$</pre><p>Now you can process this file using a processor like jq, for example, to catch only the coverage percentage and maybe send it to a database, from which a graph can be generated:</p><pre>$ jq &#39;.coverage&#39; <strong>&lt; driftctl.json<br></strong>60</pre><p>The possibilities are now endless!</p><h3>Shutting down the lab</h3><p>Don’t forget to destroy the resources we created for this lab:</p><pre>$ cd app_env_2; terraform destroy<br>$ cd ../app_env_1; terraform destroy</pre><p>Delete the S3 bucket you randomly created and your AWS account is now as clean as before.</p><h3>Recap</h3><p>We covered a lot in this advanced tutorial:</p><ul><li>We used driftctl in combination with multiple Terraform state files.</li><li>We detected manual drifts from Terraform-managed resources as well as entirely unmanaged resources.</li><li>We manipulated driftctl output to ignore and filter resources based on type or tags.</li><li>We used and processed driftctl JSON output.</li></ul><p>Driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift</strong></p><p><a href="https://driftctl.com/?utm_source=medium&amp;utm_medium=medium&amp;utm_campaign=medium">More info about us</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p>👋 <a href="https://faun.dev/join"><strong>Join FAUN today and receive similar stories each week in your inbox!</strong></a><strong> </strong>️ <strong>Get your weekly dose of the must-read tech stories, news, and tutorials.</strong></p><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬</p><figure><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cT0_laE4iPcqW1qrbstAg.gif" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d22802998b06" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/how-to-catch-your-infrastructure-drift-in-minutes-using-driftctl-d22802998b06">How to catch your infrastructure drift in minutes using driftctl.</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Driftctl]]></title>
            <link>https://cloudskiff.medium.com/announcing-driftctl-a7e8fd6e59d6?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7e8fd6e59d6</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Tue, 12 Jan 2021 16:38:58 GMT</pubDate>
            <atom:updated>2021-01-12T16:38:58.801Z</atom:updated>
            <content:encoded><![CDATA[<h4>because drift matters</h4><h4>We recently released the first versions of <a href="https://driftctl.com/2020/12/22/announcing-driftctl/?utm_source=medium">driftctl</a>, a new open-source project for infrastructure developers, DevOps, SRE, and cloud practitioners, with the goal of helping manage all kinds of drifts.</h4><h4>Why? Because infrastructure is a living thing and changes are risky.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ny_KFROCzB5nW7OJ-BOR3A.png" /></figure><p>In the team, we all managed cloud infrastructures at some level at our previous jobs, as developers with serverless function needs or DevOps managing large production systems. And we all knew that sometimes an emergency required a manual change, a customer tweaked a setting on the console, the boss activated something that had an impact later…or put more simply, that the whole infrastructure was just not totally under control by Terraform (or similar tool), just because ops life in production is rarely perfect and ideal.</p><p>And all those tiny changes sometimes got forgotten about, or partially implemented in infrastructure-as-code later on, unfortunately leading to security issues, unstable environments, failed deployments, unexpectedly important bills. And thus this makes us lose the advantages of IaC.</p><h3>Keeping infrastructures secure &amp; in sync with code.</h3><p>Like many of you, we use and love infrastructure-as-code, and especially Terraform, and for years we relied on its features to ensure the coherence of our infrastructures (most of us ended up with terraform plan in crontabs or in CI, expecting that return code 0 would ensure a fully synchronized infrastructure!).</p><p>While Terraform is excellent at provisioning cloud infrastructures, telling you about changes in your AWS account is not where it shines, mainly because it’s simply not its job.</p><p>Until now, to be sure that no change happened in your infrastructure, it implied an excellent level of trust in your tools and dependencies, a very stable IaaS provider, every single resource in every region carefully described in Terraform, then the revocation of all admin credentials of your team (and we really think this is as bad for developers’ sense of ownership and empowerment as it is deeply against DevOps culture), most of the time strong CI/CD pipelines and processes, usage of compliance and policy tools, regular auditing, and probably more great ideas to slow down teams velocity.</p><p>But that was clearly not the reality we experienced daily out there! That was often either the goal to reach someday, or a naive belief from management when the team knew very well how to work their way around. But most of the time, credentials were passed around in the team, many resources were still not in Terraform, processes were not perfect, people sometimes forgot to push their locally applied changes, changes happened outside of Terraform, emergencies had to be dealt with quickly (and usually not in Terraform!), consultants came and went, projects were still handed over to customers and no one had time or money to implement complex policies (not to mention that not everyone requires the hassle of PCI/DSS compliance).</p><p>And yet, absolutely no one had a good overview of how good or bad things were, easily, so as to take action at some point.</p><p>Hope is not a strategy and…that’s why we built driftctl. Driftctl is like your IaC security belt!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*XqY0KoZTK62Eu2e7339oTg.png" /></figure><p>Hope is not a strategy and…that’s why we built driftctl. Driftctl is like your IaC security belt!</p><h3>Driftctl — a new open-source project to help you monitor IaC changes.</h3><p>We built driftctl to help developers know when things change on their IaaS, whatever reason it does, and give them a good overview of their infrastructure-as-code coverage.</p><p>This tool is open-source at its core (Apache-2.0 license) and we decided to release driftctl very early, so we can gather feedback sooner than later and prioritize accordingly. Also, by building this tool publicly from the beginning, we hope that many users will contribute ideas, suggestions, and maybe some code early on.</p><p>The initial releases are focusing on detecting drift on AWS and on Terraform support. Future releases will add support for a lot more, but we didn’t want to wait to release this early. Those releases support what we thought were the most common services on AWS, and this was also backed with hours of interviews with DevOps practitioners around the world those last months. So we started with EC2, S3, IAM, RDS and Lambda, and we’re already working on supporting VPC, CloudFront, Aurora, DynamoDB, API Gateway, SNS/SQS, ECS/EKS/ECR, or KMS. The coming weeks will be exciting!</p><p>We also included in the first release a view of your cloud / IaC coverage, so you can quickly know with simple data if your IaaS account is more or less under control with Terraform. Also, if that percentage decreases, it means something changed outside of Terraform! The human-readable output can be switched to JSON if you want to process it.</p><p>Early on, we realized that for our own usage, this wasn’t enough: our own AWS accounts were filled with temporary tests, IAM roles, etc., and even our pretty much ideally locked down and mostly automated production account had a few manual resources (like the initial IAM user!). The output was deceptive as it included a lot of garbage we knew of but couldn’t do anything about. So we also added to the first release two different ways to ignore drifted resources, so you can start fresh with a clean output and start from there.</p><p>This is a community project, and this is the first step in our mission to build an open-source suite of tools to protect codified infrastructures, so definitely feel free to give us a shout to prioritize another service or resource: <a href="https://github.com/cloudskiff/driftctl">open a GitHub issue or discussion</a>, and we’d love to chat with you on <a href="https://discord.gg/eYGHUa75Q2">our Discord</a>. Come say Hi!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7HsMxfKuWLy4vPGwAnoKaA.png" /></figure><h3>Getting Started</h3><p>Let me show you how to quickly get started with driftctl, once downloaded from <a href="https://github.com/cloudskiff/driftctl/releases">https://github.com/cloudskiff/driftctl/releases</a> . We’ll start with the most simple case where you have the Terraform state locally available (beware, usually not a good practice!).</p><p>First, export your AWS environment variables as usual:</p><pre>$ export AWS_PROFILE=”my-aws-profile” <br>$ export AWS_REGION=”us-east-1”<br>$ driftctl scan <br>Scanning AWS on region: us-east-1<br>Found unmanaged resources:<br>  aws_iam_access_key:<br>    - AKIASBXWQ5ATWVVI7REW<br>[...]<br>Found 18 resource(s)<br> - 22% coverage<br> - 4 covered by IaC<br> - 14 not covered by IaC<br> - 0 deleted on cloud provider<br> - 0/4 drifted from IaC</pre><p>Now, you probably follow good practices and don’t store your state locally or on git but on S3. Here’s how it would work:</p><pre>$ driftctl scan --from tfstate+s3://acmecorp/states/terraform.tfstate<br>[...]</pre><p>Maybe, also as a good practice, you used tags extensively on your AWS resources, so you’d like driftctl to scan only for the Environment: Production key and value?</p><pre>$ driftctl scan --filter &quot;Attr.Tags.Environment == &#39;Production&#39;&quot;</pre><p>Alternatively, you can exclude some resources directly in the .driftignore file (if you want to ignore the “terraform” IAM user, simply add a line containing aws_iam_user.terraform). Obviously, at any time, you can check the help by executing driftctl scan help.</p><p>This is only a quick introduction, a lot more details are included in the Github documentation: <a href="https://github.com/cloudskiff/driftctl/tree/main/doc">https://github.com/cloudskiff/driftctl/tree/main/doc</a>.</p><p>We really hope driftctl will find its place in your DevOps toolbox, and that you’ll join us on GitHub and on Discord to make it even better soon!</p><p>driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift</strong></p><p><a href="https://driftctl.com/?utm_source=medium&amp;utm_medium=medium&amp;utm_campaign=medium">More info about us</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7e8fd6e59d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why you should take care of infrastructure drift​]]></title>
            <link>https://faun.pub/why-you-should-take-care-of-infrastructure-drift-7e3e719277db?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e3e719277db</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Tue, 24 Nov 2020 13:29:09 GMT</pubDate>
            <atom:updated>2020-12-17T10:20:39.933Z</atom:updated>
            <content:encoded><![CDATA[<p>When talking about infrastructure drift, you often get knowing glances and heated answers. Recording gaps in your infra between what you expected to be and the reality of what is, is a well known and widespread issue bothering hundreds of DevOps teams around the globe. Interesting to note though, is that depending on their context, the exact definition they will give of drift will vary.</p><p>Facing impacts and consequences ranging from intensive toil to dangerous security threats, many DevOps teams are keenly aware of the issue and actively looking for solutions.</p><p>We decided to look more closely into how they deal with it and conducted a study that will be released in the coming weeks. Here is a foretaste of this study, outlining some of the key facts we recorded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*jIPN6B1o1E4_ywKDNOQk8A.png" /></figure><h3>How infrastructure drift is becoming a major issue: a combination of growing volume and automation</h3><p>The ever-growing amount of workloads running in the cloud has gone hand in hand with a similarly growing number of people interacting with infras, themselves working with several environments.</p><p>In this context, as Infrastructure as Code becomes widely adopted by users with heterogenous skillsets, the IaC codebases become larger, mechanically fueling daily occasions to create drift and making it harder to track.</p><h3>The various definitions and core causes of infrastructure drift</h3><p>Drift is a multi-faceted problem, let’s agree on a definition.</p><p>Indeed, depending on their context and process (or lack thereof) people will tend to stress one specific aspect of drift or another when prompted on a definition. Typically, some people will tend to relate drift to the lack of consistency between, say staging and production environments, which might be true, but incomplete.</p><p>Still, most of the people we talked to define infrastructure drift as an <em>“unwanted delta”</em> recorded between their Infrastructure codebase and the actual state of their infras.</p><p>Drift can be driven by human input, poor configuration, applications making unwanted changes, etc. It has consequences on toil and efficiency, forces teams to put in place strict controls that decrease flexibility, and can have a security impact.</p><p>Two of the most common causes of drift are linked with process or workflow issues, like manual changes in a cloud console not being transposed as code, or changes applied to some environment but not propagated to others. Obviously, those issues become more and more complex as the number of environments and team members grows. Some teams have dozens of environments that they need to keep updated.</p><p>Much more surprising though is the fact that what we call API-driven drift is a widespread issue. API-driven drift happens when an update from an application or a script calling a cloud provider API (or a Terraform provider), autonomously and directly impacts your actual state. In this case, you&#39;ve just lost consistency with your codebase, and you won&#39;t be aware of it until some random apply reveals a problem that might end up taking a couple of hours to fix. This happens even on the cloud provider&#39;s side. One of the people we talked to told us of the time he suddenly got locked out of Azure because of a default machine authentication parameter updated from true to false .</p><h3>The impacts of infrastructure drift</h3><p>Maintaining a solid and reliable source of knowledge of how your cloud resources are organized certainly is important, but at the end of the day, you might simply think of infrastructure drift as a mere annoyance not worth the effort.</p><p>While drift mostly causes additional work, it also triggers severe security issues too. In one of our interviews, a DevOps lead analyzed the problem quite clearly: “<em>every drift event causes uncertainty, a resolution time, and a potential security issue”</em>. Willingly or not, a developer can do a lot with IAM keys and an SDK. Especially a junior one. Being able to catch bad decisions quickly and reverse your situation back to normal is crucial.</p><p>There are also more subtle effects of drift, especially on efficiency. To avoid excessive drift, some teams make significant adjustments to their workflows. In some teams, only the DevOps team lead is allowed access to production. In others where developers are not skilled at IaC, getting a small change to environments done goes through a painful and long ticketing system. In other words, drift causes issues, which leads to rigid/counterproductive processes, which leads to a decrease in speed and flexibility.</p><h3>How teams solve drift so far</h3><p>Whatever the maturity level of a team and the degree of automation of their cloud infrastructures, maintaining reliability and security while moving at developers speed implies tracking down inconsistencies, like infrastructure drift.</p><p>The faster it is detected, the easier it is to remediate drift, which is why many DevOps we interviewed had a terraform plan in a cron job.</p><p>Most teams will explain that to tackle drift, the first thing they did was restrict access to production to a few team members. That certainly contains the problem but does not solve staging environments drift, as only a smaller part of teams restrict access to staging environments. Following through with that, deploying a full GitOps workflow will prevent some of the drift, but not all of it (not the API-driven events for example) and is still pretty hard to do by the book in practice when there is an urgent issue to solve on the production environment and MTTR is key for the business.</p><h3>Why we think infrastructure drift should be addressed with a better solution</h3><p>We recently caught an excellent Twitter thread about the various impacts of fast and slow-moving broken stuff. Infrastructure drift might not be considered a fast-moving broken thing. This is maybe all the more dangerous as sometimes you just can’t get anyone to pay attention to slow-moving broken things because what harm could that iceberg do?”*</p><p>Analyzing what solutions are deployed against drift in over 100 teams led us to discover how poorly the topic is addressed. Stay tuned if you’d like to see how we intend to bring an open-source solution to this issue.</p><p>driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift</strong></p><p><a href="https://driftctl.com/?utm_source=medium&amp;utm_medium=medium&amp;utm_campaign=medium">More info about us</a></p><p><em>Originally published at </em><a href="https://driftctl.com/2020/11/24/infrastructure-drift/"><em>https://driftctl.com</em></a><em> on November 24, 2020.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*VumdMBRWZsLW6Bz6tqU8mg.png" /></figure><p>driftctl is a <strong>free and open-source</strong> CLI that <strong>tracks, analyzes, prioritizes, and warns of infrastructure drift.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p>👋 <a href="https://faun.dev/join"><strong>Join FAUN today and receive similar stories each week in your inbox!</strong></a><strong> </strong>️ <strong>Get your weekly dose of the must-read tech stories, news, and tutorials.</strong></p><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬</p><figure><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cT0_laE4iPcqW1qrbstAg.gif" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e3e719277db" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/why-you-should-take-care-of-infrastructure-drift-7e3e719277db">Why you should take care of infrastructure drift​</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage multiple Terraform environments]]></title>
            <link>https://faun.pub/manage-multiple-terraform-environments-c696f84a3687?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/c696f84a3687</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 14:54:55 GMT</pubDate>
            <atom:updated>2020-07-02T12:19:13.053Z</atom:updated>
            <content:encoded><![CDATA[<h4>How do you start managing several Terraform environments?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wBxzhDtrOVYQJkhcf-YXBw.jpeg" /><figcaption>source: Hashicorp</figcaption></figure><p>The need to manage multiple Terraform environments is very common. Indeed, getting started is one thing but then you end up with various environments that you need to manage, several teams, etc… So how do you manage terraform when you start having several environments like dev, staging, prod, and how do you manage the complexity?</p><h3>Manage multiple Terraform environments​ : getting started with TF Files</h3><p>If you need to manage several Terraform environments, there are a lot of ways to ramp up your approach and get started.</p><p>Getting started step by step with single tf files. The task can be daunting to know all the good practices at first, and probably you might get at best distracted, and at worse discouraged. So you can get started very naively with one single tf state. Create a simple Terraform file, call it production.tf, write your VPCs, your VMs or whatever in it. Very soon you will be able to create another environment. Let’s call it staging.tf. It is going to be still a single tf state file which is not bad, but it won’t scale. But that’s one way to start doing it step by step.</p><h3>Terraform workspaces</h3><p>The Hashicorp Terraform main recommendation is to use what they call now workspaces. workspaces is a Terraform subcommand. It was previously named environments.</p><p>The goal of workspaces is to separate one tfstate file per environment. So let’s say you have a QA or a staging and a production environment: using that Terraform workspace subcommand, will switch tfstates. That is the recommended way to do things by Hashicorp, but it does not mean that you have to do it exactly that way.</p><h3>Use folders in your Git repo</h3><p>Another way to do it is to split your state files not using workspaces but basically using folders. Just create folders in your git repo, give each folder a name, like staging and production and just generate different tfstate files from those folders. It’s really easy, and then then you are already using splits environments “TFstate-wise”.</p><h3>Modules: a common way of managing Terraform environments</h3><p>Using modules is kind of becoming a standard now. It is a bit advanced, but modules basically work by injecting variables in them like strings, etc… They are a very handy feature for Terraform.</p><p>Modules contain generic code. Let’s take a standard vpc as an example. This VPC can take several values like the subnetwork and a name. What you can do basically, is create two folders, one for each environment and your first Terraform file will just specify what address space your staging vpc will have, while the other will have another address space. So you solve that issue just by injecting different values in modules.</p><p>So that would be the main way I would suggest using environments.</p><p>Just get started easily, naively with a single TF state, create different folders, split the states by folders, use modules inject different types of values in them, or basically just stick to what Hashicorp suggests, like use workspaces.</p><h3>Organize your resources and define your directory layout</h3><p>The last thing to consider is how you will organize your resources and directory layout. Would you use one or several repos? etc..</p><p>There is no one answer to that, but one common set up is to have your modules handled separately and called from a single repository. Let’s take an example: if you have a module that knows how to properly configure a vpc from two variables, then you have some proper Terraform code. This code can be stored in a distinct Terraform git repo, managed, versioned and released like any other project. But still, it cannot be used “as is”. You still need your infra repo to call this module, a bit like you would do with a standard library in engineering.</p><p>For some people, the folder hierarchy matters too. It’s very common to see test folders for all the testing, separate folders for the modules, and other folders for the environments as well.</p><p>One last common pattern that I think of, is the use of variables files with all the different kinds of values you can have so that environments can be sent to the execution using those environment variables.</p><p><strong>CloudSkiff is an Infrastructure as Code that allows </strong>Terraform automation and collaboration for growing teams.<br><a href="https://cloudskiff.com/manage-multiple-terraform-environments/?utm_source=Medium&amp;utm_medium=Manage%20multiple%20environments&amp;utm_campaign=medium"><strong>Join our Beta here</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*-Vb5CXecRO7May4txjsTYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Subscribe to </strong><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumprebanner"><strong>FAUN topics</strong></a><strong> and get your weekly curated email of the must-read tech stories, news, and tutorials </strong>🗞️</p><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬</p><figure><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cT0_laE4iPcqW1qrbstAg.gif" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c696f84a3687" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/manage-multiple-terraform-environments-c696f84a3687">Manage multiple Terraform environments</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to type variables in Terraform?]]></title>
            <link>https://faun.pub/how-to-type-variables-in-terraform-ed18afaabd95?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed18afaabd95</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Mon, 22 Jun 2020 15:36:23 GMT</pubDate>
            <atom:updated>2020-06-22T16:37:25.397Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to type Terraform variables? Declaring strings, lists, booleans, and objects within your Infrastructure code is possible and will save you from many mistakes. Here’s our take on how to deal with it.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcGpxr9h0Gxnl1X7c3xQYQ.png" /><figcaption>This article is a transcript from a video interview series: <a href="https://www.youtube.com/channel/UCqUCM6vQKkq08amsqf_vKzg/">Ask Me Anything on Infrastructure as Code</a> with the Author of “Infrastructure as Code — Cookbook”</figcaption></figure><h3>How to type variables in Terraform?</h3><p>People often ask: can you, and should you declare variables in Terraform?</p><p>One of the biggest issues I had in my “Chef” days was that I could multiply strings by booleans which used to create very nice issues in production.</p><p>So, yes you can type variables in Terraform. Let me show you an example :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcGpxr9h0Gxnl1X7c3xQYQ.png" /></figure><p>To go a little higher in Terraform notions, you need to declare a variable. For example here, the first one is the Azure region for Azure, but it can be a public key, or whatever… But this declaration is not where the variable is used. It is just a declaration. You can omit the type, so you’re not forced to do it but it’s highly recommended, though.</p><p>In this declaration, you can have several items, like a description, so you and all your team members know directly what it is about, you can have a default value, you can have a boolean, a string, a map, and you can even have an object with whatever you want in it.</p><p>For example, you can have an object with strings, lists, and booleans in it. So let’s say for example, that your variable is composed of a boolean, like true, an IP address, and an SSH Key. Then this variable is always going to be checked for this same combination of elements.</p><p>The idea here is to ensure that you don’t mess with what’s expected. It’s very common that you declare your variables, but it’s not there that they are used.</p><p>Let’s take for example this network address space in the network resource. The address space here is set as network address space but could be declared in the terraform.tfvars to be overridden.</p><pre>variable &quot;network_address_space&quot; {<br>default = [&quot;10.0.0.0/16&quot;]<br>description = &quot;Virtual Network Address Space&quot;<br>type = list<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fx-pQWpuAQKz5iOB9Q06lg.png" /></figure><p>You can either apply this as it is, and it’s going to work because it’s declared as a list, or you can decide that you want to override this volume here in the tfvar with something that really looks like a network address space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*priz9mpum1CgDdd8m1Ospw.png" /></figure><p>You can check it with a terraform init command. terraform init by the way inits all your dependencies like all the providers all the modules etc …</p><p>Typically, this could be a source of error. Let’s explain in some details :</p><p>Azure virtual network requires an address space to be a list. This is something that I noticed when reading the documentation but I could forget about it in the future, or one of my fellow team members could make a mistake because it’s not documented enough. So I could just write “beware it’s a list” or whatever, but it’s much better to do using code.</p><p>By ensuring the type list is written, any apply on a future mistake won’t work.</p><p>So the question was: “Should I type my variables?” The answer is: “Hell yes!” and it’s going to save your “ass” really often because we all make mistakes.</p><p>Seriously it really looks weird on Azure that a network address needs to be a list (I would make subnets a list or whatever) but I would never think about this to be a list so you can make an error.</p><p>Maybe you want to answer true or false as a string and you shouldn’t.</p><p>Maybe you expect numbers because this variable is mapped to something else, like the result of an API or whatever… and it’s supposed to be an integer and let’s say it works all the time except the day it returns an error which is a string and you probably don’t want to have a count value of error in your code. You want to ensure that the string is a string, or the expected number is a number or the boolean is the correct answer or you can have a very bad time.</p><p>So please type your variable. It’s very easy and it is all documented on the Terraform website.</p><p><strong>CloudSkiff is an Infrastructure as Code that allows </strong>Terraform automation and collaboration for growing teams.<br><a href="https://cloudskiff.com/how-to-type-variables-in-terraform/?utm_source=Medium&amp;utm_medium=how-to-type-variables-in-terraform"><strong>Join our Beta here</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*-Vb5CXecRO7May4txjsTYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Subscribe to </strong><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumprebanner"><strong>FAUN topics</strong></a><strong> and get your weekly curated email of the must-read tech stories, news, and tutorials </strong>🗞️</p><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬</p><figure><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cT0_laE4iPcqW1qrbstAg.gif" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed18afaabd95" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/how-to-type-variables-in-terraform-ed18afaabd95">How to type variables in Terraform?</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Code Quality]]></title>
            <link>https://faun.pub/terraform-code-quality-66e6468f50f3?source=rss-a0713349ea37------2</link>
            <guid isPermaLink="false">https://medium.com/p/66e6468f50f3</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Driftctl]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 14:24:50 GMT</pubDate>
            <atom:updated>2020-06-23T15:53:19.233Z</atom:updated>
            <content:encoded><![CDATA[<h4>Key Steps to a good quality for your Infrastructure Code.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*uAo_l1Wc-6-tk0iPoCrJ-A.png" /><figcaption>This article is a transcript from a talk held at the London Cloud Native Computing Foundation Meetup.</figcaption></figure><p>Terraform code quality is important and there are a lot of tools to improve it. A lot of them are quite difficult to use. Here are a few tools that we find really useful and can be set up in minutes for you.</p><h3>Terraform code quality starts by the basics with Terraform Validate</h3><p>Terraform works with providers for each cloud and has resources. Basically, you can see it as an instance to launch in which you describe what you want. Let’s see how internal tools can help you improve your Terraform code quality.</p><p>Terraform validate is a subcommand in Terraform that will only address structure and coherence, which means that an obviously bad code like this one will be perfectly right in the eyes of Terraform :</p><pre>provider &quot;aws&quot; {<br>  region = &quot;BOGUS&quot;<br>}</pre><pre>resource &quot;aws_bogus_resource&quot; &quot;vm&quot; {<br>  ami                    = &quot;BOGUS&quot;<br>  instance_type          = &quot;BOGUS_TOO&quot;<br>  vpc_security_group_ids = [&quot;123456789&quot;]<br>  key_name               = &quot;BOGUS&quot;<br>  tags = {<br>    Name      = &quot;CNCF London Meetup&quot;<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*yb-jw3-hJI3OCf9uT8iiNw.png" /></figure><p>The only way Terraform validate will be useful for you, is if you request a bad resource or if you make a typo in a variable or that kind of thing. This command is not really useful to improve the quality or the security of your infrastructure code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*JbgaWcK-kAgOQ24TwioJQg.png" /></figure><h3>Terraform code quality has to be tested using the right Terraform version</h3><p>The second basic thing we wanted to cover is the Terraform version: as we know, developers build their code based on specific versions.</p><p>In this case Terraform added some features like the support for Tencent Cloud storage or trim functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*xyq0BdZO3WnNOuy_4cf-EQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*Jx-bLtzLOHHuduCtkeemKg.png" /></figure><pre>terraform {<br>  required_version = &quot;= 0.12.21&quot;<br>  required_providers {<br>      aws    = &quot;= 2.62&quot;<br>      random = &quot;~&gt; 2.2&quot;<br>      }<br>}</pre><p>Putting tests in a CI/CD system without the correct version of Terraform will end up with a fail while your code is perfectly correct. <br> <br>TFEnv is a very useful tool to have here. It is inspired by rbenv (for all the Ruby users that know this tool). Basically this tool ensures that you are testing the correct code using the correct version of Terraform, which is very handy because managing dozens of versions in your CI/CD system is a real pain and managing them by hand or with docker is just a loss of time.</p><p>But you have to keep in mind that this tool does not improve the quality of your Terraform code. It just brings you a standard ability to test it.</p><p>It will allow you to start building step by step a matrix of Terraform versions for your infrastructure code. We all have customers using older versions than ours or production environments slightly differing from our dev or staging environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*-u-tJztTWsqkvJrtx0TnWA.png" /></figure><p>You can find TFEnv at <a href="https://github.com/tfutils/tfenv">https://github.com/tfutils/tfenv</a></p><h3>How static checks can help you improve your Terraform code quality</h3><p>Drilling down to other tools with statics checks, TFLint is the first one really worth mentioning. Let’s go back to our first example where we requested a bogus AMI with a bogus instance type with obviously a highly unlikely security group ID, etc…</p><pre>provider &quot;aws&quot; {<br>  region = &quot;BOGUS&quot;<br>}</pre><pre>resource &quot;aws_bogus_resource&quot; &quot;vm&quot; {<br>  ami                    = &quot;BOGUS&quot;<br>  instance_type          = &quot;BOGUS_TOO&quot;<br>  vpc_security_group_ids = [&quot;123456789&quot;]<br>  key_name               = &quot;BOGUS&quot;<br>  tags = {<br>    Name      = &quot;CNCF London Meetup&quot;<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*Tg7rP0n-j1OqZReo2ZfwEg.png" /></figure><p>By executing TFlint, you will statically analyze your code and see that this instance type is not valid. This tool might not cover everything but a simple execution will already bring you an improvement and allow you instantaneously to catch typos and mismatches.</p><p>But TFLint does a lot more and goes way further than a static test. TFlint also has a deep check ability, and using your credentials it will ask the Cloud provider API if the AMI you requested exists.</p><p>Even better! It will do the same for the security group ID and also check for your ability to use it. Indeed: maybe the security group ID you requested does exist but not in your account, and in this case, your code is perfectly correct but you do not have the right to use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*r6oreqZ5ZQ6p4joi9My8Eg.png" /></figure><p>Using that kind of tool you can start improving the quality of your code because you will not push and apply stuff that seems correct but is in fact not usable or painfully wrong in production.</p><p>TFLint also helps with reviews: If you are working with a team, you probably do pull requests to review your infrastructure code. Let’s imagine that someone in your team requested a T1 micro. What you, as a reviewer would probably suggest your coworker is: <em>“t1 is a bit old. The performances are terrible and the cost is higher than a t3 micro today. You probably do not want to use that. Please change your instance type.”</em></p><pre>resource &quot;aws_instance&quot; &quot;cncf-example&quot; {<br>  instance_type = &quot;t1.micro&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*PnMrx8GOcTurFz-kVQaddQ.png" /></figure><p>The tool here will do it automatically for you if you insert it directly on the pull request in your CI/CD system. It will save you a lot of time.</p><p>It can enforce best practices as well. As you know, you can type your variables in Terraform and define them as strings , booleans , arrays … and add descriptions, etc… It is probably your role as a reviewer to check for variable types and descriptions and say: <em>“ Hello, you forgot to type your variables. You should type it.”</em></p><pre>variable &quot;foo&quot; {<br>  default = &quot;bar&quot;<br>  # type    = string<br>  # description = &quot;i&#39;m a major variable&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*-hfzwoyq93flL2x1HVJsNw.png" /></figure><p>So same here: you can enforce that best practice directly from the pull request using TFLint. It just takes seconds and will already bring you value from something that was quite easy to deploy for you.</p><p>TFLint works with a lot of things from Terraform directly: configuration, requirements, pinned versions…. AWS and Azure (through a plugin). GCP support is coming soon and you can find it at <a href="https://github.com/terraform-linters/tflint">https://github.com/terraform-linters/tflint</a></p><p>Let’s move on to a second tool now: TFSec. It will perform statics checks like TFlint, but the focus is more on security issues and is positioned very early in the process.</p><p>Put yourself in the situation where someone in your team is making a pull request like this: <em>“here’s my secret key”</em> or <em>“I have a variable named password and that’s its default value”</em>. Probably you would comment on this pull request with something like: <em>“Hmmm… are you sure?”</em></p><pre>provider &quot;aws&quot; {<br>  region         = &quot;eu-central-1&quot;<br>  aws_access_key = &quot;12345&quot;<br>  aws_secret_key = &quot;s3cr3t&quot;<br>}</pre><pre>variable &quot;password&quot; {<br>  default = &quot;sup3rs3cr3t&quot;<br>}</pre><p>Problem solved with TFSec. This tool is going to do the job for you and the user will have feedback immediately directly on the pull request. So you will gain a lot of time and the code will improve by itself. Your developer will learn on the job just by getting feedback not from you but from tools that enforce what you anyway wanted in the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*EcFgi13veIU8ybGVAm0hBg.png" /></figure><p>Let’s take a more complex example: imagine that I don’t know how to create an AWS S3 bucket. So I asked it on Reddit and Reddit it gives me four lines that perfectly work. My next step would be to send them to my pull request and my boss might just read the pull request and say: “<em>OMG! You just created a bucket with public read/write. Where did you find this code? On Reddit??? …”</em> TFSec would catch that directly and provide you with direct feedback.</p><pre>resource &quot;aws_s3_bucket&quot; &quot;example_from_reddit&quot; {<br>  bucket = &quot;my-secret-bucket&quot;<br>  acl    = &quot;public-read-write&quot;<br>  Tags = {<br>      Name = &quot;my secret S3 bucket&quot;<br>  }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*bVcLvG2a_t3EbEyz9tmtVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*eEqWKX5C5I_mYsewcLH4KQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*lRxl303JTSV1Hpk37OzTOw.png" /></figure><p>Again, very obvious mistakes can be corrected directly, just right at the pull request stage. Some would even like to put this earlier on the process, like directly on the developer&#39;s laptop, but you can hardly force developers to configure their pre-commit hooks on laptops…</p><p>But that’s the easy part….</p><p>What about logging? Following my previous example, with TFSec I just discovered that S3 had logging enabled. So far, I did not know that I could encrypt objects in my S3 buckets. So right now, I started with only three or four lines of code and I end up with a properly secured bucket with an encrypted configuration. So once again, through this tool, in just a couple of seconds, you add a lot of value and your developer learned a lot of things and will not make this mistake again. His/Her next bucket will be securely created.</p><pre>resource &quot;aws_s3_bucket&quot; &quot;example_from_reddit&quot; {<br>  bucket = &quot;my-secret-bucket&quot;<br>  acl    = &quot;private&quot;<br>  server_side_encryption_configuration {<br>    rule {<br>      apply_server_side_encryption_by_default {<br>        kms_master_key_id = aws_kms_key.mykey.arn<br>        sse_algorithm     = &quot;aws:kms&quot;<br>      }<br>    }<br>  }<br>  logging {<br>    target_bucket = &quot;my-logging-bucket&quot;<br>    target_prefix = &quot;log/&quot;<br>  }<br>  tags = {<br>    Name = &quot;My Secret S3 Bucket&quot;<br>  }<br>}</pre><p>TFSec works for Terraform on AWS, Azure, and GCP and you can find it at <a href="https://github.com/liamg/tfsec">https://github.com/liamg/tfsec</a></p><h3>Terraform code quality: checking for compliance</h3><p>So far, we talked about the initial steps, with a very static analysis and we got a bit further with TFLint by asking the API for real IDs, checks for reality, etc…</p><p>So if you’re familiar with Terraform after this analysis step, you have the planning phase. The planning phase basically just creates all your code, a diff, and checks against the cloud provider’s API for what you are supposed to create. If you want to create a new S3 bucket, and you don’t have it, then it is going to make a plan to create it. Your next steps will be to review the plan and then to apply it to create that resource.</p><p>At this stage, you might want to enforce some compliance with a tool creatively named Terraform compliance.</p><p>Quickly making a digression here, if you’re not familiar with the cucumber BDD (behavior-driven development) structure: it implies features name, a scenario and conditions :</p><ul><li>Given <strong><em>“blah blah blah”</em></strong> you are expected to have “<strong><em>this result</em></strong></li></ul><p>This is executed in the background by some code, and will then provide you with some results. The BDD system is very useful to code, but in this case, it is used for compliance using natural language.</p><p>In our case, if we take the previous example, we could have written something like that and it would have been perfectly supported by Terraform compliance against the plan.</p><pre><strong>Given</strong> I have AWS S3 Bucket defined<br><strong>Then</strong> it must contain server_side_encryption_configuration</pre><p>Let’s be more specific :</p><pre>resource &quot;aws_s3_bucket&quot; &quot;example_from_reddit&quot; {<br>  bucket = &quot;my-secret-bucket&quot;<br>  acl    = &quot;private&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*rtoDezkJr6FPgdAPhTC22w.png" /></figure><p>In this case, we created this bucket but we didn’t create a tag. We might have a process where it is very important that all our resources have tags. So we can write something very easy like this scenario :</p><pre>Feature: All Resources</pre><pre>    Scenario: Ensure all resources have tags<br>        Given I have resource that supports tags defined<br>        Then it must contain tags<br>        And its value must not be null</pre><p>Why is that?</p><p>You can create a tag with a variable, and it might work all the way through the previous steps but not just this one, because the variable went wrong. Maybe it was supposed to be a number and it ended up being null?</p><p>During the planning phase, there is some computation, and this computation can go wrong. This is why compliance checks are very important now that things are computed and not just statically analyzed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*AuIj8e7e0mTfZ6JLDRAzAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*7hVtNca5D_gNmdzc0o44qA.png" /></figure><p>Integrating those checks and their feedback in your CI/CD system (in a pull request) will give you a much better view of what your code is really doing compliance-wise.</p><p>Terraform compliance is a provider agnostic tool, including your own custom providers. There are a lot of ready to use examples and you really can get started in minutes just by using the examples they serve directly on the documentation. It is obviously security-oriented by all the usual suspects, like KMS etc….</p><p>This tool also has cool features like allowing you to enforce naming conventions. Probably you want to enforce naming for various items like your country, your continent, resources… and here prefixes can be self-documented and forbidden resources as well.</p><p>In the case you need to be PCI DSS compliant, you might just be forbidden to use a list of resources at AWS that are not PCI compliant. This can be done at the compliance level way before asking the IAM user on AWS for your rights to use resources.</p><p>You can find Terraform compliance at <a href="https://terraform-compliance.com/">terraform.compliance.com</a></p><h3>Don’t forget to perform integration tests to improve your Terraform code quality.</h3><p>In between the planning and the verification phases come all <a href="https://cloudskiff.com/terraform-code-testing/">integration tools</a>. We won’t spend much time reviewing them as this is not our focus here, but Terratest from Gruntwork is one of them. It is a very powerful tool but very complicated to use. Terratest is basically a GO library in which you include your code and just manipulate Terraform programmatically using pure GO. It is highly powerful. It will allow you to do absolutely anything you want with it but it is also quite complicated to use.</p><p>Maybe you know other systems like Goss or even ServerSpec, ChefSpec etc… As they are quite compact and a lot of things are taken care of for you, they are easy to use because. In the case of Terratest you need to do everything by yourself. The framework is here to provide you with tools using a language.</p><h3>Verification checks: the last step towards Terraform code quality.</h3><p>And now we can skip directly to verification and focus on a tool named InSpec.</p><p>Although it is originally from the Chef guys it is not related to Chef, but rather to Serverspec, Rspec, and “whatever Spec” has been around for the past years testing server things using Rspec, and it is really complete as you will see.</p><p>The first question we need to answer is why would we need to validate what we just launched?</p><p>Because a lot of things can go wrong the correct way: let’s say we launched a simple EC2 instance in a VPC using a security group with a mix of the usual things like dynamic names and tags etc… Everything went right: it has been tested right, it has been planned right and it has been applied correctly as well.</p><p>As you see, that’s a very simple code that executed it: there is a data source (a data source is simply a request on the cloud provider’s API), a global variable that can be overridden. There is a simple internal lookup for another resource on your Terraform code, and a local variable.</p><pre>resource &quot;aws_instance&quot; &quot;vm&quot; {<br>  ami                    = data.aws_ami.amazon-linux.id<br>  instance_type          = var.instance_type<br>  vpc_security_group_ids = [aws_security_group.allow_ssh.id]<br>  key_name               = aws_key_pair.admin.key_name<br></pre><pre>  tags = {<br>    Name      = local.vm_name,<br>    Terraform = &quot;true&quot;<br>  }<br>}</pre><p>There are a lot of ways this whole mix can look right in the static analysis and in the compliance as well, but turn out to be not what you expected: for example, maybe the AMI returned exists and is correct but it is not the one you expected, or this instance type by default was something like a t3 small for example and you thought it was overridden by your value and it wasn’t… This is why checking for reality is very important and why validation exists.</p><p>So how does it work?</p><p>It is based on simple expectations, and you can inject dynamic content straight from the Terraform state using a mix of dynamic information and static information like t3 nano versions, strings , boolean or whatever…</p><pre>describe aws_ec2_instance(EC2_INSTANCE_ID) do<br>    it { should be_running }<br>    its(&#39;instance_type&#39;) { should eq &#39;t3.nano&#39; }<br>    its(&#39;security_groups&#39;) { should include(id: EC2_SG_ID, name: &#39;allow_ssh&#39;) }<br>    its(&#39;tags&#39;) { should include(key: &#39;Terraform&#39;, value: &#39;true&#39;) }<br>end</pre><pre>describe aws_security_group(group_name: &#39;allow_ssh&#39;) do<br>    it { should exist }<br>    its(&#39;group_name&#39;) { should eq &#39;allow_ssh&#39; }<br>    its(&#39;vpc_id&#39;) { should eq VPC_ID }  <br>end</pre><p>As it is really readable, it doesn’t require a high level of coding skills. You can get started very easily and immediately gain a lot of value from it. There are a lot of situations and locations in the code where things could have gone wrong, and now you can check it directly from the Terraform state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*kb025BgtUNCxon5Pm7RYiw.png" /></figure><p><a href="https://cloudskiff.com/how-to-manage-terraform-state/?utm_source=Medium&amp;utm_medium=TerraformCodeQuality">If you’re not familiar with what a </a><a href="https://cloudskiff.com/how-to-manage-terraform-state/?utm_source=Medium&amp;utm_medium=TerraformCodeQuality">state is in Terraform</a>, it is the last thing that you get after the application phase. So once you apply your code on your Cloud provider, you will get back a list of values that you could not have known about beforehand.</p><pre>output &quot;public_ip&quot; {<br>  value = aws_instance.vm.public_ip<br>}</pre><pre>output &quot;vpc_id&quot; {<br>  value = data.aws_vpc.default.id<br>}</pre><pre>output &quot;ec2_instance_id&quot; {<br>  value = aws_instance.vm.id<br>}</pre><pre>output &quot;aws_security_group_id&quot; {<br>  value = aws_security_group.allow_ssh.id<br>}</pre><p>For example, you might not know what your VPC ID is, but what you want to know is if you use the default one. You can get this right from the state with InSpec.</p><p>InSpec is a really powerful tool for that kind of checks, for AWS, GCP, Azure, Digital Ocean, and much more. It has hundreds of checks and inside each check, you can have a multitude of sub-checks for each and every component of your cloud systems and even for operating systems. For example, there are hundreds of checks for every kind of Linux flavor you can imagine and even Windows.</p><p>You can find InSpec at <a href="https://www.inspec.io/">inspec.io</a></p><h3>Wrap up</h3><p>Whether you are just getting started with Terraform or if you are an experimented infrastructure as code user, it is very easy to get more value by basically at least using the correct version of Terraform and staying up to date.</p><p>Linting your code, checking for security, compliance, and validity will help you improve your Terraform code quality very easily from hundreds of different resources and cloud providers.</p><p><strong>CloudSkiff is an Infrastructure as Code that allows </strong>Terraform automation and collaboration for growing teams.<br><a href="https://cloudskiff.com/terraform-code-quality/?utm_source=Medium&amp;utm_medium=TerraformCodeQuality"><strong>Join our Beta here</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*-Vb5CXecRO7May4txjsTYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Subscribe to </strong><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumprebanner"><strong>FAUN topics</strong></a><strong> and get your weekly curated email of the must-read tech stories, news, and tutorials </strong>🗞️</p><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬</p><figure><a href="https://www.faun.dev/join?utm_source=medium.com/faun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cT0_laE4iPcqW1qrbstAg.gif" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66e6468f50f3" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/terraform-code-quality-66e6468f50f3">Terraform Code Quality</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>