{"id":2330,"date":"2021-12-12T12:43:39","date_gmt":"2021-12-12T18:43:39","guid":{"rendered":"https:\/\/www.ciraltos.com\/?p=2330"},"modified":"2023-03-23T05:31:38","modified_gmt":"2023-03-23T10:31:38","slug":"input-variables-with-terraform-and-azure","status":"publish","type":"post","link":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/","title":{"rendered":"Input Variables with Terraform and Azure"},"content":{"rendered":"\n<figure class=\"wp-block-image alignleft size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"176\" height=\"186\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/11\/Terraform_VerticalLogo_Color_RGB-2.png\" alt=\"\" class=\"wp-image-2303\"\/><\/figure>\n\n\n\n<p>Variables allow us to easily modify terraform configurations\nwith minimal changes to the code.&nbsp; Variables\nare an essential part of making reusable code across multiple deployments or environments.&nbsp; In this post and accompanying video, we will\nreview using variables in Terraform.<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"ast-oembed-container\" style=\"height: 100%;\"><iframe loading=\"lazy\" title=\"Input Variables with Terraform and Azure\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/UETRaGjpJoQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>A previous video on creating a Terraform and Azure development environment can be found <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/www.ciraltos.com\/getting-started-with-terraform-and-azure-overview-and-setup\/\" target=\"_blank\">here<\/a>.  <br>Understanding and creating a Terraform workflow can be found <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/www.ciraltos.com\/terraform-workflow-with-azure-write-plan-and-apply\/\" target=\"_blank\">here<\/a>.<\/p>\n<\/blockquote>\n\n\n\n<h1>Variable Block<\/h1>\n\n\n\n<p>A variable block starts with, you guessed it, the word\nvariable.&nbsp; After that is the local name\nfor the variable in double-quotes.&nbsp; The\nlocal name is referenced in the resources that use the variable. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">variable \"azure_location\" {\n&nbsp; type&nbsp;&nbsp;&nbsp; = string\n&nbsp; default = \u201cWest US\u201d\n}<\/pre>\n\n\n\n<p>Arguments for the variable are wrapped in squiggly\nbrackets.&nbsp; The arguments available for a\nvariable block are:<\/p>\n\n\n\n<h2>Type<\/h2>\n\n\n\n<p>The data type for the variable input.&nbsp; This can be set to a string, a number, or a\nbool.&nbsp; Setting the data type is optional\nbut recommended for input validation.<\/p>\n\n\n\n<h2>Default<\/h2>\n\n\n\n<p>The default argument applies unless another value is\nspecified during deployment.&nbsp; Setting a\ndefault value makes the variable optional.<\/p>\n\n\n\n<h2>Description<\/h2>\n\n\n\n<p>A description is used to document the input variable.&nbsp; The description is optional but recommended\nbecause documenting is a good thing to do.<\/p>\n\n\n\n<h2>Validation<\/h2>\n\n\n\n<p>A validation block creates input rules for the variable.&nbsp; Use with <em>Type<\/em> and <em>Description<\/em>\nblock to add validation rules to the variable.<\/p>\n\n\n\n<h2>Sensitive<\/h2>\n\n\n\n<p>The sensitive block limits the output of the variable, so\nit\u2019s not viewable in the CLI.&nbsp; This is\nuseful if passwords or secrets are used with variables.<\/p>\n\n\n\n<p>The example below shows variable blocks for the location,\nresource group name, and storage account name in a main.tf file in a project.&nbsp; Default values are supplied for the location\nand the resource group name but not for the storage account.&nbsp; Storage account names are globally unique;\nspecifying a default would provide no value.&nbsp;\nA storage account name is provided when we deploy the resources.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"533\" height=\"402\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Terraform-Variables.png\" alt=\"\" class=\"wp-image-2334\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Terraform-Variables.png 533w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Terraform-Variables-300x226.png 300w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><figcaption class=\"wp-element-caption\"> Terraform Variables <\/figcaption><\/figure>\n\n\n\n<h1>Use Variables<\/h1>\n\n\n\n<p>Now that we have the variable blocks, we need to use them in\nthe code.&nbsp; The example below shows a resource\nblock that creates a Resource Group.&nbsp; The\nexample uses a string for the name and location.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">resource \"azurerm_resource_group\" \"resourcegroup\" {\n&nbsp; name&nbsp;&nbsp;&nbsp;&nbsp; = \u201cTerraformRG\u201d\n&nbsp; location = \u201cWest US\u201d\n}<\/pre>\n\n\n\n<p>We create a variable called <em>azure_location<\/em> in the\nprevious example.&nbsp; To use the variable\ninstead of the literal string, replace \u201cWest US\u201d with <em>var.azure_location<\/em>.&nbsp; The updated block of code looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">resource \"azurerm_resource_group\" \"resourcegroup\" {\n&nbsp; name&nbsp;&nbsp;&nbsp;&nbsp; = \u201cTerraformRG\u201d\n&nbsp; location = var.azure_location\n}<\/pre>\n\n\n\n<p>Now, if we modify the varialbel block to change the location,\nCentral US, for the example below, all instances of <em>var.azure_location <\/em>will\nuse the updated location.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">variable \"azure_location\" {\n&nbsp; type&nbsp;&nbsp; &nbsp;= string\n&nbsp; default = \u201cCentral US\u201d\n}<\/pre>\n\n\n\n<p>The above settings may seem like a lot of extra work.&nbsp; For the example above, it would have been\neasier to change the location in the resource.&nbsp;\nHowever, if we are dealing with a large deployment with multiple\nresources, changing each instance of a location would be cumbersome end error-prone.&nbsp; We specify the new value with variables, and\nany reference to that variable uses the new setting.<\/p>\n\n\n\n<p>The example below shows the resource account name and\nlocation, and the storage account name updated to use a variable instead of a\nstring value.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"761\" height=\"302\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Resource-Block-with-Variables.png\" alt=\"\" class=\"wp-image-2335\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Resource-Block-with-Variables.png 761w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Resource-Block-with-Variables-300x119.png 300w\" sizes=\"(max-width: 761px) 100vw, 761px\" \/><figcaption class=\"wp-element-caption\"> Resource Block with Variables <\/figcaption><\/figure>\n\n\n\n<h1>Variable Files<\/h1>\n\n\n\n<p>We can leave the variable blocks in the main.tf file, but it\nwould be helpful to move the variables into a differnt file.&nbsp; Terraform treats all .tf files in a directory\nas one file. Shifting the variable into a different file makes the code more\nreadable for us humans.<\/p>\n\n\n\n<p>Create a new file in the project called variables.tf, or\nvar.tf.&nbsp; then, cut the variable blocks\nform the main.tf file and paste them into the new variables.tf file.&nbsp; Be sure to save both files.&nbsp; <\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>Add comments to Terraform by adding the hash (#) symbol.&nbsp; The comment starts at the hash symbol and ends at the end of the line.<\/p>\n<\/blockquote>\n\n\n\n<p>Once finished, you will have a variable.tf file that looks similar\nto below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"543\" height=\"484\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Variable.tf-File.png\" alt=\"\" class=\"wp-image-2336\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Variable.tf-File.png 543w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Variable.tf-File-300x267.png 300w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><figcaption class=\"wp-element-caption\"> Variable.tf File <\/figcaption><\/figure>\n\n\n\n<h2>Change Variables at the Command Line<\/h2>\n\n\n\n<p>We have our variable blocks in the new varialbes.tf file and\nthe resource blocks reference the variables.&nbsp;\nIt would fail if we tried to run a terraform plan because no name has\nbeen provided for the storage account.&nbsp;\nThere are a couple of options for setting variables; one is at the\ncommand line with a -var option.&nbsp; The\ncommand below runs a terraform plan passing in the name for the storage account.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Terraform plan -var=\"stgactname=cirtest332244423\" <\/pre>\n\n\n\n<p>Running the terraform plan command with the variable will\nadd the storage account name as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Terraform-Plan-with-Command-Line-Variable.png\" alt=\"\" class=\"wp-image-2337\"\/><figcaption class=\"wp-element-caption\"> Terraform Plan with Command-Line Variable <\/figcaption><\/figure>\n\n\n\n<h1>Variable Definitions File<\/h1>\n\n\n\n<p>Using the command line to set variables would work, but that\nbecomes cumbersome with large deployments.&nbsp;\nWe could modify the default values for the variables with each\ndeployment, but that\u2019s not how a variable is supposed to work.&nbsp; Defaults values should only use when it is\nlikely that the default value will be unchanged across multiple\ndeployments.&nbsp; <\/p>\n\n\n\n<p>A better alternative to passing variables at the command line\nis a variable definition file.&nbsp; A\nvariable definition sets variables, overriding default values set in the\nvariables.tf file.&nbsp; The name for a variable\ndefinition file can be terraform.tfvars or any file name followed by\n.auto.tfvars.&nbsp; Both options will\nautomatilcy be applied to the configuration. &nbsp;&nbsp;In the example below, we create a\nterraform.tfvars file in the same directory as the main.tf and varialbes.tf\nfile.&nbsp; The variable value&#8217;s format is the\nvariable&#8217;s name, the equal sign followed by the value.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">location = \"centralus\"<\/pre>\n\n\n\n<p>The final terraform.tfvars file look like the image below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"402\" height=\"197\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Terraform.tfvars-File.png\" alt=\"\" class=\"wp-image-2338\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Terraform.tfvars-File.png 402w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Terraform.tfvars-File-300x147.png 300w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/><figcaption class=\"wp-element-caption\"> Terraform.tfvars File <\/figcaption><\/figure>\n\n\n\n<p>We can run a <em>terraform plan<\/em> with our updated\nterraform.tfvars file to verify the output matches values in the definition\nfile.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"650\" height=\"518\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Variable-Definitions-Output.png\" alt=\"\" class=\"wp-image-2339\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Variable-Definitions-Output.png 650w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Variable-Definitions-Output-300x239.png 300w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><figcaption class=\"wp-element-caption\"> Variable Definitions Output <\/figcaption><\/figure>\n\n\n\n<h2>Three Files<\/h2>\n\n\n\n<p>The number of configuration files has grown from one main.tf\nfile to three different files.&nbsp; Organizing\nthe configuration files provides scalability with more complex deployments and\na uniform way to write code.&nbsp; The three\nfiles we have so far include:<\/p>\n\n\n\n<p><strong>main.tf<\/strong> \u2013 The main configuration file for resource deployment.<br><strong>variables.tf<\/strong> \u2013 The file for variables used for the deployment.<br><strong>terraform.tfvars <\/strong>\u2013 The variable definition file used to set the variables for the deployment.<\/p>\n\n\n\n<p>With this file layout, we only need to modify the values of\nvariables in the terraform.tfvars file to create a new deployment.<\/p>\n\n\n\n<h1>Locals<\/h1>\n\n\n\n<p>There is one more variable option that we should cover\ncalled Locals.&nbsp; Locals work much like\nvariables.&nbsp; We create a code block with\nname, value pairs, and reference that name in the code.&nbsp; However, Locals have a different use case\nfrom variables.&nbsp; They are intended for repeating\nexpressions in the code that may change.&nbsp;\nFor example, if the code included a company name multiple times, a Local\ncould be used instead of repeating the company name in the code.&nbsp; The local value would not be updated with new\ndeployments. However, if that code was moved to another organization, the local\ncould be updated with the new organization&#8217;s name.<\/p>\n\n\n\n<p>Locals are helpful for changing expressions but could make\nthe code hard to read if used too frequently.&nbsp;\nUse locals sparingly to avoid over-complicating the code.<\/p>\n\n\n\n<p>Locals are added by cratering a Locals block in the main.tf.&nbsp; The block starts with <em>Locals<\/em> followed\nby an opening and closing squiggly bracket.&nbsp;\nName, value pairs can be grouped together in one block.&nbsp; For example, to create a Local called Name\nwith our name as the value, enter:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">locals {\n&nbsp; name = \u201cTravis\u201d\n}<\/pre>\n\n\n\n<p>The example below creates a new Locals block for resource\ntags.&nbsp; Notice the local <em>tags<\/em> has a\nlist of name, value pairs for the tags.&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"328\" height=\"147\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Local-Tags.png\" alt=\"\" class=\"wp-image-2340\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Local-Tags.png 328w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Local-Tags-300x134.png 300w\" sizes=\"(max-width: 328px) 100vw, 328px\" \/><figcaption class=\"wp-element-caption\"> Local Tags <\/figcaption><\/figure>\n\n\n\n<p>Reference the locals in the code by adding <em>local.name<\/em>.\nFor example, below shows the local value for tags added to the resource group\nand storage account.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"771\" height=\"329\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Local-Reference.png\" alt=\"\" class=\"wp-image-2342\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Local-Reference.png 771w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Local-Reference-300x128.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Local-Reference-768x328.png 768w\" sizes=\"(max-width: 771px) 100vw, 771px\" \/><figcaption class=\"wp-element-caption\"> Local Reference <\/figcaption><\/figure>\n\n\n\n<h1>Verify Configuration<\/h1>\n\n\n\n<p>We have all of our files in place and updated our main.tf\nfile with locals for the resource tags, now it\u2019s time to deploy the\nconfiguration.&nbsp; Save all files, run the\nterraform init and terraform plan commands, and verify the variables and locals\napplied.&nbsp; Notice the <em>terraform plan <\/em>output\nbelow shows tag values.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"561\" height=\"262\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Terraform-Plan-with-Tags.png\" alt=\"\" class=\"wp-image-2343\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Terraform-Plan-with-Tags.png 561w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Terraform-Plan-with-Tags-300x140.png 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><figcaption class=\"wp-element-caption\"> Terraform Plan with Tags <\/figcaption><\/figure>\n\n\n\n<p>Run <em>terraform apply<\/em> to deploy the resources. &nbsp;Once finished, we can go to the portal to\nverify the resource group was created with tags.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"605\" height=\"344\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Resource-Group-Tags.png\" alt=\"\" class=\"wp-image-2344\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Resource-Group-Tags.png 605w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Resource-Group-Tags-300x171.png 300w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><figcaption class=\"wp-element-caption\"> Resource Group Tags <\/figcaption><\/figure>\n\n\n\n<p>We can also verify the storage account name and tags.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"510\" height=\"407\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2021\/12\/Storage-Account-Name-and-Tags.png\" alt=\"\" class=\"wp-image-2345\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Storage-Account-Name-and-Tags.png 510w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/12\/Storage-Account-Name-and-Tags-300x239.png 300w\" sizes=\"(max-width: 510px) 100vw, 510px\" \/><figcaption class=\"wp-element-caption\"> Storage Account Name and Tags <\/figcaption><\/figure>\n\n\n\n<h2>Remove Resources<\/h2>\n\n\n\n<p>Run the <em>terraform destroy<\/em> command to remove the\nresources we just deployed if they are not needed.&nbsp; <\/p>\n\n\n\n<h1>Summary<\/h1>\n\n\n\n<p>That is how to create variables in Terraform, create a\nvariable file, a terraform.tfvars file, and use locals in a configuration\nfile.&nbsp; More Terraform goodness will be\ncoming shortly; stay tuned!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Variables allow us to easily modify terraform configurations with minimal changes to the code.&nbsp; Variables are an essential part of making reusable code across multiple deployments or environments.&nbsp; In this post and accompanying video, we will review using variables in Terraform.<\/p>\n","protected":false},"author":1,"featured_media":2303,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[1159],"tags":[1163,9,992,782,1164,1169,1174,1172,1160,1165,1170,1175,1171,1162,1167,1179,1178,1180,1177,1168,1176,1007,962,1173],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Input Variables with Terraform and Azure - ciraltos<\/title>\n<meta name=\"description\" content=\"In this post and accompanying video, we will review using variables in Terraform and Azure.\" \/>\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.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Input Variables with Terraform and Azure - ciraltos\" \/>\n<meta property=\"og:description\" content=\"In this post and accompanying video, we will review using variables in Terraform and Azure.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/\" \/>\n<meta property=\"og:site_name\" content=\"ciraltos\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-12T18:43:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-23T10:31:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/11\/Terraform_VerticalLogo_Color_RGB-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"176\" \/>\n\t<meta property=\"og:image:height\" content=\"186\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Travis Roberts\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:site\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Travis Roberts\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/\"},\"author\":{\"name\":\"Travis Roberts\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"headline\":\"Input Variables with Terraform and Azure\",\"datePublished\":\"2021-12-12T18:43:39+00:00\",\"dateModified\":\"2023-03-23T10:31:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/\"},\"wordCount\":1502,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"keywords\":[\".tf\",\"Azure\",\"Azure CLI\",\"devops\",\"HashiCorp\",\"IaC Terraform\",\"main.tf\",\"registry\",\"Terraform\",\"Terraform Apply\",\"Terraform Destroy\",\"Terraform for Azure\",\"Terraform Plan\",\"terraform registry\",\"Terraform Resouce\",\"terraform training\",\"terraform tutorial\",\"terraform vairalbes\",\"terraform var\",\"Terraform Write\",\"Terraform.tfvars\",\"Variables\",\"VSCode\",\"workdlow\"],\"articleSection\":[\"Terraform\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/\",\"name\":\"Input Variables with Terraform and Azure - ciraltos\",\"isPartOf\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\"},\"datePublished\":\"2021-12-12T18:43:39+00:00\",\"dateModified\":\"2023-03-23T10:31:38+00:00\",\"description\":\"In this post and accompanying video, we will review using variables in Terraform and Azure.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.ciraltos.com\/staging2\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Input Variables with Terraform and Azure\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\",\"url\":\"http:\/\/www.ciraltos.com\/staging2\/\",\"name\":\"ciraltos\",\"description\":\"cloud, technology and trends\",\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\",\"name\":\"Travis Roberts\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"contentUrl\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"width\":5657,\"height\":3563,\"caption\":\"Travis Roberts\"},\"logo\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.ciraltos.com\",\"https:\/\/twitter.com\/ciraltos\"],\"url\":\"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Input Variables with Terraform and Azure - ciraltos","description":"In this post and accompanying video, we will review using variables in Terraform and Azure.","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.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/","og_locale":"en_US","og_type":"article","og_title":"Input Variables with Terraform and Azure - ciraltos","og_description":"In this post and accompanying video, we will review using variables in Terraform and Azure.","og_url":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/","og_site_name":"ciraltos","article_published_time":"2021-12-12T18:43:39+00:00","article_modified_time":"2023-03-23T10:31:38+00:00","og_image":[{"width":176,"height":186,"url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/11\/Terraform_VerticalLogo_Color_RGB-2.png","type":"image\/png"}],"author":"Travis Roberts","twitter_card":"summary_large_image","twitter_creator":"@ciraltos","twitter_site":"@ciraltos","twitter_misc":{"Written by":"Travis Roberts","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#article","isPartOf":{"@id":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/"},"author":{"name":"Travis Roberts","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"headline":"Input Variables with Terraform and Azure","datePublished":"2021-12-12T18:43:39+00:00","dateModified":"2023-03-23T10:31:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/"},"wordCount":1502,"commentCount":0,"publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"keywords":[".tf","Azure","Azure CLI","devops","HashiCorp","IaC Terraform","main.tf","registry","Terraform","Terraform Apply","Terraform Destroy","Terraform for Azure","Terraform Plan","terraform registry","Terraform Resouce","terraform training","terraform tutorial","terraform vairalbes","terraform var","Terraform Write","Terraform.tfvars","Variables","VSCode","workdlow"],"articleSection":["Terraform"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/","url":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/","name":"Input Variables with Terraform and Azure - ciraltos","isPartOf":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#website"},"datePublished":"2021-12-12T18:43:39+00:00","dateModified":"2023-03-23T10:31:38+00:00","description":"In this post and accompanying video, we will review using variables in Terraform and Azure.","breadcrumb":{"@id":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.ciraltos.com\/staging2\/input-variables-with-terraform-and-azure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.ciraltos.com\/staging2\/"},{"@type":"ListItem","position":2,"name":"Input Variables with Terraform and Azure"}]},{"@type":"WebSite","@id":"http:\/\/www.ciraltos.com\/staging2\/#website","url":"http:\/\/www.ciraltos.com\/staging2\/","name":"ciraltos","description":"cloud, technology and trends","publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a","name":"Travis Roberts","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/","url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","contentUrl":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","width":5657,"height":3563,"caption":"Travis Roberts"},"logo":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.ciraltos.com","https:\/\/twitter.com\/ciraltos"],"url":"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/2330"}],"collection":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/comments?post=2330"}],"version-history":[{"count":8,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/2330\/revisions"}],"predecessor-version":[{"id":3796,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/2330\/revisions\/3796"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media\/2303"}],"wp:attachment":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media?parent=2330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/categories?post=2330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/tags?post=2330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}