<?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 Amanpreet Kaur on Medium]]></title>
        <description><![CDATA[Stories by Amanpreet Kaur on Medium]]></description>
        <link>https://medium.com/@amanpreet9391?source=rss-43c00971b1f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*feDZah4PSuGCnh5dVnVe4w.jpeg</url>
            <title>Stories by Amanpreet Kaur on Medium</title>
            <link>https://medium.com/@amanpreet9391?source=rss-43c00971b1f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:52:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amanpreet9391/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[Best practices to follow while using Terraform]]></title>
            <link>https://medium.com/@amanpreet9391/best-practices-to-follow-while-using-terraform-e8e76f655691?source=rss-43c00971b1f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8e76f655691</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[devops-tool]]></category>
            <category><![CDATA[devops-practice]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Amanpreet Kaur]]></dc:creator>
            <pubDate>Sat, 30 May 2020 20:44:23 GMT</pubDate>
            <atom:updated>2020-05-30T20:44:23.365Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*yQa4GjyLfuvTfvtk15BEwQ.png" /></figure><p>Terraform is an industry-wide famous tool that allows deploying <em>Infrastructure as a code</em>. Its an infrastructure orchestration tool which basically means they can themselves provision the server and its infrastructure.</p><p>There are a lot of advantages for using Terraform, like:</p><ul><li>Supporting multiple platforms with hundreds of cloud providers like AWS, GCP, DigitalOcean, Azure, etc.</li><li>Simple configuration language and easy to learn</li><li>Easy integration with configuration management tools like ansible</li><li>Very extensible with the help of some plugins</li><li>Completely free :)</li></ul><p>I won’t get too much deep into the advantages because this blog is not about ‘Why Terraform?’, but about ‘How to get the best out of it?’.</p><p>While working in a production environment with Terraform, I figured that there are a few practices one should always follow in order to write a more efficient and understandable Terraform code. These practices will not only minimize the repetition of code but will make it more maintainable, seamless among different people of your team at work.</p><p>This guide assumes that you have a basic idea of Terraform. Although Terraform supports multiple cloud providers, I have taken the example of AWS while explaining things. The syntax will be more or less the same with different cloud providers.</p><ol><li><strong>Authentication token with AWS CLI</strong></li></ol><p>I’m assuming that you will be working in a collaborative environment where the use of git is a must. In such collaborative environments, you need to be aware of not to commit files having your access tokens. Those are sensitive contents that shouldn’t be displayed in the git repository. In such scenarios, configure your AWS CLI first, which will allow Terraform to fetch credentials directly from the AWS credentials file. The path of this file needs to be: ~/.aws/credentials. You can even add credentials for your different AWS accounts and here’s the way in which you can select any one of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8Wr7PBglNOcFOIl7" /><figcaption>Snapshot of how your AWS credentials file should look like</figcaption></figure><p>In the above image, there are two profiles — default and AWS-Dev-account. The [default] is the one that will be selected if no credentials are specifically mentioned.</p><p>In the provider block, mention the profile in place of access_key and secret_key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*LsrYcFbWrS5MYKKP" /></figure><p>If you want to launch a resource in Dev AWS account. Then you need to link to this account’s credentials in the provider block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*waBMMltfVxtU_X-V" /><figcaption>The way to link Dev AWS account credentials</figcaption></figure><p><strong>2. Maintain separate files</strong></p><p>Initially when the code and variables are short and less, writing the complete code in a single file can work. But as your code becomes lengthy, it’s difficult to understand and manage it in a single file. So, generally, it is a good practice to create separate files for Provider block, variable definition, variable declaration, and the resource configuration. The common name convention followed across the industry is:</p><p><strong>provider.tf</strong> — provider block</p><p><strong>terraform.tfvars</strong> — declaring the variable values</p><p><strong>variables.tf</strong> — defining the variable definition i.e. type and the default value</p><p><strong>main.tf/resource.tf</strong> — resource configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9z5yKkqq4nsvNsv4Zx3NtQ.png" /></figure><p><strong>3. Don’t commit the tfstate files</strong></p><p>The current state of Terraform resources is stored in terraform.tfstate file. And if your resource configuration file is dealing with any type of passwords or secrets, that sensitive content will be visible in terraform.tfstate file. That’s why, store state files in some other central repository like S3.</p><p>If you are using any interpolation function in the resource configuration {like file()} then the password will not be visible in the resource configuration file and won’t appear on the CLI as well. But, it will be visible in terraform.tfstate file in plain text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6rcqtd6N8QpQvW6M" /><figcaption>resource configuration file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*52cdNn5XcQe5JD2T" /><figcaption>Here is the password — “mysecretpassword”</figcaption></figure><p>Though, with the help of Remote Backend, a central repository other than Git can be used to store state files. Even one should enable state locking as well. This will avoid multiple writes at the same time which can further corrupt the state file. In S3, locking can be enabled with the help of Dynamo DB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wTU31aolUEMU1REb" /><figcaption>remote backend(backend.tf file)</figcaption></figure><p><strong>4. Follow DRY principle (Don’t repeat yourself)</strong></p><p>With the increasing complexity, also comes the slower code execution and increased difficulty for debugging. Even when you check, a major part of your code will be nothing but repeated software patterns. To reduce these, use <em>Modules</em>.</p><p>Modules are a centralized source where the code or resource blocks are defined, the code blocks which can be used in Terraform files of individual projects. To learn more about modules refer to Terraform official <a href="https://www.terraform.io/docs/configuration/modules.html">documentation</a>.</p><p>Here is a small demonstration. There is a module named “ec2” with code in file “ec2.tf”. There is another project which is using this module. The source code file of the project is “ec2-app.tf”. The code is minimized to just a few lines of calling the module and changing the instance-type variable defined in variables.tf file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1SHkaqti1qKO2cMN" /></figure><p><strong>5. Local values</strong></p><p>Local values assign a name to the expression, allowing it to be used multiple times without repetition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cNJ8jOSWFE0EKzBj" /></figure><p>In the above example, rather than defining the same tag to each and every resource, you should just define local values and call the local in the tags section of each resource.</p><p><strong>6. Dynamic Blocks</strong></p><p>It allows us to dynamically create repeatable nested blocks that are supported inside resource, data, provisioner, and provider.</p><p>For eg., if you want to create a security group, traffic should be allowed on 3 ports 8200, 8300, 9200.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/0*h_tKkFAfkCkjqIXf" /><figcaption>How the normal execution looks like.</figcaption></figure><p>This is still feasible as we only have 3 ports, just imagine the case where we have a lot of ports. The code won’t be maintainable.</p><p>Let’s see, how we can reduce the maintenance costs using dynamic block:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-VFGbKKS49SOw_Ib" /><figcaption>Define as many ports as you want in the variables file</figcaption></figure><p><strong>7. Taint or Import</strong></p><p>If you have made some manual changes in the resources, two possible scenarios can happen:</p><p>Case 1 — Everything was working perfectly fine before those changes and now you want to revert them. So, in this case, the best way is to use ‘<em>Taint’</em>. If someone makes manual changes to any resource and you want to revert those changes, mark the terraform resource as tainted, forcing it to be destroyed and recreated on the next apply. Taint won’t change the state file.</p><p><strong><em>Command</em></strong> — terraform taint resource_type.name</p><p>Case 2 —Your infrastructure at your work was set up manually. And now you want to manage it using Terraform, or someone did the changes manually and you want to include those changes in your current terraform setup. This is the case where Terraform import will come in the picture. Terraform will not generate resource.tf file for you, it will only create terraform.tfstate file. The upcoming feature in terraform will include the creation of resource configuration file as well. For now, you need to create the resource configuration file according to the manually created resource.</p><p>Here is an example. I created an EC2 instance manually, now I want to import it in Terraform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vr5KLITlAym0HAxX" /><figcaption>EC2 instance</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aIfwqzBHMiHFzYYL" /><figcaption>Resource configuration</figcaption></figure><p><strong><em>Command</em></strong> — terraform import aws_instance.myec2_instance i-066033af1dbb0a50d(instance id)</p><p><strong>8. Workspace<br></strong>By default, you’d start working in the ‘default’ workspace. But it’s not an ideal approach to use single terraform workspace to manage everything. Instead, split the environment into workspaces. For example, we have development, staging, and production environments in application development, similarly, you should have a separate workspace for each environment. In this way, you can make things more manageable.</p><p>Command — terraform workspace new workspaceName</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1PkcZppOT4V9g4V7" /><figcaption>Example of Usage</figcaption></figure><p>I hope by applying the mentioned practices at your work, it will help you in writing neat and legible code. If you have any questions or tips of your own, please do share in the comments.</p><p>In case you are a newbie to DevOps, and still wondering where to start your journey, I have articulated a blog discussing the learning roadmap. You can read that here: <a href="https://link.medium.com/NnawVKy4I6">https://link.medium.com/NnawVKy4I6</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8e76f655691" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Path: DevOps]]></title>
            <link>https://medium.com/@amanpreet9391/learning-path-devops-8aaf828167be?source=rss-43c00971b1f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8aaf828167be</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[ansible]]></category>
            <dc:creator><![CDATA[Amanpreet Kaur]]></dc:creator>
            <pubDate>Sat, 23 May 2020 16:07:36 GMT</pubDate>
            <atom:updated>2020-05-23T16:07:36.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgjyibR6ySrczshbWQMrhQ.png" /></figure><p>This learning path is specially designed for the undergrads or people seeking to change their career towards DevOps and hustling down to know where to get started. All of the resources mentioned here are from my own experience. I began learning DevOps when I was in the sophomore year of my college, and after following these resources in depth, landed a six-month-long internship opportunity with Appdynamics(where I’m currently working).</p><p>People usually have a lot of questions like how to become a DevOps engineer, what are the tools one should learn? What is Docker, what is Kubernetes? Is the infrastructure automation part of DevOps? Is it important to learn Chef, Ansible, etc?</p><p>But the most important question among them is “Where do I begin?”</p><p>So, here it goes:</p><p>(1) <strong>Basics of Computer Science</strong></p><p>DevOps stands for Development + Operations. Prerequisites here are not different from that of Software Development. Understanding the core concepts of Computer Science is required here as well. Databases, Computer Networking, and Operating System these three are the foundation stones. A basic and clear understanding of these subjects is really important.</p><ol><li><strong>Operating System</strong>: There are a lot of resources available in the market, but I referred to <strong>Operating System Concepts by Gagne, Silberschatz, and Galvin. </strong>It<strong> </strong>is like a one-stop-shop for OS. The explanation makes things quite crystal clear. Along with this, there is a youtube tutorial series by <a href="https://www.youtube.com/watch?v=YwqexcfbucE&amp;list=PLmXKhU9FNesSFvj6gASuWmQd23Ul5omtD"><strong>KNOWLEDGE GATE</strong></a><strong> </strong>channel. Things explained there are in pretty layman terms which makes things pretty easy to grasp.</li><li><strong>Database Management System:</strong> For DBMS, I referred — <strong>Fundamentals of Database Systems by Ramez Elmasri. </strong>This is my personal favorite. To learn SQL, always refer to <a href="https://www.w3schools.com/sql/"><strong>W3Schools</strong></a>.</li><li><strong>Networking</strong>: To learn about the basics of a subnet, routing, switching, etc. there is an awesome youtube tutorial series by <a href="https://www.youtube.com/watch?v=UXMIxCYZu8o&amp;list=PLEbnTDJUr_IegfoqO4iPnPYQui46QqT0j"><strong>Ravindrababu Ravula</strong></a>. Engineering undergraduates must be very familiar with this name. Along with these, you can refer to <strong>Data Communication and Networking by Behrouz.A.Forouzan and Computer Networks: A Systems Approach.</strong></li></ol><p>Note: The books I have suggested are easily available in PDF format over the internet.</p><p>(2) <strong>Linux Basics</strong></p><p>Intermediary command over Linux basics is also equally necessary. Knowledge of basic concepts like User groups, File permissions, package management, system monitoring, scheduling, LVM management, shell scripting, and basic commands like <strong>ls, cat, top, touch, df</strong>, etc. To get everything related to Linux at the same place refer to <a href="https://www.tecmint.com/free-online-linux-learning-guide-for-beginners/"><strong>Tecmint</strong></a><strong>.</strong></p><p>(3) <strong>Language</strong></p><p>After the subjects, comes the language. In-depth knowledge of one programming language is necessary. The one I started at that time was <strong>Python.</strong> If you are about to start learning a new language for this DevOps journey, I’ll highly suggest learning Python. <strong>Python</strong> is one of the primary technologies used by teams practicing <strong>DevOps</strong>. Its flexibility and accessibility make <strong>Python</strong> a great fit for this job, it enables building web applications, data visualizations, and also improves the workflow.</p><p>I learned Python from this course on Udemy — [<a href="https://www.udemy.com/course/complete-python-bootcamp/?LSNPUBID=JVFxdTr9V80&amp;ranEAID=JVFxdTr9V80&amp;ranMID=39197&amp;ranSiteID=JVFxdTr9V80-XU3A8FT70EcOYJ74ruEg0g">Complete Python Bootcamp</a>]. It walks you through a complete beginner to advance. The most important step while learning a language is to practice. Without practice, you won’t be able to have a good command over the language. So I’ll highly suggest practicing over any platform along with this course. The best way according to me is to go through this course and parallelly practice on <a href="https://www.hackerrank.com/"><strong>Hackerrank</strong></a><strong>, </strong>the language-specific challenges.</p><p>(4)<strong> Public Cloud Provider</strong></p><p>The sequence I am following here is the one I have gone through. It is definitely fine if you feel like changing the sequence according to your convenience. DevOps concept is not easy to understand at the first go. It takes time, perseverance, experience, understanding the tools, etc. The place from where I started my DevOps tech stack was <strong>AWS.</strong> I personally like AWS more in comparison with other Cloud providers. But you can always learn other cloud providers as well. My favorite source for AWS is the<a href="https://acloud.guru/"> <strong>Acloudguru</strong></a> platform. They have an amazing set of courses to choose from. For getting started to go for <strong>AWS Cloud Practitioner and AWS Solution Architect Associate.</strong> These two courses will clear the basic architecture of AWS along with hands-on experience.</p><p>(5) <strong>Training(optional)</strong></p><p>I did my training for <strong>RHCSA(Red Hat Certified System Administrator)</strong> in winter 2018 from a renowned institute of Jaipur — Linux World. It involved not just training for this certification but there were also sessions on different trending technologies of that time like Machine Learning, AWS, Python, Docker, Ansible, etc. Those were introductory sessions, for people to kick start any of those technologies. I successfully cleared my certification with a 100% score (300/300). This was a bonus thing. These training and certifications require a thorough knowledge of the concepts. So you learn a lot. Along with that, until you are not ready for an internship, you need something impactful in the resume. After having working experience the importance of certifications reduces, as you gain knowledge from experience, which also shines in your profile.</p><p>This is not a necessary step, just an add-on.</p><p>(6)<strong> Exploring DevOps tools</strong></p><p>Now let’s come to the main tools.</p><ol><li><strong>Docker </strong>— So here is my all-time favorite docker course — <strong>Docker for the Absolute Beginner — Hands-On — DevOps Created by </strong><a href="https://www.udemy.com/course/learn-docker/#instructor-1"><strong>Mumshad Mannambeth</strong></a><strong> on Udemy.</strong> This course makes docker a lot simpler and easy to understand. Trust me I explored a lot of resources before this, but only this one was able to make things crystal clear. All the courses offered by him on Udemy are awesome.</li><li><strong>Ansible</strong> — Again two beginner and advanced level courses by the same instructor — <strong>Ansible for the Absolute Beginner — Hands-On — DevOps and Ansible Advanced — Hands-On created by </strong><a href="https://www.udemy.com/course/learn-ansible/#instructor-1"><strong>Mumshad Mannambeth</strong></a><strong>. </strong>On a beginner level, these two courses are more than enough. Just create a lot of playbooks on different virtual machines by yourself. Practice, practice, and practice, that’s the way how it works.</li><li><strong>Kubernetes </strong>— I explored Kubernetes official documentation and <a href="https://www.katacoda.com/"><strong>Katacoda</strong></a> examples to clear the basics. I got an amazing course later on which not only explains Kubernetes concepts but also gives an overview of how DevOps tools work. The course is <a href="https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide/"><strong>Docker and Kubernetes: The complete guide by Stephen Grider</strong></a><strong>.</strong></li><li>To deep dive into the Kubernetes world, you can explore this course — <a href="https://www.udemy.com/course/certified-kubernetes-administrator-with-practice-tests/"><strong>Certified Kubernetes Administrator by Mumshad Manambath</strong></a><strong>, </strong>this course is all you need to learn about Kubernetes.</li><li><strong>Monitoring Tool</strong> — It’s really important to have a basic understanding of any monitoring tool. You can choose anyone among Prometheus, ELK, Grafana, etc. I learned Grafana through youtube videos and <a href="https://grafana.com/docs/grafana"><strong>documentation</strong></a>.</li><li><strong>Jenkins </strong>— This is an open-source automation tool built in java for Continuous Integration purposes. This tool plays a very crucial role in architecture. If you want to go for a youtube series then tutorials by Edureka on Jenkins are a good source. Other than that Udemy course I’ll suggest is <strong>Learn DevOps: CI/CD with Jenkins using Pipelines and Docker by Created by </strong><a href="https://www.udemy.com/course/learn-devops-ci-cd-with-jenkins-using-pipelines-and-docker/#instructor-1"><strong>Edward Viaene</strong></a><strong>.</strong></li></ol><p>(7)<strong> Projects</strong></p><p>Don’t worry if you don’t have many projects for now, not so much to show. Everyone starts at this level only. As you start learning things, exploring how they work, you start getting ideas about projects. Most of the time you get inspired by the courses you are following.</p><p>Going through the resources will give theoretical knowledge, to have complete understanding one has to start building projects. With the help of a good project, only you’ll be able to demonstrate your skills.</p><p>(8)<strong> Internship</strong></p><p>After getting sufficient knowledge, next, it’s time to face the real world and their real problems.</p><p>Working with realtime data and solving real-time problems, makes a person more confident about their skills. It’s not necessary that your first internship opportunity has to be grand, the focus should only be on the learning. I interned at <strong>Atlan (prev SocialCops)</strong> in the summer of 2019.</p><p>This was my story. Thanks for reading this article so far. The resources I have linked here may not be free but are worth the money. Being an Udemy fan I have added mostly Udemy courses, but at the end of the day, the important thing is to have enough knowledge and experience of the mentioned things.</p><p>With hard work, focus, and dedication, nothing is difficult. It’s a tried and tested formula. So go for it and Good luck for the journey ahead!</p><p>Currently, I am learning and working on other advanced DevOps tools like Terraform, Teamcity, Kafka, etc. You can follow me on twitter to know the details of articles and courses I refer to related to different tools. My twitter handle is <a href="https://twitter.com/burgerNpizza"><strong>@burgerNpizza</strong></a><strong>. </strong>I forgot to add that I am also competing in the <strong>#100DaysOfCode</strong> challenge on Twitter. Stay tuned to get insights into my 100 days journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8aaf828167be" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>