<?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 Norbert Varga on Medium]]></title>
        <description><![CDATA[Stories by Norbert Varga on Medium]]></description>
        <link>https://medium.com/@draconteus?source=rss-4c8cd497b6ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZjoX47kkJqyeuVUSvYD-Ww.jpeg</url>
            <title>Stories by Norbert Varga on Medium</title>
            <link>https://medium.com/@draconteus?source=rss-4c8cd497b6ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 12:41:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@draconteus/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[Source-controlled Infrastructure for Software Developers]]></title>
            <link>https://medium.com/emarsys-craftlab/source-controlled-infrastructure-for-software-developers-42227d1080f6?source=rss-4c8cd497b6ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/42227d1080f6</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[emarsys-dev]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Norbert Varga]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 07:01:00 GMT</pubDate>
            <atom:updated>2020-04-23T08:51:58.711Z</atom:updated>
            <content:encoded><![CDATA[<h4>TL;DR: Terraform combined with git is awesome!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VP78yh1tSW0_QLfKoeUCg.jpeg" /><figcaption>Photo on <a href="https://www.pxfuel.com/en/free-photo-ebynp">pxfuel</a></figcaption></figure><p>System engineering is not my field, I’m a developer guy, in-and-out. Of course, I know some basic Unix tools, not afraid to use vim, remember something about networks and hardware stuff, but none of these topics ever touched my heart to deepen my knowledge in system engineering.</p><p>For most of us, software developers, infrastructure is a pre-built tool either provided us by a system engineering team or a third party. You learn how to deploy your application in it and live-on. And this was fine until DevOps and NoOps became a thing. In the last decade, system engineers got newer and newer toys (like <a href="https://www.chef.io/">Chef</a> or <a href="https://puppet.com/">Puppet</a>) to manage application infrastructure much more easily. On the other hand, using Infrastructure as a Service provider and microservice architecture became the standard architecture for scalable software development. I still haven’t felt the urge to check these tools out (although they sound really fancy), Infrastructure as a Service providers gave enough control over the infrastructure that made me feel comfortable using it, deployment became much easier along with scaling an application. And now the cloud providers are the big players in the game, changing the way we develop software.</p><p>Nowadays you’ll certainly be dead if you’re not thinking in cloud-native applications. Building in the cloud is the future of scalable and maintainable applications.</p><p>With this new era came a new mindset and new tools have arrived, too. This mindset is the Infrastructure as Code and its best hammer is called <a href="https://www.terraform.io/">Terraform</a>, which blew my mind when I first encountered it.</p><h3>What is Infrastructure as Code?</h3><p>Let’s see how it is described in <a href="https://en.wikipedia.org/wiki/Infrastructure_as_code">Wikipedia</a>:</p><blockquote>Infrastructure as code (IaC) is the process of managing and provisioning computer data centers through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.</blockquote><p>So you write some kind of code that is readable for us humans and also can be parsed via a tool than can modify our infrastructure in the described way. <em>How awesome is that?!</em></p><p>IaC tools can be divided into several categories, from the simplest scripts, through configuration management until powerful server provisioning tools. Although custom scripts (good ol’ rsync) and configuration management tools existed way before Infrastructure as Code was a thing, server provisioning tools (<a href="https://www.terraform.io/">Terraform</a>, <a href="https://www.pulumi.com/">Pulumi</a>) are rather new.</p><h3>What is Terraform?</h3><p>Terraform is an open-source Infrastructure as Code command-line tool that can create, manage and update infrastructure resources such as physical machines, VMs, network switches, containers and more. Almost any infrastructure type can be represented as a resource in Terraform.</p><p>It’s fully written in Go and created by Mitchell Hashimoto and HashiCorp, the very same company that gave us <a href="https://www.vagrantup.com/">Vagrant</a> or <a href="https://www.vaultproject.io/">Vault</a>, just to mention a few of their very well-renowned products.</p><p>Infrastructure management is achieved through different providers. A provider is responsible for understanding API interactions and exposing resources. Providers can be any IaaS (e.g. <a href="https://cloud.google.com/">Google Cloud Platform</a>, <a href="https://aws.amazon.com/">AWS</a>, <a href="https://azure.microsoft.com/en-us/">Microsoft Azure</a>, etc.), PaaS (e.g. <a href="https://heroku.com/">Heroku</a>), or SaaS services (<a href="https://gitlab.com/">Gitlab</a>, <a href="https://www.pagerduty.com/">PagerDuty</a>, <a href="https://www.cloudflare.com/">Cloudflare</a>) or just an ordinary MySql database. It supports more than 100 different providers.</p><h3>How does it work?</h3><p>You can create your configuration using a high-level configuration language known as Hashicorp Configuration Language (HCL), or optionally in JSON (which comes handy when you want to write your own tool around Terraform).</p><p>With these configuration files, you can plan and apply modifications or even visualize infrastructure simply by invoking the related Terraform commands. Planning means you can see what will be changed in the infrastructure in detail, comparing the current state of the infrastructure to what state it would be if we apply the changes in the plan.</p><p>HCL provides us with options to define and use variables, simple data structures, loops to create the desired resources under a provider. We can even reference resources and their properties in another resource or wait for resources to be created if another one depends on that resource.</p><h3>Creating our first infrastructure code</h3><p>Well, the first thing you need is the Terraform itself. You can do this in several ways in different operating systems, but for sake of example, let’s install it on macOS through <a href="https://brew.sh/">Homebrew</a> with brew install terraform command.</p><p>Now that we have Terraform installed, we can create our config file. First, we need a provider where we want to provision our resources. I chose the Google Cloud Platform for this example. I created a project for it in GCP’s cloud console, created a service account, downloaded the credentials and exported the content of the whole file in a specific env var that is used by Google Terraform Provider so we can perform authenticated change requests:</p><pre>$ export GOOGLE_CREDENTIALS=/path/to/credentials.json</pre><p>This is used by Google Terraform Provider to make changes in the managed resources.</p><p>You can find in depth guide to create a Google Project in the <a href="https://cloud.google.com/resource-manager/docs/creating-managing-projects">documentation</a> and more on what <a href="https://cloud.google.com/iam/docs/service-accounts">service accounts</a> are and how to <a href="https://cloud.google.com/iam/docs/creating-managing-service-accounts">use them</a>.</p><p>So with the project id and a specific (in this case, europe-west3) region, we can set up the Google provider:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f91c124224597809dc296aba91de377/href">https://medium.com/media/5f91c124224597809dc296aba91de377/href</a></iframe><p>Next, we can use the terraform init command to initialize our infrastructure state from the config file.</p><p>This will create a .terraform folder with our provisioned resources’ current state using a local backend (which is not a good practice as you don’t want to lose these state files if your machine broke down, but we will come back to change this later). A backend for Terraform is a place where Terraform will look for the state file, in this case, it is the current folder where the command is run. The output of it looks something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c410ee4fee03492eabc901e9b764719/href">https://medium.com/media/1c410ee4fee03492eabc901e9b764719/href</a></iframe><p>Let’s create our first resource. Remember what I said about storing state locally? Let’s use a remote backend and create a GCP Storage bucket for it</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/96460516476fd27e15b03d53760d6791/href">https://medium.com/media/96460516476fd27e15b03d53760d6791/href</a></iframe><p>and plan out our infrastructure change with terraform plan command:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36650d65c9fee676a01c56b9485091f0/href">https://medium.com/media/36650d65c9fee676a01c56b9485091f0/href</a></iframe><p>Terraform will create a plan and shows us what it is about to change, in this case, a new bucket named project-bucket-terraform in europe-west3 region with other default properties, like storage class, will be created. If everything looks fine, it’s time to make these changes with the terraform apply command. This (in most cases) outputs the same thing as when we ran the previous plan and asks us if we wanted to really execute these changes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fd4782105257d0161d9d7c27206f21d/href">https://medium.com/media/3fd4782105257d0161d9d7c27206f21d/href</a></iframe><p>Now let’s switch our local backend to a remote one. To do this, we need to add a new backend to our config file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1c54e8efc712f95ed9ff414b357731c/href">https://medium.com/media/f1c54e8efc712f95ed9ff414b357731c/href</a></iframe><p>Then run terraform init again. Terraform will recognize that we are going to switch our backend to a remote one and will ask us if we want to copy our current state file into the bucket we created earlier.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eb0ee6e490fec23a4f9b1a51a79d89e/href">https://medium.com/media/0eb0ee6e490fec23a4f9b1a51a79d89e/href</a></iframe><p>That’s it! Our infrastructure’s state backed up remotely and updated automatically in the future. Adding additional resources from here on only requires a few new lines in the config file.</p><h3>Bookkeeping infrastructure changes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8r9CSlT7RwL79bXh" /><figcaption>Photo by <a href="https://unsplash.com/@syinq?utm_source=medium&amp;utm_medium=referral">Susan Yin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Terraform files can be considered as source code, thus it’s better to be stored in a version control system where we can keep track of all our infrastructure changes, versioning our config and not making changes manually, which is hard to track or even unfold why it’s ever happened. We can even automate reviewing and applying changes made with Terraform with tools like <a href="https://www.runatlantis.io/">Atlantis</a> or <a href="https://github.com/features/actions">GitHub Actions</a>.</p><p>Terraform is a powerful tool in the cloud era, especially for non-system engineers. It provides a new way to build up infrastructure, quicker than any time before. It can help startups to grow without requiring a whole team of system engineers, but a few who could do a lot more and faster with Terraform than a team of system engineers without it.</p><p>More to read:<br>- <a href="https://en.wikipedia.org/wiki/Infrastructure_as_code">https://en.wikipedia.org/wiki/Infrastructure_as_code</a><br>- <a href="https://www.terraform.io/docs">https://www.terraform.io/docs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42227d1080f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/emarsys-craftlab/source-controlled-infrastructure-for-software-developers-42227d1080f6">Source-controlled Infrastructure for Software Developers</a> was originally published in <a href="https://medium.com/emarsys-craftlab">Emarsys Craftlab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>