<?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 Prerna Sharma on Medium]]></title>
        <description><![CDATA[Stories by Prerna Sharma on Medium]]></description>
        <link>https://medium.com/@prernawrites?source=rss-4858e8d6e5d0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VYKDEAOqoD5EuOAgPyUHqQ.jpeg</url>
            <title>Stories by Prerna Sharma on Medium</title>
            <link>https://medium.com/@prernawrites?source=rss-4858e8d6e5d0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:50:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prernawrites/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[Amazing Terraform -Part II]]></title>
            <link>https://awstip.com/amazing-terraform-part-2-1670d19b2cae?source=rss-4858e8d6e5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1670d19b2cae</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[system-design-project]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure]]></category>
            <dc:creator><![CDATA[Prerna Sharma]]></dc:creator>
            <pubDate>Sun, 01 May 2022 16:59:22 GMT</pubDate>
            <atom:updated>2022-07-22T22:16:27.720Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the second post in the terraform series and I am even more in love with this tech. The emphasis of this post will be on learning <strong><em>how to terraform?</em></strong>. We will also conclude how easy and fast terraform is while also being so transparent and manageable as proof of <a href="https://prernawrites.medium.com/amazing-terraform-part-i-a9b2fbfd36b2">Amazing terraform part 1.</a></p><p>We will cover some theoretical concepts like terraform’s core components, commands, variables, resources, etc, and also follow a hands-on example to understand better. After going through this post you will be fallen too- of course in love also you will be able to create simple-to-medium infrastructure yourself.</p><p>I would really appreciate some prior hands-on experience with any cloud service provider services. We will be following the AWS provider here in this post. This post assumes you are all set with installation, if you are not you can read more about the same <a href="https://learn.hashicorp.com/tutorials/terraform/install-cli">here</a> and pre-equip yourself with all the tools :)</p><h3><strong>Terraform Language</strong></h3><p>The configurations to provision the architecture or environment shall be provided in either of the following two ways</p><ol><li><strong><em>HashiCorp Configuration Language (HCL)</em></strong>: A rich configuration language aimed to enhance readability (for developers), easier to work with (update/write/manage). If you are familiar with the JSON syntax, and you love it, HCL is a treat because it’s actually simpler, compact, easier to comprehend, offers a lot more flexibility, and also allows inline comments. It also offers high interoperability with other programming languages in case you wish to provision your environment programmatically with terraform. The extension for HCL file(s) is<strong><em> .tf </em></strong>.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef3a485bd4516a2a256950ec528712c8/href">https://medium.com/media/ef3a485bd4516a2a256950ec528712c8/href</a></iframe><ol><li><strong><em>JSON:</em> </strong>Configurations can also be stated in the JSON format. However, for a few complex constructs, JSON grammar can be restrictive and writing configurations in JSON can be cumbersome. This format however is easier to generate and parse programmatically. The extension for JSON file(s) is <strong><em>.tf.json</em> </strong>.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0ec38ca828fb7931e4d00d1210cd771/href">https://medium.com/media/f0ec38ca828fb7931e4d00d1210cd771/href</a></iframe><h3>Terraform Configuration- Building Blocks</h3><p>Every block delineates a certain configuration, and these configurations are maintained in one or more configuration files(.tf or .tf.json). Terraform combines all the configurations and plans a single infrastructure change(s). HCL format follows a simple syntax for blocks which slightly varies on the basis of block type and nested configurations. A block starts with a reserved keyword which represents the <strong><em>nature</em></strong> <strong><em>of the object </em></strong>followed by multiple labels where the first label signifies the <strong><em>type of the object </em></strong>and<strong><em> </em></strong>the last label is mostly the <strong><em>named identifier of the object</em></strong>. The settings of an object are wrapped in a block of curly braces and specified as key-pair. Terraform documentation is quite robust and well written, and it’s really easy to navigate to any block type/service you wish to use, there is absolutely no need to fill one’s mind with random block syntax or attribute names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*uzUbvQysgx2NBMcaRCiwAQ.png" /><figcaption>block syntax</figcaption></figure><ol><li><strong><em>Provider: </em></strong>This block represents the cloud-service provider details. In order to use the API’s/service of the cloud, we must <strong><em>tell</em></strong> terraform, which is our chosen provider, and provide the necessary details to login/authorize with the provider. For say AWS provider, we mandatorily provide a region, secret/access keys in order to connect with our AWS account. The nature of the object is the <strong><em>provider</em></strong>(reserved keyword). The first label here represents the<strong><em> type of provider- AWS</em></strong> here. Authorization details for AWS are listed in the object block as key pairs.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3667094a76e1c2c7b1a9c2a186b811b6/href">https://medium.com/media/3667094a76e1c2c7b1a9c2a186b811b6/href</a></iframe><p><strong><em>2. Resource: </em></strong>This block represents the actual service/setting that you wish to orchestrate with terraform. The resources can be configured by creating a <strong><em>resource block </em></strong>and specifying the <strong><em>type of resource </em></strong>followed by the<strong><em> identifier label</em></strong> for this resource and encapsulating the settings as key pairs for this resource in the resource block. Say you wish to establish a VPC in AWS, you will simply create a resource block with the keyword- <strong>resource, </strong>specify the required resource-<strong> aws_vpc </strong>(reserved according to AWS-terraform documentation), label the configuration- <strong>main-vpc (</strong>for further reference in terraform), and wrap resource settings in the block required to provision the desired deployment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2e106d9d4998b433a2969eed4256853/href">https://medium.com/media/b2e106d9d4998b433a2969eed4256853/href</a></iframe><p><strong><em>3. Data: </em></strong>Data block provides a way to channel queries for data emitted by Cloud infrastructure, applications, and services from the provider. Terraform uses data sources to fetch information from cloud provider APIs, such as for instance image IDs, AMIs, availability zones, key pairs, etc. For say in the following example, we are trying to retrieve all the <strong><em>‘available’ availability zones </em></strong>from AWS<strong><em>.</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8010beb766df3019a71791346b6c0744/href">https://medium.com/media/8010beb766df3019a71791346b6c0744/href</a></iframe><p><strong><em>4. Variable: </em></strong>Variables are another type of block in the configuration which is employed to pass the data/values in the configuration. Besides adding robustness to the configuration language, it also enables the code to be more presentable, and reusable, and avoids hard-coding the known values as well. Variable blocks encapsulate keys depicting the values stored such as <strong><em>type </em></strong>ie. data type of the value, also providing a means for error checking, <strong><em>description</em></strong>, <strong><em>default </em></strong>which is actually the keeper of the value, <strong><em>sensitive- </em></strong>depicting whether the value is sensitive and should be visible/hidden in output/logs/terminal.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1adf43f05f1c4ef4ad069f7334316c12/href">https://medium.com/media/1adf43f05f1c4ef4ad069f7334316c12/href</a></iframe><p><strong><em>5. Comments: </em></strong>Like any other language, HCL also supports inline, single line, and block(multi-line) comments.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15191c9b2aa40634717769fcf4d2fc7a/href">https://medium.com/media/15191c9b2aa40634717769fcf4d2fc7a/href</a></iframe><h3><strong>Terraform Structure</strong></h3><ol><li><strong><em>Configuration files: </em></strong>The configurations expected to provision the environment will be contained in one or more terraform file(s). If there is more than one file, then terraform will stitch them all together into a single configuration.</li><li><strong><em>State files: </em></strong>Terraform needs to keep track of the state of the infrastructure and settings. Terraform uses this state to link real-world resources to the configuration, maintain track of information, and optimize large-scale infrastructure performance. This state is saved locally by default in a file called “<strong><em>terraform.tfstate</em></strong>” but it may also be saved centrally as a single source of truth, which is more useful in a collaborative environment.</li><li><strong><em>.Terraform Directory: </em></strong>Terraform creates a hidden .terraform directory to manage cached provider plugins and modules, keep track of active workspace, and keep track of the last known backend configuration in case it has to migrate state on the next run. This directory is generated during Terraform’s initialization and is handled by Terraform automatically.</li><li><strong><em>Lock Files: </em></strong>The provider dependencies are tracked in the dependency lock file. The lock file’s name is always <strong><em>.terraform.lock.hcl</em></strong>, and it’s meant to indicate that it’s a lock file for different items that Terraform caches in the .terraform subdirectory of your working directory.</li></ol><h3>Terraform Workflow and Commands</h3><ol><li><strong>Initiation</strong>: This phase initiates the process of orchestration of infrastructure by interacting with services like AWS which is a provider. In order to achieve this interaction, it needs to have provider plugins, which can be summoned with the following command <strong>~</strong><strong><em>terraform init.</em></strong><em> Now terraform will look for the required provider details in the configuration files, and download the required provider plugins from the terraform public registry. Terraform will also store the state data of the configuration and it will create a state file in the current working directory by default.</em></li><li><strong>Planning:</strong><em> </em>After initialization, terraform is now ready to launch and manage the infrastructure. In order to plan the architecture, the following command is used <strong>~</strong><strong><em>terraform plan </em></strong><em>Now terraform will check the configuration and current state of the infrastructure, analyze the delta between the two, and devise a plan to update the infrastructure. This plan will output on the terminal, and the changes can be validated by the developer. This step will not cause any change to the infrastructure.</em></li><li><strong>Application: </strong>Actual changes take place here. This step is quite similar to the planning phase, the only difference is it will make the required planned changes to the infrastructure using provider plugins. The command for this step is<em> ~</em><strong><em>terraform apply</em></strong><em>. Once all the changes are made, terraform will capture the current state of the infrastructure and store it.</em></li><li><strong>Management</strong>: Managing the infrastructure is quite a simple and repeated process and includes step2, and 3. Just state/modify the configurations according to the desired changes in the infrastructure, checkout plan using <strong>~</strong><strong><em>terraform plan and </em></strong>apply changes using<strong><em> </em></strong><em>~</em><strong><em>terraform apply.</em></strong> In case there is absolutely no change in the configurations that affect the infrastructure, Terraform will prompt regarding the same, and no modifications will be made since it will analyze the modifications required in the current architecture and then make the change.</li><li><strong>Destruction: </strong>This is an optional step, however, useful in a few scenarios, and needs caution before processing. This can opt if there is some requirement to take down the entire architecture. It can be done using this command <strong>~</strong><strong><em>terraform destroy. </em></strong><em>This command will destroy all the existing resources as per the current state of the deployment created by the terraform configuration files in the current directory.</em></li></ol><h3><strong>Fun Time :)</strong></h3><p>Now since we are very thorough with what is Terraform and how it can be used, let’s do a simple exercise. <strong><em>Help me launch an instance on AWS</em></strong>. This is quite simple, but it will make you familiar with the entire lifecycle of the process. In the upcoming post, we will build a medium-level architecture.</p><h3><strong>Steps:</strong></h3><ol><li>Please create a directory structure like this and store all the configuration files in the root of the working directory (<em>Terraform Demo</em>).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*P9CYjMSqwdtiVsyFg3krHw.png" /><figcaption>directory structure</figcaption></figure><p><strong>2 </strong>. Here are the configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ayAx1w3U7r98YQDKzdDMAQ.png" /><figcaption>configurations</figcaption></figure><p><strong>provider.tf</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ddf19a772f2a52399af1185457330d95/href">https://medium.com/media/ddf19a772f2a52399af1185457330d95/href</a></iframe><p><strong>instance.tf</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89f63e59619599ad03d87c972f504ed2/href">https://medium.com/media/89f63e59619599ad03d87c972f504ed2/href</a></iframe><p><strong>variables.tf</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa22a67d49a2dbf0740f5a3604113254/href">https://medium.com/media/fa22a67d49a2dbf0740f5a3604113254/href</a></iframe><p><strong>3. </strong>Initiate using the init command<strong>.</strong></p><p>terraform init</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VyWCTgBWrcFFopvwj50FBA.png" /><figcaption>initialization</figcaption></figure><p>terraform created state files, lock files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*ENcPgL4ES7VLX_n2O4rm5Q.png" /><figcaption>lock files created by terraform</figcaption></figure><p><strong>4. </strong>Plan the infrastructure- terraform plan. since I did not specify the default value of the secret key and access key variable, it prompted me to input it on the terminal, which is also a good security practice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xKlz44aWRgItr1heYFXqfg.png" /><figcaption>planning the infrastructure</figcaption></figure><p><strong>5. </strong>Implement the plan - terraform apply. The instance is successfully launched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EDyBvY1oEDQyvhLDlWrGWQ.png" /><figcaption>Implement changes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4i7Sz23h-BXdfsfK5eJelA.png" /><figcaption>Instance created</figcaption></figure><p><strong>6. </strong>This instance which is my entire infrastructure also was launched for demo purposes only, and I do not want it any longer, so I would destroy this using terraform using the command.</p><p>terraform destroy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VXxsBj_v8DfpRUZ70x8vIw.png" /><figcaption>infra destroyed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wjM9DyUY0z2vv7f2LSvhBQ.png" /><figcaption>instance terminated</figcaption></figure><p>Phew ~</p><p>I hope you liked the experience or maybe you did not, but why go through this much trouble for launching a single instance, right? That’s a topic for another post :) Stay tuned!</p><h3>Conclusion</h3><p>Terraform is an easy-to-use technology that can be used for architectural orchestration and management. We went through basic theoretical concepts like terraform’s fundamental components, commands, variables, resources, and so on, as well as workflow, which explains how things function behind the scenes. We also saw a brief example of how simple it is to utilize terraform to create an instance from scratch. The emphasis here, though, was on learning <strong><em>how to terraform</em></strong>. There’s more to it, and there are unquestionably disadvantages. More divisions of this article will follow, in which we will go deeper into the usage of terraform to create more realistic infrastructures, as well as best practices and other topics. I’m still learning, so any feedback, advice, or questions are welcomed. I wish you happy learning :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1670d19b2cae" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/amazing-terraform-part-2-1670d19b2cae">Amazing Terraform -Part II</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazing Terraform- Part I]]></title>
            <link>https://awstip.com/amazing-terraform-part-i-a9b2fbfd36b2?source=rss-4858e8d6e5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9b2fbfd36b2</guid>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Prerna Sharma]]></dc:creator>
            <pubDate>Sun, 17 Apr 2022 16:37:25 GMT</pubDate>
            <atom:updated>2022-07-25T17:19:29.935Z</atom:updated>
            <content:encoded><![CDATA[<p>The goal of this tutorial is to familiarise you with concepts such as IaC (Infrastructure as Code) and why it simplifies your life as an engineer, as well as Terraform and its basic principles in general.</p><p>If you work in technology, you’ve probably come across the term “deployment” on a daily basis. When you’re launching a new service or infrastructure, or even upgrading it, things might get a little more frantic than normal if you stick to the traditional method of doing things- GUI :(</p><p>What if I told you that you could truly describe your architecture as a configuration and then use these preset settings to start, terminate, or just change your architecture in no time? Isn’t it crazy? And what if it’s more than that? You can really repeat this entire procedure several times for the exact same architecture result, and you also get to select your preferred cloud service provider. Isn’t it a steal? No, it’s simply the way Terraform is- AMAZING!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*sbAcxeV1KLkfbAdZZg05vg.gif" /></figure><p>Oh, and I almost forgot to mention that it’s open-source, which means it’s free! It’s really licensed under the Mozilla Public License v2.0. I’ll return to this topic later.</p><p>This article is meant to focus solely on introducing terraform, but let’s first go over what IaC is and what benefits it offers.</p><h3><strong>Infrastructure as Code</strong></h3><blockquote><strong>Infrastructure as code</strong> (<strong>IaC</strong>) is the process of managing and provisioning computer <a href="https://en.wikipedia.org/wiki/Data_center">data centers</a> through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.</blockquote><p>So basically, provisioning infrastructure through programmatic behavior to achieve consistent and predictable environment(s) is termed Infrastructure as Code. It’s like instead of logging into the cloud service console and creating numerous resources with multiple levels of setting, and interconnection between those services/resources via an interactive configuration system (GUI here), you can simply declare the required configurations in some acceptable way- code/JSON/instructions and apply those configurations in order to build/destroy/update your infrastructure. Encapsulating this sort of approach can be highly beneficial if you have exactly the same infrastructure requirements in multiple environments (dev/staging/prod) or there are frequent updates required since you no longer need to tediously repeating all the steps, you have the configurations ready, simply applying will serve the purpose. IaC comes with all sorts of advantages, which we will discuss wrt to Terraform, which is one of the ways in which IaC can be implemented.</p><h3>Terraform as IaC tool</h3><p>Terraform is an IaC tool that enables automatic deployment and further management of architecture. It’s an open-source project under license- <em>Mozilla Public License v2.0 maintained by </em>HashiCorp. Let’s understand the advantages, core properties, and components of terraform with a cute example :)</p><p>Let’s launch an EC2 instance on AWS in GUI Mode and then use our loved terraform to do exactly the same. Here are the quick steps. If you are not familiar with EC2 instances or AWS services in general, I would recommend reading briefly about the same from here to follow along with this article.</p><p><strong><em>Step M1:</em></strong> Login to the AWS console and launch the EC2 service from the AWS management console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hfYHAVTbXt2SA9BGaWYc6w.png" /><figcaption>AWS management console.</figcaption></figure><p><strong><em>Step M2:</em></strong> Launch Instance using the button present on the screen. Please note that there is a single instance present currently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OmgGi4c3nRwfkHtjFa-_-Q.png" /><figcaption>Launch instance</figcaption></figure><p><strong><em>Step M3:</em></strong> Select configurations of your instance like name, image type, instance type volume, security group, VPC, network, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0nhTFVxQXYFRgTz8Iw9ExQ.png" /><figcaption>Configure Settings on Instance</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VByOMuH1l1fOewfmzoiTlQ.png" /><figcaption>Configure Settings on Instance</figcaption></figure><p><strong><em>Step M4:</em></strong> Launch Instance using the button present at the bottom of the summary. Instance successfully launched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlFL04oyywk0ztaA2cr05Q.png" /><figcaption>Instance launched</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqbc86A0iqAfCdZrZjQdow.png" /><figcaption>Instance launched</figcaption></figure><p>Now let’s do this exact same thing but with terraform.</p><p><strong><em>Step A1: Write configurations in the .tf file.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jtm0Iq47Zi5xGgTXVP2EXg.png" /><figcaption>terraform configurations</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e400ec8e8015ff2b6875881c2028bdc/href">https://medium.com/media/0e400ec8e8015ff2b6875881c2028bdc/href</a></iframe><p><strong><em>Step A2: Initiate terraform, and plan the architecture.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OVM_vCdU0shlzm7vrOgwOQ.png" /><figcaption>initiate terraform (output)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hwT2sWBiWFsgBlTvac4sHQ.png" /><figcaption>plan the architecture (output)</figcaption></figure><p><strong><em>Step A3: Apply the configurations to build/update architecture.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j9NUFidzScrpL65jFMaicg.png" /><figcaption>apply configurations (output)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uewORbprC_BFieXtE-s9bw.png" /><figcaption>instance launched with terraform</figcaption></figure><p>Wow! Finally, both of our instances are up and running. Now let’s go through the core concepts of terraform with the help of this example and also understand why terraform is amazing.</p><h3>Core concepts</h3><ol><li><strong><em>Nature:</em></strong> IaC can take two forms- Imperative &amp; Declarative. The imperative paradigm implies absolute commands in the source code in a specific order to derive the desired results. It’s like I have documented each and every step in code to login into the AWS console, fetch resources, create a resource, integrate it with other resources, apply any setting(s) on resources if any, etc, terminate the connection. Whereas the Declarative approach is more like taking a back seat and just stating the requirements, and the responsibility of doing things is on the tool itself. Terraform is Declarative in nature which is evident from Step A1. We have provided the details of the service provider, details of what sort of resources we wish to create, and any additional non-default properties like a name tag, machine type, etc, and now the responsibility of transforming these configurations into an architecture lies on the terraform. <strong><em>We are suggesting what is required, and not how it needs to be done.</em></strong></li><li><strong>State: <em>Terraform is indepotent in nature</em></strong>, it manages the state of the currently deployed architecture, and in case of any modification required in the architecture, then it compares the currently deployed architecture with the modified requirements, and <strong><em>only applies the delta between the two</em></strong>. If you try to apply the same configurations again without any change, then terraform prompts you about the same, and does not update anything. Hence it is stateful. However, it is quite complex to maintain the state centrally as the only source of truth. We will discover this in the upcoming parts of this blog.</li><li><strong>Application/Deployment: </strong>It follows a push-type model where configurations are pushed to the architecture. The configurations in the terraform file(s) are getting pushed to the environment (Step A3). There exists another model of the application in IaC which suggests a pull-based model where the architecture pulls the modifications/configurations from a centrally maintained pool within a regular period of time.</li></ol><h3>Advantages</h3><ol><li><strong>Documented Architecture:</strong> Architecture consists of a lot of small details like settings of EC2 instance, EBS volume attached, etc. A documented architecture is a blessing, it allows easy updates, refactoring, and analysis. If you are new to the team, it’s really easy to comprehend the architecture and contribute if it is well documented. It’s really hard to miss any detail this way.</li><li><strong>Reusable: </strong>Since it’s code, it can be reused easily. If you are maintaining multiple environments, you can simulate exactly the same architecture in all environments (dev/staging/prod) easily and effortlessly. Independent components of Terraform configuration or subparts of your architecture can be used in different applications too.</li><li><strong>Reliable Yield:</strong> Terraform yields a predictable environment every time you apply the configuration, there is no scope of surprise elements here. It is very useful when your single application is running in multiple environments, or you need to frequently update or destroy-build your entire architecture.</li><li><strong>Faster: </strong>Terraform is way faster, within a few commands you can entirely build your architecture or destroy it forever too, and still maintain a copy of the same as a template(.tf file).</li><li><strong>Automatic:</strong> Once you have the preset configuration of resources, it’s quite an automatic process. You do not have to rely on the menu-driven style for the management of your architecture.</li><li><strong>Vendor Agnostic: </strong>Terraform has plugins for almost all the providers and the integration/setup is quite easy and the documentation is well provided as well. You can read more about it <a href="https://registry.terraform.io/browse/providers">here</a>. It also supports multi-cloud integration which enables the users to deploy their architecture on multiple service providers</li></ol><h3><strong>Conclusion</strong></h3><p>Terraform is one of the technologies that can be used for architectural orchestration and management, and it has a lot of advantages. We also saw a tiny demonstration of the ease with which terraform may be used. However, this is simply an introduction to IaC, outlining all of the positive aspects and benefits. There is more to it, and there are undoubtedly drawbacks or trade-offs. More sections of this essay will follow, in which we will delve deeper into the use of terraform for creating more realistic architectures, as well as the main components of terraform and when we should use it. I’m still learning, so any comments, criticism, or questions would be very appreciated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9b2fbfd36b2" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/amazing-terraform-part-i-a9b2fbfd36b2">Amazing Terraform- Part I</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>