<?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[Run at Scale - Medium]]></title>
        <description><![CDATA[Industrial-grade Internet plumbing - Medium]]></description>
        <link>https://medium.com/run-at-scale?source=rss----f7abccde943c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Run at Scale - Medium</title>
            <link>https://medium.com/run-at-scale?source=rss----f7abccde943c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 05:47:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/run-at-scale" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[VSCode + Terraform = ]]></title>
            <link>https://medium.com/run-at-scale/vscode-terraform-37121ee0e737?source=rss----f7abccde943c---4</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----f7abccde943c---4</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>