<?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 Brandon Bjelland on Medium]]></title>
        <description><![CDATA[Stories by Brandon Bjelland on Medium]]></description>
        <link>https://medium.com/@brandonjbjelland?source=rss-329eac143260------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MBjECupbeIiHtJqYNEltgA.jpeg</url>
            <title>Stories by Brandon Bjelland on Medium</title>
            <link>https://medium.com/@brandonjbjelland?source=rss-329eac143260------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 13:25:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brandonjbjelland/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[Introducing GCP Cloud Deploy Extensions]]></title>
            <link>https://medium.com/computeclub/introducing-gcp-cloud-deploy-extensions-18c294d17ecc?source=rss-329eac143260------2</link>
            <guid isPermaLink="false">https://medium.com/p/18c294d17ecc</guid>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[cloud-deploy]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <dc:creator><![CDATA[Brandon Bjelland]]></dc:creator>
            <pubDate>Fri, 24 Feb 2023 23:03:44 GMT</pubDate>
            <atom:updated>2023-02-25T00:23:23.992Z</atom:updated>
            <content:encoded><![CDATA[<p>TL;DR: <a href="https://github.com/computeclub/gcp-cloud-deploy-extensions">GCP Cloud Deploy extensions</a> is an OSS project giving engineers a framework to build custom functionality on top of the fledgling Cloud Deploy product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bkzTufZ8f7WHra4b" /><figcaption>Photo by <a href="https://unsplash.com/@spacex?utm_source=medium&amp;utm_medium=referral">SpaceX</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Continuous Integration, Continuous Delivery, and Continuous Deployment are crucial pillars of modern software engineering. As best practices evolve and new methods become better understood (most recently, GitOps) new tools continue to spin out of the growing needs of organizations. Let me bring you up to speed on the latest in this space from Google Cloud.</p><p>Until recently, Google Cloud Platform had <a href="https://cloud.google.com/build">Cloud Build</a> as its primary means of both building and delivering software but those tasks have distinct characteristics. While possible to use a tool like Cloud Build to do it all, in many ways it’s less than ideal — it was never meant to be a tool to orchestrate deployments across multiple environments, against many targets, and easily driven by non-engineers. Perhaps most importantly, it’s tricky follow a release as it travels through a promotion pipeline —deep product familiarity and some duct tape is very much required 🦆 Enter a new contender to the Continuous Delivery and Deployment space: <a href="https://cloud.google.com/deploy">Google Cloud Deploy</a>!</p><p>Google Cloud Deploy is a powerful new product for automating application deployments in Google Cloud and beyond. Its slick UI, opinionated deployment flow, and robust permissions model makes it an exceptional tool for understanding and managing releases. However, as it’s a fledgling product, I’m left wanting more functionality than the initial offering provides. Thankfully, Cloud Deploy is built to be extended and the optional PubSub service notifications provide the interface we need to roll up our sleeves and start customizing based on Cloud Deploy emitted events. Reading these docs and feeling motivated to n̶e̶v̶e̶r̶ ̶d̶e̶p̶l̶o̶y̶ ̶J̶e̶n̶k̶i̶n̶s̶ ̶a̶g̶a̶i̶n̶ make the product work for my customers is how GCP Cloud Deploy Extensions was born.</p><p>GCP Cloud Deploy Extensions is an open source project that provides a set of extensions to help you customize and enhance your deployments based on lifecycle events of a release. These extensions are designed to be easy to use, secure, and configurable to your situation. Brainstorming a few potential use cases:</p><ol><li>As a release manager, I want to be notified via a messenger system (Teams, Slack, Google Chat) when a release is waiting for my approval.</li><li>As an engineer, I want to be notified when builds fail.</li><li>As anyone who cares about an application, I value its uptime and want automated rollbacks to occur if release verification steps fail.</li><li>As an engineer, I want a record of which container images were released to what deployment targets. It would be great if this were captured as tags in the Artifact Registry.</li><li>As an engineer, I want releases to upper environments to be automatically promoted when a lower environment rollout succeeds. This should not override mandatory approval steps.</li></ol><p>GCP Cloud Deploy Extensions currently covers two of these (image-tagger and release-auto-promoter) and provides a Python library for quickly building your own extension. The code is open source and contributors are welcome to submit PRs of their own extensions. While the current extensions are written in Python using the <a href="https://fastapi.tiangolo.com/">fastapi</a> framework, anything you can pack into a docker container will work. Extensions run on Cloud Run and scale to zero when not executing.</p><p>Cloud Deploy is a fast moving product that will likely fill some of these gaps over the coming months but in the meantime extensions provide a powerful way make Cloud Deploy work for your organization today. Your feedback is welcome (comments here, issues on the repo, PRs are open to contributors). Here’s what’s next for the project:</p><ol><li>expand on the documentation by providing diagrams</li><li>build more extensions in more languages</li><li>improve code quality, expand on tests</li><li>write follow up blog posts covering design decisions, the tools, and showcasing the end-to-end demo.</li></ol><p>Disclaimer: gcp-cloud-deploy-extensions is not an official Google supported project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18c294d17ecc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/computeclub/introducing-gcp-cloud-deploy-extensions-18c294d17ecc">Introducing GCP Cloud Deploy Extensions</a> was originally published in <a href="https://medium.com/computeclub">computeclub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An unintentional love letter to Microsoft]]></title>
            <link>https://brandonjbjelland.medium.com/an-unintentional-love-letter-to-microsoft-6955ad5a39ac?source=rss-329eac143260------2</link>
            <guid isPermaLink="false">https://medium.com/p/6955ad5a39ac</guid>
            <category><![CDATA[product]]></category>
            <category><![CDATA[love-letters]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[workplace-culture]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Brandon Bjelland]]></dc:creator>
            <pubDate>Tue, 08 May 2018 08:57:37 GMT</pubDate>
            <atom:updated>2018-05-10T06:38:53.424Z</atom:updated>
            <content:encoded><![CDATA[<p>This post started as <a href="https://medium.com/run-at-scale/vscode-terraform-37121ee0e737">a plug for my VSCode extension</a> and quickly spiraled into something else entirely. Oops! It was fun to write so I’ll hit publish anyway.</p><p>Story time: I moved to Seattle a decade ago <strong>knowing </strong>I’d <strong>never</strong> work for Microsoft. How could I be so sure? I was guided by one question: How could I (and why would I) work for a company whose products left a bad taste in my mouth time and time again? It was a no-brainer: Redmond wouldn’t be for me.</p><p>As a budding Operations Engineer with a solid Linux foundation, Microsoft products were many things: closed-source, somewhere between hard and impossible to automate, on-prem-oriented, and seemingly flaky in operation. Worse, everywhere I looked, Microsoft was mostly interested in marketing me certification over opportunity to experiment. Yuck! Every part of this was polar opposite to what I wanted to work with and where I wanted to steer my career —namely, working with public cloud infrastructure, automating the repetitive, leveraging and creating open-source software, and connecting small, purpose-built, and loosely-coupled components where possible. The Linux maxims had taken hold early and still course through my veins today.</p><p>I’ve been fortunate over the past decade to work with several great engineers from all sorts of backgrounds, some who had worked for Microsoft and others had extensive experience with their products. I maintained some distance from the products but still kept an open mind and ear to these perspectives. I learned that SQLServer was beloved by a rather strong contingent of developers. As config management matured, I heard rumblings of Chef making strides integrating with Window’s Desired State Configuration. Skip ahead a few years and Azure began to scrape its way to what is today a respectable cloud offering and an undeniably valuable tool in the belt of the DevOps engineer in 2018.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*qs25ZIa2w1DeI8ff-Bz31g.jpeg" /></figure><p>The chips continue to stack: <a href="https://www.typescriptlang.org/">Typescript</a> — now a few years old — has successfully gained traction and provided some sanity in the otherwise insane world of JavaScript. A super-set of JS, the type safety, tooling, and compatibility with all modern ESx flavors makes for probably the best way to write JavaScript without writing JavaScript today. Bravo, Microsoft; <strong>that</strong> is a feat!</p><p>Another wake up call came as I shopped around for a new editor about a year ago, having used <a href="https://atom.io/">Atom</a> for some time and vim for an eternity before that. I trialed Sublime, gave a run with cloud9, but eventually landed on <a href="https://code.visualstudio.com/">Visual Studio Code</a>. By the results of <a href="https://insights.stackoverflow.com/survey/2018#development-environments-and-tools">last year’s stack overflow developer survey</a> says I’m in good company — 2018 marks the first year the editor is crowned king in this survey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*3qd6r5cRZgpq5t93txuk4Q.png" /></figure><p>To no one’s surprise, both TypeScript and VSCode are open source and easily a part of the massive open source movement now at MS. The 2017 github contribution statistics by company tell the story:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kfr2Me896ahd0TmQCVvRCw.png" /></figure><p>Fast forward to a month ago, my 2013 MacBook Pro — the same beloved model you may also be clutching for dear life— shows all new signs nearing end-of-life. Apple’s flagship laptop hardware has fallen flat for developers in recent years, and having used one recently on a project, I could confirm — it’s not the machine I wanted to drop $2,000+ on. I poured over reviews of Windows laptops, gathered opinions from peers, and researched the hell out of the Windows Linux Subsystem (WSL) before taking the leap to the Surface Book 2 I write this on today. The machine is solid, capable, and a delight to work with. Communicating ideas through touchscreen tools on the same machine I write code on is 100% a game changer.</p><p>A key justification for me getting the SB2 was coming half way with the potential developers I’d be working with on future projects. To have lived the experience of development within Windows brings me that much closer to devs in Windows-native shops. Isn’t that at the essence of DevOps? I’ll be the first to admit, it’s still not a perfect machine, but WSL is easily good enough to move the vast majority<strong> </strong>of my development over. Working locally with Docker, Kubernetes, and Serverless emulation have been the stickiest parts I’ve encountered, but this is somewhat expected since we’re talking about the bleeding edge and only a fraction of what I work on day-to-day.</p><p>I’ve broadly brushed on product until this point, and while I’m not on the corporate inside, I’d be a fool to neglect the real source of change in Redmond: the people and the culture underpinning the products. If you’re paying attention to this space whatsoever, you’re almost certainly familiar with one or more community heroes on the <a href="https://developer.microsoft.com/en-us/advocates/index.html">Cloud Developer Advocate team</a>. That roster reads something like the <a href="https://en.wikipedia.org/wiki/1996_United_States_men%27s_Olympic_basketball_team">1996 USA Olympic men’s basketball dream team</a>. Huge kudos for attracting some the very top talent and voices in the industry today. This gang is a smart, diverse, outspoken, and friendly bunch. Stacking a publicly facing team like this is incredibly important and Microsoft has done it exactly right. I hope this public posture genuinely reflects the nature of internal groups that enjoy less spotlight.</p><p>Two weeks ago at DevOpsDays Seattle, <a href="https://www.devopsdays.org/events/2018-seattle/speakers/sam-guckenheimer">Sam Guckenheimer</a> stood on stage and confirmed, in detail, the nuts and bolts of how they executed on what’s described above — Microsoft under Satya Nadell is a radically different company than it was 10 years ago. Newer employees are incredibly happy, service ownership is taken seriously, build system unification was treated as critical, there’s a renewed focus on the customer, and open-source is at the strategic core. In short, products are reflecting the cultural excellence and vigilance to rethink how products are built. I think it’s finally safe to say: Microsoft is dead. Long live Microsoft.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlC78DlMj4Wk9tVj9ICLIQ.png" /></figure><p>I’m still less than a year into the full-contact sport of contract work and freelancing in the DevOps space. Running a business, building a client pipeline, interviewing clients while they interview me, negotiating frequently, assessing a variety of technical problems rearing familiar heads, establishing trust, pairing, mobbing, educating, and doing it all again at an accelerated pace— there’s no shortage of interesting business problems to solve and clients to delight in this space. I’ll be here for as long as it’s fun and interesting but in the meantime, keep doing you Microsoft. I — not unlike you — have changed tune over the past decade and just might end up meeting you somewhere down the road.</p><p><em>Thanks for reading! I’m Brandon, founder and engineer of </em><strong><em>Run at Scale</em></strong><em>. I help organizations build out </em><strong><em>industrial-grade Internet plumbing</em></strong><em> through DevOps methodologies, security-first design, and infrastructure tools you’ve heard of. Interested to work together? Reach me at </em><a href="/service/mailto:brandon@atscale.run?Subject=Hello%20from%20medium"><em>brandon@atscale.run</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6955ad5a39ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VSCode + Terraform = ]]></title>
            <link>https://medium.com/run-at-scale/vscode-terraform-37121ee0e737?source=rss-329eac143260------2</link>
            <guid isPermaLink="false">https://medium.com/p/37121ee0e737</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[extension]]></category>
            <category><![CDATA[software-documentation]]></category>
            <dc:creator><![CDATA[Brandon Bjelland]]></dc:creator>
            <pubDate>Tue, 08 May 2018 08:28:30 GMT</pubDate>
            <atom:updated>2018-05-15T01:10:01.153Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>Digging in Terraform documentation often? <a href="https://marketplace.visualstudio.com/items?itemName=run-at-scale.terraform-doc-snippets">This extension</a> helps keeps you in the editor instead.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5T6G20ohFsQq4XP9." /><figcaption>“Close-up of lines of code on a computer screen” by <a href="https://unsplash.com/@ilyapavlov?utm_source=medium&amp;utm_medium=referral">Ilya Pavlov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>TL;DR</strong>: I wrote a handy <a href="https://marketplace.visualstudio.com/items?itemName=run-at-scale.terraform-doc-snippets">VSCode extension</a> that gives snippets of code examples from Terraform provider documentation. Resources and data sources from all <a href="https://github.com/terraform-providers/">public Terraform providers</a> are covered. 1400+ total snippets currently shipped.</p><h3>Motivation</h3><p>I think it’s safe to crown Terraform the high queen of infrastructure orchestration today. Just writing that sentence, I hear a rattle of pitchforks from the other end of the Internet, but invite you to put your Kubernetes gardening tools back in the shed. I acknowledge k8s importance but also think it reigns supreme in slightly different categories. Let’s instead take a moment to appreciate the non-coincidences that both technologies share DNA in their underlying language (go), extensible core architectures, platform-agnosticism, and declarative orientation. They both provide the right, high-level of abstraction we’ve been chasing for the past several years of public clouds and containers.</p><p>One way I’d argue Terraform doesn’t shine quite as well as Kubernetes is its lack of portability. Yes, an intrepid engineer who knows the supported platforms of today can use Terraform across them with a familiar dialect, but the implementation details from platform to platform will always differ. As an example, you can’t forklift Terraform code specifying AWS resources and kindly ask Terraform to instantiate those same bits in Azure. This situation is unavoidable as SaaS products organize around slightly different nomenclatures and organizational boxes. Variety is a net positive in no small part because it creates differentiation in the web services marketplace. Libraries that attempt to work across the litany of clouds while forcing common nouns and verbs across each have eventually all fallen short. Stated concisely, despite trade-offs, HashiCorp has made a <strong>good </strong>design decision by embracing the varied jargon of each provider.</p><p>Still, unlike the small and excellent language underpinning Terraform, the vocabulary to build with it is enormous with a different resource or data source name mapping to basically every resource concept in each provider. Today there are <a href="https://github.com/terraform-providers">76 provider repos</a> included in the public GitHub organization. For AWS alone there are 355 distinct resources and 85 data sources. Google Cloud Platform and Azure each bring ~110 resources and ~30 data sources. These resource counts will only grow as will the ways to encode their relationships. No one should try to fit this in their head, and in practice, no one does. It’s our fate as infrastructure developers to reference documentation often, but even still, there’s got to be a better way!</p><p>I’d be remiss if I failed to acknowledge this project was inspired by a similar extension called <a href="https://marketplace.visualstudio.com/items?itemName=mindginative.terraform-snippets">Terraform Advanced Snippets</a> that brings community-defined Terraform snippets to VSCode (~550 snippets, all told). I’ve used this extension but have some issues. Namely, since the snippets are community-defined, some consistency is lost and the snippets often lack the context necessary to be immediately useful or understood. Also, the approach of handcrafting all the snippets, even as an outsourced effort, just doesn’t scale. New providers are added regularly. Existing resources change from release to release. This all smells of a problem in search of automation.</p><p>It should be obvious by now that VSCode is my (exceptionally extensible) editor of choice. Its quality speaks for itself so I won’t say any more on that front.</p><p>Finally, I’ve dabbled in JavaScript and some frameworks but hadn’t tried my hand at TypeScript with Node just yet. It’s always good to have a project in mind when exploring a language and this was a perfect opportunity as <a href="https://code.visualstudio.com/docs/extensions/example-hello-world">TypeScript is a preferred language of VSCode extensions</a>.</p><p>Summarizing the motivations:</p><ol><li>Terraform is incredibly important today and represents the highest-level of abstraction we can use to create and develop infrastructure components and their relationships across web service providers.</li><li>By design, Terraform embraces platforms bringing their terminology to their provider. This is good overall, but means a provider carries a language essentially as big as the platform itself and frequent visits to documentation for reference is necessary.</li><li>The previous extensions were somewhat useful but lacked consistency, context, and automation to be truly excellent.</li><li>I use VSCode, I love VSCode, and I’d like to make it even more useful.</li><li>An opportunity to pick up some TypeScript. Sure! Sign me up.</li></ol><h3>The solution</h3><p>Addressing the problems above, I wanted to create an extension that included snippets for as many provider resources and data sources possible straight from the documentation sources. Writing a full extension is fairly involved but luckily not so when shipping a snippet extension. A snippet extension really only ships a JSON file as the core artifact. An example snippet looks like the following:</p><pre>{<br>&quot;Print to console&quot;: {<br>  &quot;prefix&quot;: &quot;log&quot;,<br>  &quot;body&quot;: [<br>    &quot;console.log(&#39;$1&#39;);&quot;,<br>    &quot;$2&quot;<br>  ],<br>  &quot;description&quot;: &quot;Log output to console&quot;<br>  }<br>}</pre><p>With this loaded as a user-defined snippet, when you’re in a JavaScript file and begin to type log, VSCode presents you with the body of the snippet as an option. The $n entries allow you to quickly tab between sections of the body, and populate them with common text once it’s been used. Coding with the aid of templates like this is not only a huge time saver, it ensures a small level of consistency and allows us to keep less syntax in our heads.</p><p>The key feature that enabled building this extension is the documentation included in each Terraform provider’s repository. Provider docs are generally good, give the context you need to grok a resource, and will continue to get better as the underlying code evolves. I’ll happily develop an extension to piggyback on that goodness! Written in markdown and stored in the <a href="https://github.com/terraform-providers/terraform-provider-aws/tree/master/website/docs">common location</a> of $provider_repo_root/website/docs/r and $provider_repo_root/website/docs/d, documentation is formatted uniformly and simple to parse with a little help from a library.</p><p>From here, I broke down the problem and wrote small functions to:</p><ol><li>create a temporary local work space.</li><li>clone all provider repos.</li><li>iterate over all markdown files in the website/docs /r and /d directories.</li><li>from each doc file, create a snippet object, and grab the first code example.</li><li>format the object details as a snippet and write it to a global snippet object.</li><li>alphabetize by key name, otherwise randomization in processing repos makes for diffs on the same json snippet content.</li><li>write the snippet collection to file.</li><li>delete the temporary work space.</li></ol><p>With the initial bugs worked out, version 0.1.5 is able to pull all providers and ship over 1400 snippets. Here’s a quick gif demo of it in action. I’ll note that, that <a href="https://marketplace.visualstudio.com/search?term=publisher%3A%22Mikael%20Olenfalk%22&amp;target=VSCode">Mikael Olenfalk</a>’s <a href="https://marketplace.visualstudio.com/items?itemName=mauve.terraform">Terraform extension</a> is also used here. It provides the quick linking to documentation as well as syntax highlights and other frills:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9pLZMqAEipO0rrMcVWhFw.gif" /></figure><h3>Knowledge gaps and features to come</h3><p>As with any project, especially those riddled with less-familiar technology, there’s always more to improve. Here’s my shortlist:</p><ol><li>Since I’m still new to the language, I shipped this extension sans tests. 😳 When prototyping or getting familiar with a problem space, there are plenty of people who agree that TDD isn’t the best approach. I’m in this camp. Get comfortable, prototype, experiment and then go back to the drawing board to design, and practice TDD on what you’ll ship to prod. This is reasonable to me. Since the solution here is exceptionally small and simple, I’ll likely get cozy with mocha and chai in the next release to round out the quality guarantees.</li><li>C̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶ ̶i̶s̶ ̶c̶u̶r̶r̶e̶n̶t̶l̶y̶ ̶n̶o̶t̶ ̶p̶o̶s̶s̶i̶b̶l̶e̶.̶ ̶I̶n̶i̶t̶i̶a̶l̶l̶y̶,̶ ̶a̶ ̶c̶o̶n̶f̶i̶g̶.̶j̶s̶o̶n̶ ̶f̶i̶l̶e̶ ̶l̶i̶s̶t̶e̶d̶ ̶t̶h̶e̶ ̶p̶r̶o̶v̶i̶d̶e̶r̶s̶ ̶t̶o̶ ̶e̶x̶p̶l̶i̶c̶i̶t̶l̶y̶ ̶c̶l̶o̶n̶e̶ ̶b̶u̶t̶ ̶I̶ ̶d̶i̶d̶ ̶a̶w̶a̶y̶ ̶w̶i̶t̶h̶ ̶t̶h̶a̶t̶ ̶i̶n̶ ̶f̶a̶v̶o̶r̶ ̶o̶f̶ ̶q̶u̶e̶r̶y̶i̶n̶g̶ ̶t̶h̶e̶ ̶G̶i̶t̶H̶u̶b̶ ̶o̶r̶g̶a̶n̶i̶z̶a̶t̶i̶o̶n̶.̶ ̶I̶’̶d̶ ̶l̶i̶k̶e̶ ̶t̶o̶ ̶a̶l̶l̶o̶w̶ ̶c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶ ̶o̶f̶ ̶o̶v̶e̶r̶r̶i̶d̶e̶s̶ ̶a̶n̶d̶ ̶a̶d̶d̶i̶t̶i̶o̶n̶a̶l̶ ̶s̶n̶i̶p̶p̶e̶t̶s̶ ̶t̶h̶a̶t̶ ̶m̶i̶g̶h̶t̶ ̶n̶o̶t̶ ̶b̶e̶l̶o̶n̶g̶ ̶t̶o̶ ̶a̶n̶y̶ ̶p̶r̶o̶v̶i̶d̶e̶r̶.̶ ̶A̶l̶t̶e̶r̶n̶a̶t̶i̶v̶e̶l̶y̶,̶ ̶s̶o̶m̶e̶ ̶s̶n̶i̶p̶p̶e̶t̶s̶ ̶m̶i̶g̶h̶t̶ ̶b̶e̶n̶e̶f̶i̶t̶ ̶f̶r̶o̶m̶ ̶u̶s̶i̶n̶g̶ ̶t̶h̶e̶ ̶s̶e̶c̶o̶n̶d̶ ̶o̶r̶ ̶t̶h̶i̶r̶d̶ ̶c̶o̶d̶e̶ ̶e̶x̶a̶m̶p̶l̶e̶ ̶i̶n̶ ̶t̶h̶e̶ ̶d̶o̶c̶u̶m̶e̶n̶t̶a̶t̶i̶o̶n̶.̶ ̶T̶h̶e̶s̶e̶ ̶f̶e̶a̶t̶u̶r̶e̶s̶ ̶c̶o̶u̶l̶d̶ ̶a̶l̶l̶ ̶b̶e̶ ̶e̶n̶a̶b̶l̶e̶d̶ ̶t̶h̶r̶o̶u̶g̶h̶ ̶s̶i̶m̶p̶l̶e̶ ̶c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶ ̶a̶n̶d̶ ̶c̶o̶d̶e̶.̶ — Edit: configuration is now possible with overrides and manually defined snippet additions shipped in 0.2.0.</li><li>Asynchronous programming in is powerful but still feels unfamiliar and somewhat difficult to control. Once you start down the async route, everything that follows seems to require the same, creating a forward momentum that I haven’t grasped how to tame. Due to this, <a href="https://github.com/run-at-scale/vscode-terraform-doc-snippets/blob/master/src/main.ts#L18-L23">I have a hacky way of creating a stopping point</a> on snippet collection before advancing to synchronous portions. This doesn’t feel ideal. If anyone can lend a comment or a PR to clean this up, that’d be most welcome.</li></ol><p>I have a few other nitpicks but these are currently top of my list. Drop a line if you’re using the extension or have ideas on improvement. Rate the extension on the marketplace if you like it (or not if you don’t like it 😜). Don’t be shy to give a clap if you enjoyed reading about this project or find it useful.</p><p><em>Thanks for reading! I’m Brandon, founder and engineer of </em><strong><em>Run at Scale</em></strong><em>. I help organizations build </em><strong><em>industrial-grade Internet plumbing</em></strong><em> through DevOps methodologies, security-first design, and infrastructure tools like Terraform. Interested to work together? Reach me at </em><a href="/service/mailto:brandon@atscale.run?Subject=Hello%20from%20medium"><em>brandon@atscale.run</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37121ee0e737" width="1" height="1" alt=""><hr><p><a href="https://medium.com/run-at-scale/vscode-terraform-37121ee0e737">VSCode + Terraform = 💖</a> was originally published in <a href="https://medium.com/run-at-scale">Run at Scale</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform pattern: “map-list defined resources”]]></title>
            <link>https://medium.com/run-at-scale/terraform-pattern-map-list-defined-resources-54c56f8b16b7?source=rss-329eac143260------2</link>
            <guid isPermaLink="false">https://medium.com/p/54c56f8b16b7</guid>
            <category><![CDATA[application-load-balancer]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Brandon Bjelland]]></dc:creator>
            <pubDate>Fri, 23 Mar 2018 07:48:38 GMT</pubDate>
            <atom:updated>2018-12-25T17:38:04.838Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>Terraform pattern: “map-list defined resource set”</h3><h4>As demonstrated through the recently updated <a href="https://registry.terraform.io/modules/terraform-aws-modules/alb/aws/">AWS ALB module</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*17mHsNtcyCHHbrRD." /><figcaption>Photo by <a href="https://unsplash.com/@reinaldokevin?utm_source=medium&amp;utm_medium=referral">Reinaldo Kevin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The Application Load Balancer (ALB) — introduced to AWS in August 2016 — is an essential component in any AWS infrastructure engineer’s toolbox. It brings all the excellence of the Classic Elastic Load Balancer (ELB), but in climbing the network stack to the application layer, also enabled a new set of features like WAF integration, multiple target groups/listeners, and pattern-based routing all at a cheaper rate. Read more about it on the <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html">AWS docs</a> but to me it’s a no-brainer to migrate to ALB (or in some cases, NLB) if you’re still an ELB customer.</p><p>For just over a year, I’ve maintained an <a href="https://github.com/terraform-aws-modules/terraform-aws-alb">open source Terraform module</a> to ease the provisioning of ALBs. When I started the project, there was no <a href="https://registry.terraform.io/">Terraform registry</a>, high-quality open source modules were few and far between, and sound development patterns were still emerging — somewhat scattered over the Internet ether.</p><p>Having a need for ALB at Tableau and wanting to contribute to this space, I cobbled together the module using my year of Terraform experience (plus prior experience with Cloudformation) and the Internet hivemind’s collective best-practices. Shipping a modest suite of tests alongside the module (thanks, <a href="https://newcontext-oss.github.io/kitchen-terraform/">kitchen-terraform</a>!) is honestly what made the module anything notable. This allowed for faster iteration, guaranteed working examples, and better assurance that I’m really building what we purport to build. <strong>Tests are an unequivocal win for developers and consumers alike. Let’s do more of those! </strong>You don’t need me to tell you that though, right?<strong> </strong>😉</p><p>Today’s Terraform landscape is wildly different (read: better). The canonical <a href="https://www.terraformupandrunning.com/">Terraform: Up and Running</a> emerged a year ago, the tools ecosystem has grown up, Terraform has leapfrogged itself several times over, and much to my delight, I find peers in the cloud-infra engineering space also slinging tests within modules! Big ups to leaders like <a href="https://blog.gruntwork.io/@brikis98">Jim Brikman</a> and <a href="https://charity.wtf/tag/terraform/">Charity Majors</a> who blogged their ways through Terraform mastery and paved a way for others to follow.</p><p>Typically a release of the ALB (or any) module isn’t so noteworthy, but the v3.x release brings a breaking change and a fundamental shift in how related resources are created. It’s worth a quick blurb; let’s dive in.</p><p>Terraform modules all share at least a few common goals: abstract away implementation details, simplify the resource interface, and enable reusability being a few. A number of techniques make this possible: providing sane defaults, doing a narrow thing (or very limited set of things) both flexibly and extremely well, grouping resources that logically fit together as a unit. An auto scaling group without a launch configuration is a hot dog without a bun — group these resources within a module. Likewise, a VPC without subnets is as useful as a concrete buoy — again, a module to the rescue. The ALB is no exception and only realizes usefulness when attached to one or more listeners and target groups.</p><p>Prior to the v3.x releases, I assumed developers would want to drop an ALB in place of an ELB, using it more or less the same way with a single set of ancillary resources (1 target group, 1 listener, and 0 problems). This is the most common pattern you’ll find in open source modules. Even still, commenters and bug reporters asked for more. In response, for the 3.x release, target groups, listeners, and SSL certificates all become flexible inputs provided as a list()s of map()s. Let’s dive into some code snippets to try this on.</p><p>Within variables.tf — at the module root — we define 3 variables:</p><ol><li>The empty list of target_groups.</li><li>A manually provided enumeration of target_groups as target_groups_count (a known workaround because length() won’t work on the populated variable).</li><li>target_group_defaults which provides default values. This is a bit unorthodox but hang with me.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca9c2d40cf039861a1c4451d32f8f1b6/href">https://medium.com/media/ca9c2d40cf039861a1c4451d32f8f1b6/href</a></iframe><p>The main.tf below — also from the module root — contains <a href="https://www.terraform.io/docs/configuration/interpolation.html#lookup-map-key-default-">lookups</a> to the key/values of a map-defined target_group. Several of these contain a nested lookup() referencing the target_groups_defaults map so we have a fallback value where nothing is defined by the calling code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c16cb197e6b0a615455a69c39987d71/href">https://medium.com/media/7c16cb197e6b0a615455a69c39987d71/href</a></iframe><p>Still with me? One more snippet to call what we have above. When calling the module, we can now define the required key/value pairs within the target_groups local variable in a format-flexible way using a locals block. The core module is instantiated by referencing the locals at the very bottom of the module declaration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b6addc0259e916f76dd6f5a54c1765d/href">https://medium.com/media/8b6addc0259e916f76dd6f5a54c1765d/href</a></iframe><p>The snippet above is what a module consumer/user would create. The rest of the code, they don’t really need to worry about, but they should confirm that the defaults match what they need. What this produces when applied is two nearly identical target_groups (foo and bar) defined (both as HTTP listeners on 80 and 8080, respectively) through very minimal config. Listeners can now point to foo elsewhere in similar constructs through its index of 0. Excellent, right?!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F26ufdipQqU2lhNA4g%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F26ufdipQqU2lhNA4g%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbzBkeGo2cXg5NGVxMHUwYmFveHFpYno2dXN4c2JyeGQwb2hnbXAwMSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F26ufdipQqU2lhNA4g%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/51c6cb04afdff7c8e872534125f37288/href">https://medium.com/media/51c6cb04afdff7c8e872534125f37288/href</a></iframe><p>What’s novel here? Nesting data structures — though garden-variety in most languages — doesn’t seem to be commonplace in the Terraform wild. Providing defaults for omitted k/v within a structured hash/map/dict? Also nothing to write home about… in most languages anyway. Terraform hasn’t matured to the point where you see this sort of thing everywhere. The pattern here is not overly-complex but brings a lot of otherwise unrealized power and flexibility at little cost. Let’s try to enumerate what we’ve gained:</p><ol><li>Rather than restricting module consumers to only being able to define one of each of target groups, listeners, and SSL certificates, they can now define as many of each as they’d like. This was the initial motivation.</li><li>Not only can we define more than one of each of those resources but the relationships between resources is super flexible. Those can now be one-to-one, one-to-many, or many-to-many as each resource can reference another by index (e.g. listener to target group or SSL certs to listeners) which was previously not possible.</li><li>Clutter is generally lessened upstream as defaults for many resources are defined or overwritten in a single map which also lends to good organization of defaults (all related defaults are kept in close proximity).</li><li>We still center the module around a singular core resource, the ALB, as I feel this centers development and lessens mental overhead. If we really needed another ALB, in almost all cases it would make more sense to create it from a separate module call. Limiting cognitive overhead should always be a high-priority. This pro is less something we gained and more a good we’ve still managed to preserve.</li></ol><p>As in all things, there are trade-offs here, though in my completely unbiased opinion, I don’t think they outweigh the benefits. I can think of a couple:</p><ol><li>The API feels less well-defined for variables done as map-lists; we have to look close to determine which key/value pairs are required. At least errors are mostly intuitive when a required k/v is omitted.</li><li>Nesting lookups() within lookups() is enough to make any developer squint a bit. Is this a case of getting too clever? Perhaps.</li><li>The manually defined _counts of each map-list variable are annoying and a potential time bomb. I’ve been careful to keep them defined in close proximity within config for this reason. Forget to increment when you add a resource and you’ve truncated your resource list unwittingly. I have faith 🤞 that eventually this bug will be fixed in the core project making these variables unnecessary.</li><li>Formatting is less flexible if you don’t leverage locals along the way (think: 1 mile long of &quot;${list(map(&quot;foo&quot;, &quot;value1&quot;, &quot;bar&quot;, aws_resource.my_baz.id, ...))}). A small caveat but worth mention.</li></ol><p>I’ll stop there, just short of setting my own pattern on fire . The source code for the <a href="https://github.com/terraform-aws-modules/terraform-aws-alb">ALB module is on github</a> and best consumed through the <a href="https://registry.terraform.io/modules/terraform-aws-modules/alb/aws/3.1.0">terraform registry</a>.</p><p>Is this pattern old news to you? Let me know where you’ve used it. Drop a comment with your thoughts!</p><p>Edit: With hindsight, naming is hard and I’ve not quite boiled down the pattern to its singular form. Dropping the the “resource-set” qualifier, we can more simply land on the concept of a “map-defined-resource” which I think gets to the core of the pattern shown above.</p><p><em>Thanks for reading! I’m Brandon, founder and engineer of </em><strong><em>Run at Scale</em></strong><em>. I help organizations build out </em><strong><em>industrial-grade Internet plumbing</em></strong><em> through DevOps methodologies, security-first design, and infrastructure tools you’ve probably heard of. Interested to work together? Reach me at </em><a href="/service/mailto:brandon@atscale.run?Subject=Hello%20from%20medium"><em>brandon@atscale.run</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54c56f8b16b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/run-at-scale/terraform-pattern-map-list-defined-resources-54c56f8b16b7">Terraform pattern: “map-list defined resources”</a> was originally published in <a href="https://medium.com/run-at-scale">Run at Scale</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>