{"id":9414,"date":"2020-09-21T11:30:12","date_gmt":"2020-09-21T09:30:12","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=9414"},"modified":"2022-01-05T20:05:47","modified_gmt":"2022-01-05T19:05:47","slug":"terraform-aws","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/","title":{"rendered":"Terraform AWS: Up and Running in 25 Minutes"},"content":{"rendered":"\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-cb492208      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tTable Of Contents\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#what-is-terraform\" class=\"uagb-toc-link__trigger\">What is Terraform?<\/a><li class=\"uagb-toc__list\"><a href=\"#prerequisites\" class=\"uagb-toc-link__trigger\">Prerequisites<\/a><li class=\"uagb-toc__list\"><a href=\"#what-you-will-learn\" class=\"uagb-toc-link__trigger\">What you will learn<\/a><li class=\"uagb-toc__list\"><a href=\"#terraform-installation-of-the-cli\" class=\"uagb-toc-link__trigger\">Terraform: Installation of the CLI<\/a><li class=\"uagb-toc__list\"><a href=\"#creation-and-configuration-of-a-user-dedicated-to-terraform\" class=\"uagb-toc-link__trigger\">Creation and configuration of a user dedicated to Terraform<\/a><li class=\"uagb-toc__list\"><a href=\"#terraform-start\" class=\"uagb-toc-link__trigger\">Terraform: start!<\/a><li class=\"uagb-toc__list\"><a href=\"#connect-terraform-to-aws\" class=\"uagb-toc-link__trigger\">Connect Terraform to AWS<\/a><li class=\"uagb-toc__list\"><a href=\"#infrastructure-creation-the-journey-begins\" class=\"uagb-toc-link__trigger\">Infrastructure creation &#8211; the journey begins<\/a><li class=\"uagb-toc__list\"><a href=\"#what-we-have-learned\" class=\"uagb-toc-link__trigger\">What we have learned<\/a><li class=\"uagb-toc__list\"><a href=\"#want-to-launch-a-developer-event-despite-the-challenges-of-covid-19\" class=\"uagb-toc-link__trigger\">Want to launch a developer event despite the challenges of  COVID-19?<\/a><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\n\n<p class=\"eplus-5tCVhd\"><strong style=\"user-select: auto;\">Working with the <span style=\"user-select: auto;\" id=\"urn:enhancement-4a642d36\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/cloud_computing\">Cloud<\/span> is a great opportunity<\/strong>, as it offers access to a series of services and infrastructures that until recently were beyond the reach of all except corporations.<\/p>\n\n\n\n<p class=\"eplus-c6uW6r\">However, &#8220;<strong>with great powers come great responsibilities<\/strong>&#8220;. Managing the amount of information related to this new <span id=\"urn:enhancement-be61fb0d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure\">infrastructure<\/span> is not an easy task and can lead,&nbsp; if not handled properly, to cost or <span id=\"urn:enhancement-ae6cc1f3\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/security\">security<\/span> issues.<\/p>\n\n\n\n<p class=\"eplus-TejGZP\">Fortunately, <strong><span id=\"urn:enhancement-e06fe8da\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span><\/strong> can help us to manage our entire <span id=\"urn:enhancement-b5a9a82d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure\">infrastructure<\/span>. First, by providing a series of <span id=\"urn:enhancement-efdc30d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/tool\">tools<\/span> and abstractions that allow growth within a short time. Second, by keeping <span id=\"urn:enhancement-bfd2ebdd\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure\">infrastructure<\/span> consistent and under control.<\/p>\n\n\n\n<p class=\"eplus-YsNOB4\"><a href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/backend-dev\/infrastructure-as-code\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>Moreover, <span id=\"urn:enhancement-222bfcf7\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> also allows full adoption of the <strong><span id=\"urn:local-annotation-885674\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure_as_code\">IaC<\/span><\/strong> (<strong>I<\/strong>nfrastructure <strong>a<\/strong>s <strong>C<\/strong>ode) philosophy, by exploiting programming advantages within the realm of <span id=\"urn:enhancement-3f4e6875\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure\">infrastructures<\/span>. In other words, it greatly <strong>simplifies cloud management<\/strong>.<\/p>\n\n\n\n<h2 class=\"eplus-oEoqUk wp-block-heading\" id=\"h-what-is-terraform\">What is Terraform?<\/h2>\n\n\n\n<p class=\"eplus-2lEj5q\"><span id=\"urn:enhancement-c9201201\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> is a <span id=\"urn:enhancement-97372b0\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/tool\">tool<\/span> developed in 2012 on the basis of the <a href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/backend-dev\/infrastructure-as-code\/\" target=\"_blank\" rel=\"noreferrer noopener\">Infrastructure as Code<\/a> (IaC) \u201cphilosophy\u201d, exploiting years of <span id=\"urn:enhancement-f2e668eb\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure\">infrastructure<\/span> management <span id=\"urn:enhancement-8d89ad57\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/experience\">experience<\/span>. If you are reading this with thoughts of utilising Terraform, you probably wish to boost the overall effectiveness and efficiency of your work. This <span id=\"urn:enhancement-810f7bb5\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/tool\">tool<\/span> offers valuable support in managing your cloud provider without incurring excessive <span id=\"urn:enhancement-1746dd84\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/complexity\">complexity<\/span>.<\/p>\n\n\n\n<p class=\"eplus-abJlD1\">By fully managing the IaC, <span id=\"urn:enhancement-be8f5442\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> offers the following possibilities:<\/p>\n\n\n\n<ul class=\"eplus-YYBx5N wp-block-list\"><li><strong>Code <span id=\"urn:local-annotation-642024\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_versioning\">versioning<\/span><\/strong>: Terraform uses a pseudo language called HCL that allows us to write our structure as a code;<\/li><li><strong>Management infrastructure<\/strong>: a simplified platform and abstract structures enable the creation of business value, while taking care of everything else at the same time (API calls, driver updates, functionality additions etc &#8230;);<\/li><li><strong>Idempotency<\/strong>: prevents duplication of efforts and operations. In other words, if a resource is already present no further operation will be performed, and the resource\u2019s state will be protected from any unexpected behavior;<\/li><li><strong>Infrastructure consistency<\/strong>: any change is tracked and reported. In this way, our code straightforwardly portrays what is available in our infrastructure, and any changes are promptly reported.<\/li><\/ul>\n\n\n\n<p class=\"eplus-jSMl51\">In this article, we will learn how to create an <span id=\"urn:enhancement-497722f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/amazon_simple_queue_service\">SQS<\/span> queue &#8211; a very simple object that carries no cost if we forget to destroy it once the exercise is over.I will refer to the <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/github.com\/diegoitaliait\/terraform-aws-showcase\/tree\/develop\/base_1\" target=\"_blank\" rel=\"noreferrer noopener\"><span id=\"urn:local-annotation-324732\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/github\">GitHub<\/span> repository<\/a> with a ready-to-use example that accompanies this article.<\/p>\n\n\n\n<h2 class=\"eplus-QUUblP wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2>\n\n\n\n<p class=\"eplus-G0bfJl\">To begin, we need the following prerequisites:<\/p>\n\n\n\n<ul class=\"eplus-mIK8yc wp-block-list\"><li><span id=\"urn:local-annotation-965890\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/unix\">UNIX<\/span> based environment (I use <span id=\"urn:local-annotation-350806\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/ubuntu\">Ubuntu<\/span> or <span id=\"urn:local-annotation-364361\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/windows_subsystem_for_linux\">WSL<\/span>)<\/li><li>Terraform <span id=\"urn:local-annotation-278474\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command-line_interface\">CLI<\/span> (a simple guide to installation is available)<\/li><li><span id=\"urn:local-annotation-560504\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/amazon_web_services\">AWS<\/span>: Basic knowledge of the terminology, security issues, and the cost of resources&nbsp;<\/li><li>At least one AWS account (I used the <a href=\"https:\/\/aws.amazon.com\/free\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">free tier<\/a> for this lab) &#8211; this allows us to create our resources for free<\/li><li>Basic knowledge of a programming language<\/li><\/ul>\n\n\n\n<p class=\"eplus-p1aTRU\">Before proceeding, I would like to remind readers of the <a style=\"user-select: auto;\" href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/cloud-manager\/the-importance-of-cloud-computing-for-a-i-and-big-data\/\" target=\"_blank\" rel=\"noreferrer noopener\">importance of knowing the cloud<\/a> you are working with. This is of crucial importance to avoid incurring excessive costs. We are creating real resources, and in carrying out our tests must keep in mind the existing AWS thresholds in terms of both timing and quantity. <\/p>\n\n\n\n<p class=\"eplus-2amwlV\">I strongly recommend you <a style=\"user-select: auto;\" href=\"https:\/\/docs.aws.amazon.com\/AmazonCloudWatch\/latest\/monitoring\/monitor_estimated_charges_with_cloudwatch.html\">use alerts<\/a> (ideally, more than one) to provide timely warnings if you are approaching the threshold, to avoid paying unexpected amounts of money.<\/p>\n\n\n\n<h2 class=\"eplus-hrOgxc wp-block-heading\" id=\"h-what-you-will-learn\">What you will learn<\/h2>\n\n\n\n<ul class=\"eplus-ISyOcF wp-block-list\"><li>Get familiar with the basic concepts of Terraform<\/li><li>Create your first automated infrastructure<\/li><li>Understand how Terraform manages infrastructure changes<\/li><\/ul>\n\n\n\n<h2 class=\"eplus-eOQzJW wp-block-heading\" id=\"h-terraform-installation-of-the-cli\">Terraform: Installation of the CLI<\/h2>\n\n\n\n<p class=\"eplus-wlE8d4\">You can <span id=\"urn:enhancement-e30c345b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/download\">download<\/span> Terraform at <a href=\"https:\/\/www.terraform.io\/downloads.html\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">this link<\/a>.<a href=\"https:\/\/www.terraform.io\/downloads.html\"> <\/a>For this example, I chose to use <span id=\"urn:enhancement-ca38b2fd\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_versioning\">version<\/span> 0.12.28.<\/p>\n\n\n\n<p class=\"eplus-ebhrJ8\">One of the advantages of <span id=\"urn:enhancement-8c2d133b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> is its ability to work on almost all platforms. For this <span id=\"urn:enhancement-2caab76d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/tutorial\">tutorial<\/span>, an <span id=\"urn:enhancement-47b77f63\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/ubuntu_operating_system\">Ubuntu<\/span> environment inside <span id=\"urn:enhancement-13a1dc66\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_windows\">Windows<\/span> 10 has been chosen, thanks to the opportunity to use the <span id=\"urn:enhancement-dc7ce773\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_windows\">Windows<\/span> <span id=\"urn:enhancement-f95b1334\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/ubuntu_operating_system\">Ubuntu<\/span> <span id=\"urn:enhancement-56027029\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span>. The required steps to <span id=\"urn:enhancement-59634570\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/installation_computer_programs\">install<\/span> <span id=\"urn:enhancement-2b265f22\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> on <span id=\"urn:enhancement-f80ed779\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/ubuntu_operating_system\">Ubuntu<\/span>\/WSL are very simple:<\/p>\n\n\n\n<ul class=\"eplus-IbicnJ wp-block-list\"><li>Download the zip file containing the terraform executable (inside a temporary folder, for example)<\/li><li>Extract the zip file (which will have a name similar to <em>terraform_0.12.28_linux_amd64.zip<\/em>)<\/li><li>After extraction there will be a file named <em>terraform<\/em>; copy it into the folder <em>\/usr\/local\/bin<\/em>, so that you can access it from any location in the shell<\/li><\/ul>\n\n\n\n<p class=\"eplus-8LNOnS\">Once the Terraform steps have been followed, it can be called from the terminal. To verify that the <span id=\"urn:enhancement-b0a4a5e2\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_program\">program<\/span> works correctly just run the <span id=\"urn:enhancement-cf26b1eb\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span>:<\/p>\n\n\n<pre class=\"wp-block-code eplus-3Ijxa5\"><span><code class=\"hljs\">terraform version<\/code><\/span><\/pre>\n\n\n<h2 class=\"eplus-POEt7a wp-block-heading\" id=\"h-creation-and-configuration-of-a-user-dedicated-to-terraform\">Creation and configuration of a user dedicated to Terraform<\/h2>\n\n\n\n<p class=\"eplus-FRnKSj\">Once the Terraform cli has been installed, it is necessary to create an <span id=\"urn:enhancement-bede8a31\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/identity_management\">IAM<\/span> <span id=\"urn:enhancement-351f558a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">User<\/span> with Programmatic <span id=\"urn:enhancement-3c69cc3b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/access_control\">access<\/span>-type <span id=\"urn:enhancement-ce41386f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/access_control\">access<\/span>, in order to use it with AWS. We don\u2019t want to use our <span id=\"urn:enhancement-5c6da8b3\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span> here, instead creating a dedicated <span id=\"urn:enhancement-a047f6bf\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span> with specific and controlled permits in order to limit the area of use and any <span id=\"urn:enhancement-d21e0700\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/security\">security<\/span> issues. During <span id=\"urn:enhancement-c334ae89\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span> creation you will need to assign the <em>AmazonSQSFullAccess<\/em> predefined <span id=\"urn:enhancement-e5f82710\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/policy\">policy<\/span>, which allows full use of SQS resources.<\/p>\n\n\n\n<div class=\"wp-block-image eplus-gQ7tsT\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image4.png\" alt=\"Assigning the AmazonSQSFullAccess predefined policy\" class=\"wp-image-9415\" width=\"384\" height=\"410\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image4.png 524w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image4-281x300.png 281w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/figure><\/div>\n\n\n\n<p class=\"eplus-YWLtaE\">NOTE: For reasons of simplicity, it is also possible to directly assign \u201cAdministratorAccess\u201d. However, it is always preferable to insert only the most relevant <span id=\"urn:enhancement-1417baf5\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/policy\">policies<\/span>, to limit the damage done should someone manage to steal our <span id=\"urn:enhancement-f96f268a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/credential\">credentials<\/span>.<\/p>\n\n\n\n<p class=\"eplus-AFZnuS\">At the end of the creation process we will have two keys:<\/p>\n\n\n\n<ul class=\"eplus-TM37UG wp-block-list\"><li><em>ACCESS KEY ID<\/em><\/li><li><em>SECRET ACCESS KEY ID<\/em>&nbsp;<\/li><\/ul>\n\n\n\n<p class=\"eplus-mdv6u7\">Both are necessary for <span id=\"urn:enhancement-e4006bdb\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> to be able to connect to our <span id=\"urn:enhancement-f2926239\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">account<\/span>, using the newly created <span id=\"urn:enhancement-166db9be\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span> and its specific <span id=\"urn:enhancement-c6323e91\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/policy\">policies<\/span>. A <span id=\"urn:enhancement-e1dcdeff\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/comma-separated_values\">.csv<\/span> <span id=\"urn:enhancement-8fa8040d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">file<\/span> containing the same <span id=\"urn:enhancement-5f1148ad\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> is also provided.<\/p>\n\n\n\n<p class=\"eplus-7SwLt6\">Such information must be saved immediately as there is no way for <span id=\"urn:enhancement-cf6817ef\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_security\">security<\/span> to resume these, unless you destroy the <span id=\"urn:enhancement-ca156167\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span> and create a new one (even if it has the same name).<\/p>\n\n\n\n<p class=\"eplus-DP99BZ\">NOTE: These <span id=\"urn:enhancement-aa2fdf8c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> are very sensitive and it is necessary to be extremely careful i.e., never save them on a public repo or similar.<\/p>\n\n\n\n<h3 class=\"eplus-YMCcXR wp-block-heading\" id=\"h-optional-billing-alert-creation\">(Optional) Billing alert creation<\/h3>\n\n\n\n<p class=\"eplus-ERJu6L\">Lastly,&nbsp; I strongly recommend inserting billing alarms into the <span id=\"urn:enhancement-44105712\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">account<\/span> to keep control of costs and avoid nasty surprises. Although the AWS tier is free, it has very precise conditions of use, anything not included will be charged.<\/p>\n\n\n\n<h2 class=\"eplus-GhWJLg wp-block-heading\" id=\"h-terraform-start\">Terraform: start!<\/h2>\n\n\n\n<p class=\"eplus-KnxI1l\">To start using <span id=\"urn:enhancement-9eb6afe6\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span>, we first need a folder that will contain our <span id=\"urn:enhancement-e0a4a255\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/project\">project<\/span>. If you are using my example <span id=\"urn:enhancement-a0d6506\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/project\">project<\/span>, I am referring here to the <em>base_1<\/em> folder. Inside the folder we will create a <span id=\"urn:enhancement-9ef36ae6\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">file<\/span> called <em>main.tf<\/em>, and inside this we can create our first Terraform object, allowing us to connect to the AWS provider. This is the code example:<\/p>\n\n\n\n<div class=\"wp-block-image eplus-SIJhaS\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"330\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image5-1.png\" alt=\"Terraform AWS\" class=\"wp-image-9419\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image5-1.png 624w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image5-1-300x159.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure><\/div>\n\n\n\n<p class=\"eplus-RKa6kj\">Before you can really start using <span id=\"urn:enhancement-4733acf0\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span>, however, you will still need to complete the last setup actions in order to log in to the AWS <span id=\"urn:enhancement-f250330c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">account<\/span>.<\/p>\n\n\n\n<h2 class=\"eplus-wBWZed wp-block-heading\" id=\"h-connect-terraform-to-aws\">Connect Terraform to AWS<\/h2>\n\n\n\n<p class=\"eplus-4dHrcL\">In order to use AWS, you first need to enter the information of the <span id=\"urn:enhancement-6fc5400c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span> created previously, i.e., the two keys:<\/p>\n\n\n\n<ul class=\"eplus-4jdqxz wp-block-list\"><li><em>SECRET ACCESS KEY ID<\/em><\/li><li><em>ACCESS KEY ID<\/em><\/li><\/ul>\n\n\n\n<p class=\"eplus-wvCa6w\">To do this, simply load our keys as <span id=\"urn:enhancement-4f8291f3\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/environment_variable\">environment variables<\/span>, using the example code below. To load the keys, just run the following <span id=\"urn:enhancement-f6253b7f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">commands<\/span>:<\/p>\n\n\n<pre class=\"wp-block-code eplus-ylUYPv\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"># <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">https:<\/span>\/\/<span class=\"hljs-attr\">docs.aws.amazon.com<\/span>\/<span class=\"hljs-attr\">AWSEC2<\/span>\/<span class=\"hljs-attr\">latest<\/span>\/<span class=\"hljs-attr\">UserGuide<\/span>\/<span class=\"hljs-attr\">using-regions-availability-zones.html<\/span>#<span class=\"hljs-attr\">concepts-available-regions<\/span>&gt;<\/span>\nexport AWS_DEFAULT_REGION=us-east-2 #<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">region<\/span> <span class=\"hljs-attr\">id<\/span>&gt;<\/span>\nexport AWS_ACCESS_KEY_ID=DASDSAXCKSCNK #<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">acces<\/span> <span class=\"hljs-attr\">key<\/span>&gt;<\/span>\nexport AWS_SECRET_ACCESS_KEY=DSFK432_dsaedi #<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">secret<\/span> <span class=\"hljs-attr\">access<\/span> <span class=\"hljs-attr\">key<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"eplus-UVNizg\">Again, it is a great idea to automate this <span id=\"urn:enhancement-fe7d614f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/information_technology_operations\">operation<\/span> and simplify the insertion of information. Nevertheless, bear in mind that it is best to keep such information private.&nbsp;<\/p>\n\n\n\n<p class=\"eplus-vbyRpg\">Once these operations are complete we can finally use <span id=\"urn:enhancement-9c8a4da7\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> with AWS.&nbsp;<\/p>\n\n\n\n<p class=\"eplus-5vker6\">NB: If you start a new session, these <span id=\"urn:enhancement-8a7d381\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/environment_variable\">environment variables<\/span> will not be available.&nbsp; It will be necessary to repeat the procedure, to avoid receiving an error message from <span id=\"urn:enhancement-dbb6d09\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span>.<\/p>\n\n\n\n<h3 class=\"eplus-ahtFXd wp-block-heading\" id=\"h-terraform-init\">Terraform init<\/h3>\n\n\n<pre class=\"wp-block-code eplus-zC2niM\"><span><code class=\"hljs\">terraform init<\/code><\/span><\/pre>\n\n\n<p class=\"eplus-cRuvUw\">This <span id=\"urn:enhancement-82b2d4ec\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span> must be <span id=\"urn:enhancement-a431af33\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/execution_computing\">executed<\/span> inside the working folder in which the tf <span id=\"urn:enhancement-e21f3d3d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">files<\/span> are saved. After <span id=\"urn:enhancement-4ab5acc\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/execution_computing\">execution<\/span>, all the init operations will be taken care of, namely:<\/p>\n\n\n\n<ul class=\"eplus-N6QTc4 wp-block-list\"><li>download the various providers;<\/li><li>plugins for the platform used;<\/li><li>connect or download the modules used;<\/li><\/ul>\n\n\n\n<p class=\"eplus-1eyKvF\">This <span id=\"urn:enhancement-2501a1fa\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span> is essential to use our new Terraform project. Now we can begin to analyze the various <span id=\"urn:enhancement-9b996504\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/component-based_software_engineering\">components<\/span> of the code.<\/p>\n\n\n\n<h3 class=\"eplus-AnX8ks wp-block-heading\" id=\"h-provider-aws\">Provider: AWS<\/h3>\n\n\n\n<div class=\"wp-block-image eplus-zkL7FX\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"531\" height=\"70\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image7.png\" alt=\"Terraform AWS\" class=\"wp-image-9422\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image7.png 531w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image7-300x40.png 300w\" sizes=\"auto, (max-width: 531px) 100vw, 531px\" \/><\/figure><\/div>\n\n\n\n<p class=\"eplus-SE4wh2\">The provider is responsible for understanding how the <span id=\"urn:enhancement-7f896e1c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/application_programming_interface\">APIs<\/span> (of the <span id=\"urn:enhancement-d18fec33\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/cloud_computing\">Cloud provider<\/span>) interact and expose their resources.<\/p>\n\n\n\n<p class=\"eplus-bzxLAS\">We can imagine it as the engine that allows us to communicate with AWS resources<\/p>\n\n\n\n<p class=\"eplus-liyEDO\">As you can see, each provider has at least:<\/p>\n\n\n\n<ul class=\"eplus-HS66l3 wp-block-list\"><li>name: in this case, aws \u2192 provider &#8220;&lt;provider name&gt;&#8221;<\/li><\/ul>\n\n\n\n<p class=\"eplus-sOg8Gq\">Other optional attributes:<\/p>\n\n\n\n<ul class=\"eplus-V8GjO0 wp-block-list\"><li>Version: the provider version. If not entered automatically, Terraform will take care of downloading the latest version available. This is recommended, as a new version of the provider could break compatibility or bring bugs into the system to interact with what we currently have. For this reason, even if optional, insertion is always recommended.<\/li><\/ul>\n\n\n\n<p class=\"eplus-fLp0S4\">Other configurable attributes (but not recommended for <span id=\"urn:enhancement-950ec238\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/security\">security<\/span> reasons, as you directly expose the keys of your Terraform <span id=\"urn:enhancement-9569b2b0\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span>) will be taken automatically by <span id=\"urn:enhancement-b18e02c2\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/terraform\">Terraform<\/span> as they are present as environment variables<\/p>\n\n\n\n<ul class=\"eplus-hXJVi5 wp-block-list\"><li>region: the region on which we must operate for example &#8220;us-west-2&#8221;<\/li><li>access_key: the access key of our user<\/li><li>secret_key: the user&#8217;s secret key id<\/li><\/ul>\n\n\n\n<p class=\"eplus-nVhSlo\">For more information on providers you can consult the following pages:<\/p>\n\n\n\n<ul class=\"eplus-aS8c1v wp-block-list\"><li><a href=\"https:\/\/www.terraform.io\/docs\/providers\/index.html\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">https:\/\/www.terraform.io\/docs\/providers\/index.html<\/a><\/li><li><a href=\"https:\/\/registry.terraform.io\/providers\/hashicorp\/aws\/latest\/docs\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">https:\/\/registry.terraform.io\/providers\/hashicorp\/aws\/latest\/docs<\/a><\/li><\/ul>\n\n\n\n<h3 class=\"eplus-XMhM7H wp-block-heading\" id=\"h-resources\">Resources<\/h3>\n\n\n\n<div class=\"wp-block-image eplus-2wSytt\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"625\" height=\"250\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image1-2.png\" alt=\"Terraform AWS\" class=\"wp-image-9423\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image1-2.png 625w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image1-2-300x120.png 300w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/figure><\/div>\n\n\n\n<p class=\"eplus-AMGwAN\">The resource <span id=\"urn:enhancement-ab50e64d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/component-based_software_engineering\">components<\/span> are the main Terraform object. In fact, each block describes one or more <span id=\"urn:enhancement-1e13d9c9\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure\">infrastructure<\/span> objects, such as <span id=\"urn:enhancement-938c23b0\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/virtual_machine\">virtual machines<\/span>, VPCs, etc &#8230;<\/p>\n\n\n\n<p class=\"eplus-vaLRI9\">In the example used, we are creating an SQS queue with a tag.<\/p>\n\n\n\n<p class=\"eplus-GTIGTC\">The syntax of the code block is explained below:<\/p>\n\n\n<pre class=\"wp-block-code eplus-VQtarL\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">resource <span class=\"hljs-string\">\"&lt;type of resource you want to create \/ manage&gt;\"<\/span> <span class=\"hljs-string\">\"&lt;local id \/ name of that resource&gt;\"<\/span> {\n\n  <span class=\"hljs-string\">\"Attributes ....\"<\/span>\n\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"eplus-QUt5Q7 wp-block-list\"><li><code style=\"user-select: auto;\">aws_sqs_queue \u2192 &lt;type of resource to be created \/ managed&gt;<\/code> defines the type of resource to be created. If you want to see the entire catalog offered by Terraform, visit <a style=\"user-select: auto;\" href=\"https:\/\/registry.terraform.io\/providers\/hashicorp\/aws\/latest\/docs\" target=\"_blank\" rel=\"noreferrer noopener\">this page<\/a>.<div class=\"wp-block-image\" style=\"user-select: auto;\"><figure class=\"aligncenter size-large\" style=\"user-select: auto;\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"594\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image8-1024x594.png\" class=\"wp-image-9424\" alt=\"\" style=\"user-select: auto;\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image8-1024x594.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image8-300x174.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image8-768x446.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image8.png 1261w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div><\/li><li><code style=\"user-select: auto;\">terraform_queue \u2192 &lt;local id \/ name of that resource&gt;<\/code>: defines a unique id \/ name for the resource (we can think of it as the name of the class instance in the programming world). This allows us to have N resources of the same type, for example, and to be able to recall them later. If you try to create two resources with the same name, Terraform will identify an error, as the second resource conflicts with the name.<br>We will talk about how to recall the information about a specific resource in the next lesson. For now, all you need to know is that you need to give each resource a unique name.<\/li><li><code style=\"user-select: auto;\">&lt;attributes ...&gt;<\/code>: Inside the resource block, on the Terraform page relating to the resource, the attributes that can be configured are available to view. You can see all the available attributes, and if they are mandatory, if there are limitations and many other pieces of information. Further on, we will talk specifically about how to work with attributes.<\/li><\/ul>\n\n\n\n<h2 class=\"eplus-wiNsBZ wp-block-heading\" id=\"h-infrastructure-creation-the-journey-begins\">Infrastructure creation &#8211; the journey begins<\/h2>\n\n\n\n<p class=\"eplus-BpQr21\">Now that complete base is ready, we can finally start using Terraform and see what happens to our account.<\/p>\n\n\n\n<h3 class=\"eplus-0b4bR1 wp-block-heading\" id=\"h-terraform-plan\">Terraform plan<\/h3>\n\n\n<pre class=\"wp-block-code eplus-dy5nke\"><span><code class=\"hljs\">terraform plan<\/code><\/span><\/pre>\n\n\n<p class=\"eplus-EekzJT\">This command executes what in Terraform is called an <strong>execution plan<\/strong>; that is, it allows calculation (without any concrete performance on our account) of the actions that must be performed to achieve the desired state of the configuration files. Done for the first time, the result should look something like this:<\/p>\n\n\n\n<div class=\"wp-block-image eplus-8al3rr\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image6-1.png\" alt=\"Terraform AWS\" class=\"wp-image-9426\" width=\"645\" height=\"667\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image6-1.png 746w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image6-1-290x300.png 290w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/figure><\/div>\n\n\n\n<p class=\"eplus-ZAxHfb\">As you can see, Terraform will logically generate all the resources (and their respective configurations) necessary to achieve our goal. In the end it will carry out a summary of the type of operations:<\/p>\n\n\n\n<ul class=\"eplus-5hcRRB wp-block-list\"><li><strong>add<\/strong>: resources to add<\/li><li><strong>change<\/strong>: resources that need to be changed<\/li><li><strong>destroy<\/strong>: resources that must be destroyed. As shown in the last figure, we must be careful, because depending on the type of resource, what for us logically looks like a change might actually be an operation of destruction and recreation<\/li><\/ul>\n\n\n\n<p class=\"eplus-VlHSHW\">We are finally ready to really create our resources on our account. To do this we would use the \u2018apply\u2019 command.<\/p>\n\n\n\n<h3 class=\"eplus-wX383S wp-block-heading\" id=\"h-terraform-apply\">Terraform apply<\/h3>\n\n\n\n<p class=\"eplus-YLYnPz\">With the Terraform apply command it is finally possible to concretely create the resources that we have previously seen with the plan command. To launch the creation, just run the command:<\/p>\n\n\n<pre class=\"wp-block-code eplus-Uvzvxz\"><span><code class=\"hljs\">terraform apply<\/code><\/span><\/pre>\n\n\n<p class=\"eplus-U85ITS\">Once the Terraform command is launched, it will do the following:<\/p>\n\n\n\n<ul class=\"eplus-O7PFmP wp-block-list\"><li>re-execute a resource plan, showing us the same information, in order to know which operations will be carried out<\/li><\/ul>\n\n\n\n<p class=\"eplus-p5SN7R\">For safety, it will make a confirmation request to be sure that the operations to be carried out are those we expect<\/p>\n\n\n\n<ul class=\"eplus-zfzzxY wp-block-list\"><li>When you confirm the operation, Terraform will begin to call the bees to proceed with creation, displaying a log of the operations carried out on the screen.<\/li><li>At the end of the creation process you will be presented with a summary of the operations carried out.<\/li><\/ul>\n\n\n\n<p class=\"eplus-gDUWSa\">Here is an example of an apply command in use:<\/p>\n\n\n\n<div class=\"wp-block-image eplus-cogxRq\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"742\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image3-1.png\" alt=\"Terraform AWS\" class=\"wp-image-9428\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image3-1.png 941w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image3-1-300x237.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image3-1-768x606.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"eplus-4uLnuH wp-block-heading\" id=\"h-terraform-state-the-historical-memory-of-terraform\">Terraform state: the historical memory of Terraform<\/h3>\n\n\n\n<p class=\"eplus-cHsDY1\">Once our resources have been created, we can see that a file has been created inside the project folder called <strong style=\"user-select: auto;\">terraform.tfstate<\/strong> &#8211; Terraform needs this file to keep track of the real infrastructure. In fact, this file contains the current status of the resources created so that it can act in the event of subsequent changes, by deciding what actions it must take.<\/p>\n\n\n\n<p class=\"eplus-wZrVR5\"> Do not manually delete or modify this file. In subsequent articles, I will write in a more in-depth way&nbsp; about the function of the tfstate and its uses.<\/p>\n\n\n\n<h3 class=\"eplus-uRaaOZ wp-block-heading\" id=\"h-terraform-and-idempotency\">Terraform and idempotency<\/h3>\n\n\n\n<p class=\"eplus-hd6RFc\">We have now seen how Terraform takes care of creating resources, but what if we rerun the Terraform apply command?If you try again, you will activate a log in which Terraform will show you that no operations must be performed and that everything is aligned. <\/p>\n\n\n\n<p class=\"eplus-UdGdWh\">This magic is made possible by using <strong style=\"user-select: auto;\">terraform.tfstate<\/strong> which then displays the state of the last operation performed by Terraform, in comparison with the current state. If both coincide, no operation will be carried out.<\/p>\n\n\n\n<div class=\"wp-block-image eplus-0ExiLq\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image2-2.png\" alt=\"Terraform AWS\" class=\"wp-image-9429\" width=\"608\" height=\"68\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image2-2.png 700w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image2-2-300x33.png 300w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"eplus-OsTqdQ wp-block-heading\" id=\"h-terraform-and-change-management\">Terraform and change management<\/h3>\n\n\n\n<p class=\"eplus-agDNCx\">Contrary to what we have seen before, if there are changes (performed within the code or directly from the interface) and the \u2018terraform apply\u2019 command is run, there will also be a comparison here between the local state and what is really present.<\/p>\n\n\n\n<h4 class=\"eplus-fw6X0G wp-block-heading\" id=\"h-case-1-we-made-a-change-within-our-code\">Case 1: We made a change within our code<\/h4>\n\n\n<pre class=\"wp-block-code eplus-CD2kDN\"><span><code class=\"hljs\">increase the delay_seconds = 120<\/code><\/span><\/pre>\n\n\n<p class=\"eplus-oRzgxk\">If we then rerun the \u2018terraform apply\u2019 command, then we would see that even this simple modification is noticed by Terraform, showing us the changes it will make and asking if we are sure we want to make them.<\/p>\n\n\n\n<div class=\"wp-block-image eplus-I9KqVL\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"743\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image9.png\" alt=\"Terraform AWS\" class=\"wp-image-9430\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image9.png 849w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image9-300x263.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image9-768x672.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/figure><\/div>\n\n\n\n<h4 class=\"eplus-Yiu6gp wp-block-heading\" id=\"h-case-2-we-made-the-same-change-as-before-but-directly-from-the-web-console-and-not-on-the-code\">Case 2: We made the same change as before but directly from the web console (and not on the code)<\/h4>\n\n\n\n<p class=\"eplus-RHRvTm\">Here, Terraform notes a change that is inconsistent with what is present in the code, and will propose a modification action that will return the state to what is described in the code.<\/p>\n\n\n\n<p class=\"eplus-wq16wK\">This is one of Terraform&#8217;s strengths, as it allows us to maintain our infrastructure\u2019s alignment with what is written in the code. At the same time, especially during development, it requires us to be more careful, as any changes made to test a new functionality, if not reported within Terraform, will be lost. From now on, this should always be taken into consideration.<\/p>\n\n\n\n<p class=\"eplus-qfOLeh\">One very important thing for the future is to not be fooled by the number of changes. Depending on how the Cloud provider treats its resources, even a field that may seem trivial could lead to the destruction and then recreation of resources. This happens in Azure\u2019s Virtual Machines, for example.<\/p>\n\n\n\n<h3 class=\"eplus-t3d0Vr wp-block-heading\" id=\"h-terraform-destroy\">Terraform destroy<\/h3>\n\n\n\n<p class=\"eplus-5yLON3\">it is clear that we have concluded our project, and it is now time to destroy (delete) all the resources created to avoid any additional costs on our account. In order to destroy the resources created by Terraform just run the command:<\/p>\n\n\n<pre class=\"wp-block-code eplus-25nslZ\"><span><code class=\"hljs\">terraform destroy<\/code><\/span><\/pre>\n\n\n<p class=\"eplus-0T5B0u\">The steps performed will be very similar to those performed by the apply command, but in this case with a view to removal:<\/p>\n\n\n\n<ul class=\"eplus-mCC0LH wp-block-list\"><li>re-execute a resource plan, but unlike \u2018plan\u2019 and \u2018apply\u2019, this time Terraform will show us which resources will be deleted<\/li><li>For security reasons, a confirmation request will be made<\/li><li>When the operation is confirmed, Terraform will begin to call the &#8220;bees&#8221; to proceed with the destruction, displaying a log of the operations carried out on the video.<\/li><li>At the end of the destruction operation, you will be presented with a summary of the operations you have carried out.<\/li><\/ul>\n\n\n\n<p class=\"eplus-y861bS\">Here is an example of the destruction log:<\/p>\n\n\n\n<div class=\"wp-block-image eplus-g9tkcz\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"606\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image10-1024x606.png\" alt=\"Terraform AWS\" class=\"wp-image-9432\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image10-1024x606.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image10-300x178.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image10-768x455.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/image10.png 1253w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p class=\"eplus-troRCu\">To check the result, simply log into the console.<\/p>\n\n\n\n<h2 class=\"eplus-ua9G4G wp-block-heading\" id=\"h-what-we-have-learned\">What we have learned<\/h2>\n\n\n\n<ul class=\"eplus-VlpS9S wp-block-list\"><li>Terraform interfaces with AWS<\/li><li>Basic Terraform concepts: plan, apply and destroy commands<\/li><li>What the terraform.tfstate file is for<\/li><li>How Terraform uses idempotency and manages changes<\/li><li>The usefulness of having code that describes the state of our infrastructure.<\/li><\/ul>\n\n\n\n<h5 class=\"gb-headline gb-headline-6d678b53\">Launching your event<\/h5>\n\n\n\n<h2 class=\"eplus-viWvHk wp-block-heading\" id=\"h-want-to-launch-a-developer-event-despite-the-challenges-of-covid-19\">Want to launch a developer event despite the challenges of  COVID-19?<\/h2>\n\n\n\n<p class=\"eplus-Dlirgv\">If you want to know more about how modern technologies and tools can support you for \u2013 and during \u2013 the organisation of a virtual event, don\u2019t miss this article showcasing the best tools we used to&nbsp;<a style=\"user-select: auto;\" href=\"https:\/\/www.codemotion.com\/magazine\/articles\/events\/hosting-virtual-conference\/\">host our online conferences<\/a>&nbsp;since the COVID-19 outbreak.<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Working with the Cloud is a great opportunity, as it offers access to a series of services and infrastructures that until recently were beyond the reach of all except corporations. However, &#8220;with great powers come great responsibilities&#8220;. Managing the amount of information related to this new infrastructure is not an easy task and can lead,&nbsp;&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\">Read more<\/a><\/p>\n","protected":false},"author":103,"featured_media":9440,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":11,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[5244],"tags":[71,7224],"collections":[],"class_list":{"0":"post-9414","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-cloud","8":"tag-aws","9":"tag-terraform","10":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Terraform AWS: Up and Running in 25 Minutes - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"In this tutorial, we&#039;ll learn how to create an SQS queue based on the Infrastructure as Code (IaC) \u201cphilosophy\u201d, using AWS Terraform.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Terraform AWS: Up and Running in 25 Minutes\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we&#039;ll learn how to create an SQS queue based on the Infrastructure as Code (IaC) \u201cphilosophy\u201d, using AWS Terraform.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-21T09:30:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-05T19:05:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Diego Lagos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Diego Lagos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\"},\"author\":{\"name\":\"Diego Lagos\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/d2fd5340943c72ee9429c7ff78e089b9\"},\"headline\":\"Terraform AWS: Up and Running in 25 Minutes\",\"datePublished\":\"2020-09-21T09:30:12+00:00\",\"dateModified\":\"2022-01-05T19:05:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\"},\"wordCount\":2758,\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png\",\"keywords\":[\"AWS\",\"Terraform\"],\"articleSection\":[\"Cloud\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\",\"name\":\"Terraform AWS: Up and Running in 25 Minutes - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png\",\"datePublished\":\"2020-09-21T09:30:12+00:00\",\"dateModified\":\"2022-01-05T19:05:47+00:00\",\"description\":\"In this tutorial, we'll learn how to create an SQS queue based on the Infrastructure as Code (IaC) \u201cphilosophy\u201d, using AWS Terraform.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png\",\"width\":1200,\"height\":675,\"caption\":\"tutorial terraform\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Cloud\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Terraform AWS: Up and Running in 25 Minutes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Codemotion.Italy\/\",\"https:\/\/x.com\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/d2fd5340943c72ee9429c7ff78e089b9\",\"name\":\"Diego Lagos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3a2794ba6956efb870864dfbddcf44bb33b240312e0a5ebd95f8b27b5c9aeac6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3a2794ba6956efb870864dfbddcf44bb33b240312e0a5ebd95f8b27b5c9aeac6?s=96&d=mm&r=g\",\"caption\":\"Diego Lagos\"},\"url\":\"https:\/\/www.codemotion.com\/magazine\/author\/diego-lagos\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Terraform AWS: Up and Running in 25 Minutes - Codemotion Magazine","description":"In this tutorial, we'll learn how to create an SQS queue based on the Infrastructure as Code (IaC) \u201cphilosophy\u201d, using AWS Terraform.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/","og_locale":"en_US","og_type":"article","og_title":"Terraform AWS: Up and Running in 25 Minutes","og_description":"In this tutorial, we'll learn how to create an SQS queue based on the Infrastructure as Code (IaC) \u201cphilosophy\u201d, using AWS Terraform.","og_url":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2020-09-21T09:30:12+00:00","article_modified_time":"2022-01-05T19:05:47+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png","type":"image\/png"}],"author":"Diego Lagos","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Diego Lagos","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/"},"author":{"name":"Diego Lagos","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/d2fd5340943c72ee9429c7ff78e089b9"},"headline":"Terraform AWS: Up and Running in 25 Minutes","datePublished":"2020-09-21T09:30:12+00:00","dateModified":"2022-01-05T19:05:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/"},"wordCount":2758,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png","keywords":["AWS","Terraform"],"articleSection":["Cloud"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/","url":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/","name":"Terraform AWS: Up and Running in 25 Minutes - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png","datePublished":"2020-09-21T09:30:12+00:00","dateModified":"2022-01-05T19:05:47+00:00","description":"In this tutorial, we'll learn how to create an SQS queue based on the Infrastructure as Code (IaC) \u201cphilosophy\u201d, using AWS Terraform.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png","width":1200,"height":675,"caption":"tutorial terraform"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/terraform-aws\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.codemotion.com\/magazine\/devops\/"},{"@type":"ListItem","position":3,"name":"Cloud","item":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/"},{"@type":"ListItem","position":4,"name":"Terraform AWS: Up and Running in 25 Minutes"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/d2fd5340943c72ee9429c7ff78e089b9","name":"Diego Lagos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3a2794ba6956efb870864dfbddcf44bb33b240312e0a5ebd95f8b27b5c9aeac6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3a2794ba6956efb870864dfbddcf44bb33b240312e0a5ebd95f8b27b5c9aeac6?s=96&d=mm&r=g","caption":"Diego Lagos"},"url":"https:\/\/www.codemotion.com\/magazine\/author\/diego-lagos\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-600x400.png","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-600x600.png","author_info":{"display_name":"Diego Lagos","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/diego-lagos\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png",1200,675,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-150x150.png",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-300x169.png",300,169,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-768x432.png",768,432,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-1024x576.png",1024,576,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png",1200,675,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png",1200,675,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud.png",100,56,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-180x128.png",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-896x504.png",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-400x225.png",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-600x400.png",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/09\/cloud-600x600.png",600,600,true]},"uagb_author_info":{"display_name":"Diego Lagos","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/diego-lagos\/"},"uagb_comment_info":0,"uagb_excerpt":"Working with the Cloud is a great opportunity, as it offers access to a series of services and infrastructures that until recently were beyond the reach of all except corporations. However, &#8220;with great powers come great responsibilities&#8220;. Managing the amount of information related to this new infrastructure is not an easy task and can lead,&nbsp;&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/9414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/103"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=9414"}],"version-history":[{"count":16,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/9414\/revisions"}],"predecessor-version":[{"id":12034,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/9414\/revisions\/12034"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/9440"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=9414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=9414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=9414"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=9414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}