<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Programming on shocksolution.com</title><link>https://shocksolution.com/tags/programming/</link><description>Recent content in Programming on shocksolution.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 19 Oct 2021 03:48:29 +0000</lastBuildDate><atom:link href="https://shocksolution.com/tags/programming/index.xml" rel="self" type="application/rss+xml"/><item><title>The Best Mental Model for Writing Terraform Code</title><link>https://shocksolution.com/posts/the-best-mental-model-for-writing-terraform-code/</link><pubDate>Tue, 19 Oct 2021 03:48:29 +0000</pubDate><guid>https://shocksolution.com/posts/the-best-mental-model-for-writing-terraform-code/</guid><description>&lt;p&gt;This article explains my current mental model of Terraform, in the hope that it will save you some time in your learning process. The foundation of using any programming language or software tool correctly is to develop a valid mental model for it, and refine your model as you learn more. There isn&amp;rsquo;t one correct mental model, and your mental model must evolve as your understanding grows.&lt;/p&gt;&#10;&lt;p&gt;Your introduction to writing Terraform code is usually through a very simple example. Unfortunately, simple examples can obscure some of the fundamental concepts of the language. For example, when I first started with Terraform, I did not understand the difference between a variable and a local. Variables need to be declared in a .tf file and defined (assigned a value) in a .tfstate file (or through other means). Variables seem complicated compared to locals. You can just assign a variable to a local and start using it, like a variable in Python. Why use variables when locals seem so much easier?&lt;/p&gt;</description></item></channel></rss>