{"id":11194,"date":"2022-07-19T18:59:16","date_gmt":"2022-07-19T13:29:16","guid":{"rendered":"https:\/\/opstree.com\/blog\/\/?p=11194"},"modified":"2022-07-19T19:01:54","modified_gmt":"2022-07-19T13:31:54","slug":"terraform-version-upgrade","status":"publish","type":"post","link":"https:\/\/opstree.com\/blog\/terraform-version-upgrade\/","title":{"rendered":"Terraform Version Upgrade"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2022\/07\/terraform-upgrade-2.png?w=1024\" alt=\"\" class=\"wp-image-11306\" width=\"570\" height=\"319\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Starting the blog with the question &#8211; What is <strong>Terraform<\/strong>?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It can be called a magic wand that creates Infrastructure on the basis of the code that you write.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/vmZ9DtkHJ_pXcoEUgh_YK7yNIQtKNiEWBRcPEwSvCQj7vMZ-x--SgbIluYJEbFJJBzq6RL6lju0JrhZZLB3JRtGYEqOyq7CYOCqrfWw7_H5u1BHElaB75SMlFOegsoCU_PE49i6AfQmmfhGRKw0\" alt=\"\" width=\"453\" height=\"250\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">In <strong>Hashicorp\u2019s<\/strong> words, &#8220;<em>Terraform is an open-source Infrastructure as A Code software tool that enables you to safely and predictably create, change, and improve infrastructure.<\/em>&#8220;<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Well coming to our topic, Terraform upgrade. Let\u2019s see what ways we can follow to upgrade Terraform in an environment that is running on a lower Terraform version.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Scenario<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Upgrade from Terraform v0.11.11 \u2192 latest version&nbsp;<\/p>\n\n\n\n<p class=\"has-dark-gray-color has-text-color wp-block-paragraph\">My reaction when I had to perform the <strong>upgrade activity<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"238\" src=\"https:\/\/lh4.googleusercontent.com\/k7ybg38uzFoBmpZB5saPu6AivNPGaaRAgQ82-97w5ZyMDKufrduezXeKZiGcpbYUobKf-LJBh4ksxXHqzFvfJRCnRQ5s7zn3EcMmzVk1B7qMVZjd3YqbeUL5Pz_cruCwu0w9-0RDnJluzBFv-ns\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">There are basically 2 ways in which we can perform the upgrade, do let us know if you have come across any other ways in the comment.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Upgrade to <strong>0.11.14<\/strong> if you are running a version lesser than that to move to <strong>0.12.x<\/strong> version<\/li><li>Take the state file of the current environment, and follow the blog to know further \ud83d\ude09&nbsp;<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>GitHub link:<\/strong> <a href=\"https:\/\/github.com\/prakashjha08\/vpc-module\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/prakashjha08\/vpc-module<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Module block:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#25f306;\">provider \"aws\" {\n  region  = \"ap-south-1\"\n}\n\nmodule \"vpc\" {\n  source      = \"git@github.com:prakashjha08\/vpc-module.git?ref=main\"\n  # source = \".\/vpc\"\n  vpc_cidr    = \"10.0.0.0\/16\"\n  subnet_cidr = [\"10.0.0.0\/20\", \"10.0.16.0\/20\"]\n  sg_name     = \"tf-upgrade\"\n  ingress_rules = {\n    \"tcp,443,443\" = \"10.0.0.0\/20,10.0.16.0\/20\"\n    \"tcp,1,65535\" = \"10.0.32.0\/20,10.0.48.0\/20\"\n    \"tcp,80,80\"   = \"10.0.64.0\/20,10.0.80.0\/20\"\n  }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Option-1:<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Terraform suggests installing version 0.11.14 at first to seamlessly move to further versions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s have a look.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To check the TF version \u2192 Use <strong>terraform -version<\/strong> command&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Download version 0.11.14 from <a href=\"https:\/\/releases.hashicorp.com\/terraform\/0.11.14\/\" target=\"_blank\" rel=\"noopener\">https:\/\/releases.hashicorp.com\/terraform\/0.11.14\/<\/a>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/RHU1IIgxQ1pl0fvEzRa5Rj_S2jNG2p4P-wlwgkTmDxYY-6Qwb7toI8Eg89TUcxUlbOAnLWM9PcH7oT9Rr2YVuu5KTJ1YxA9SFzxi9CvcY__SsCm8XXLmzQgrdSQ6VeJztNqj9E0yBzP0ENvEH9E\" alt=\"\" width=\"800\" height=\"163\" \/><figcaption class=\"wp-element-caption\"><strong>Checking TF version<\/strong><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Terraform provides us with a command to check\/instruct how to upgrade.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/ZyxoLmPVGFOO7ZTuVt5JbF4PCOlI-kXMmnOSP6oBpz0TacuQbSOaezmzgtqTeJSWq78u1hYAFYR8RnTSzRIw1zIFJvFxSSfBaOGGcr5SZxYN6jOEBYgbzk3VBaqThfaOrk-6CN8uPloyKNBCPuk\" alt=\"\" width=\"695\" height=\"176\" \/><figcaption class=\"wp-element-caption\"><strong>terraform 0.12checklist<\/strong><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Changes need to be made in the provider block.<\/p>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#4cf602;\">provider \"aws\" {\n  region = \"ap-south-1\"\n  version = \"~&gt; 4.22.0\"\n}<\/pre>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Validation succeeds once you change the version, now we will have to download 0.12.31 as it supports AWS provider version ~&gt; 4.22.0 and run terraform init, then terraform 0.12upgrade<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/L00PuZPeoq7AwwwrR3qTk4J8jKjXt7e-9AKqFWW6CzW4JvsxuDNxD4GiMXeRvavRJAf5HFCJYiVdeTN0MDARkgmnQfJfNYTnlRrI4tMOoRE072NeIFmQRvIrZAgFTV1okRHjU0rd5tVsPhZAETA\" alt=\"\" width=\"651\" height=\"647\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And, you have successfully upgraded to <strong>v0.12.31<\/strong>!!<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">After upgrading to terraform 0.12.31, you will be able to see a few warnings related to interpolation as below<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/dUrqqaG0rnMpsQJkI093i1UELU-b-m6dJyF9tz4_A-IRE17XPyFQTMPd_oxhd2QWmb--e1TeUkFK0fh-394pT8EytU4xX5fhS3xHVzfi4onVPjJMAeyCElCW17qlBWGUxlrQaNuJ7DmMr1CJBaQ\" alt=\"\" width=\"598\" height=\"494\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">You can work on these, else, SPOILER ALERT!!, these errors will come back in the later versions.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Remove \u201c${,}\u201d and quoted types like \u201cstring\u201d -&gt; string<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Install 0.13.5 and run terraform 0.13upgrade and terraform init<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/plV27bsppcexi1iJ3eoMOIxGsbIGPS2rZyQCgZiaaEaf9FsFH-DfIkiVjoSanwWWUNNLFsPqDv-gxPiicyHYPo3AjDHVSIJ1FiZw5Wxy6MgYxlfHntg0T4kdsigBOeY_E_Q1nBHXhV2eZM__6ok\" alt=\"\" width=\"700\" height=\"187\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Install 0.14.0, move version constraint to <strong>required_providers<\/strong> block or remove the version argument and run terraform init and apply to update the state file.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">You can directly upgrade to the latest version from here and run terraform init -upgrade<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Congratulations, your infra is upgraded to the latest version.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s all about a straightforward upgrade.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Option-2:<\/strong><\/h4>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">I was working on an Infra, where the code in v0.11.11 was out of sync, in that case, we will have to use Option 2, which seems a little tricky as we will be seeing a new command, <strong>terraform import<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/ZcuJYBuaMJoFNK0fOgewjhEwocsZsBb0ARi_YMQSG_PyYNuzy-WrfnKFBdCk51C4S0TrDZcTXMOgwC8n6j7xwI6YohBS7RMdA_b8GnNHlMrhnnQavP8Kfly4dPuUMEdYHqar7tkf0zu60eYh1g\" alt=\"\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Terraform import helps you to import resources to state file that were created either manually or via some other IaC tools (Cloudformation, Pulumi, boto3, etc). Once the import is done, we will be able to manage the resources using Terraform, so apply destroy commands can be used.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Before importing, we need to make sure that a resource block already exists in the configuration files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax:<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Import module: terraform import module.&lt;module_name&gt;.aws_vpc.&lt;resource_name&gt; &lt;resource_id&gt;<\/li><li>Import resource: terraform import aws_vpc.&lt;resource_name&gt; &lt;resource_id&gt;<\/li><\/ol>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Module blocks were present on a git repository and were cloned on an EC2 Instance, from where it was getting managed.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">I followed these steps on the instance:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>terraform show<\/strong> for the v0.11.11 state.<\/li><li>Take the ID and resource names&nbsp;<\/li><li>Copied the output of <strong>terraform show<\/strong> and cloned the git repository to local<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/HGzVXMtNOz0wA_nPzy-aj7r6dICMy7rGNjiQLN02yP5_TOPPSxc5Q_1vARp_XJayhNWcI6y7sZK97CN12WpTOS-cOhU27I0zs8FjyXepGQ06gFsQEF6HaQj154bQPoR6kyk6tCYp_PPwI9e-SQ\" alt=\"\" width=\"574\" height=\"668\" \/><figcaption class=\"wp-element-caption\"><strong>terraform show<\/strong><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I had to remove the interpolations(warnings) and quoted types(errors) from variables as they are not supported in the latest version.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/70Yl5cwUs1JIMEKVTKXvldMC2oqNtuSFfvUGbrTN69qO4Vz2kBK4vqpA8H17Vj1p_XdQ3q3mhRW2x_kzX_wgaR020Kru0Mv44PLVEO9LhPS7aNTRrKhZnhbIMHBSVCVTrwPYoXVy-MnFbjXthQ\" alt=\"\" width=\"800\" height=\"163\" \/><figcaption class=\"wp-element-caption\"><strong>Backend block for v0.11.11<\/strong><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/duqUSO2mHye0T3HtyPlmuzhj6J3-KP5ZfP6CmFwpsR-MK40SX1I0qElYFLRqHp0jsBcGANFt8Oyqw5u1szr0eR7M1uxzn5T1Recfh0oaMZq6dNVutcLcMSexOREBohQFiwBHi9OepbKCexxK_g\" alt=\"\" width=\"800\" height=\"120\" \/><figcaption class=\"wp-element-caption\"><strong>Backend block for v1.2.2<\/strong><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Once you change the backend config in a different directory, you are good to go with the importing of resources that were created with earlier versions.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Importing VPC:<\/strong><\/h5>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Command:<\/strong><\/h6>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#24f300;\">terraform import module.vpc.aws_vpc.vpc vpc-09b279ec86986776d<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Output:<\/h6>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#c8f904;\">module.vpc.aws_vpc.vpc: Importing from ID \"vpc-09b279ec86986776d\"...\nmodule.vpc.aws_vpc.vpc: Import prepared!\n  Prepared aws_vpc for import\nmodule.vpc.aws_vpc.vpc: Refreshing state... [id=vpc-09b279ec86986776d]\n\nImport successful!\n\nThe resources that were imported are shown above. These resources are now in\nyour Terraform state and will henceforth be managed by Terraform.\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Importing subnets:<\/h5>\n\n\n\n<h6 class=\"wp-block-heading\">Command:<\/h6>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#01f505;\">terraform import module.vpc.aws_subnet.subnet[0] subnet-0b1829adb8d262da6\nterraform import module.vpc.aws_subnet.subnet[1] subnet-0d2d485fab98d7d6c<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Output:<\/h6>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#d6ff00;\">module.vpc.aws_subnet.subnet[0]: Importing from ID \"subnet-0b1829adb8d262da6\"...\nmodule.vpc.aws_subnet.subnet[0]: Import prepared!\n  Prepared aws_subnet for import\nmodule.vpc.aws_subnet.subnet[0]: Refreshing state... [id=subnet-0b1829adb8d262da6]\n\n\nmodule.vpc.aws_subnet.subnet[1]: Importing from ID \"subnet-0d2d485fab98d7d6c\"...\nmodule.vpc.aws_subnet.subnet[1]: Import prepared!\n  Prepared aws_subnet for import\nmodule.vpc.aws_subnet.subnet[1]: Refreshing state... [id=subnet-0d2d485fab98d7d6c]\n\nImport successful!\n\nThe resources that were imported are shown above. These resources are now in\nyour Terraform state and will henceforth be managed by Terraform.\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Importing security group and rules:<\/h5>\n\n\n\n<h6 class=\"wp-block-heading\">Command:<\/h6>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#42f600;\">$ terraform import module.vpc.aws_security_group.sg sg-08ed5e41159e59299\n\n$ terraform import module.vpc.aws_security_group_rule.ingress[0] sg-08ed5e41159e59299_ingress_tcp_1_65535_10.0.32.0\/20_10.0.48.0\/20\n\n$ terraform import module.vpc.aws_security_group_rule.ingress[1] sg-08ed5e41159e59299_ingress_tcp_443_443_10.0.0.0\/20_10.0.16.0\/20\n\n$ terraform import module.vpc.aws_security_group_rule.ingress[2] sg-08ed5e41159e59299_ingress_tcp_80_80_10.0.64.0\/20_10.0.80.0\/20\n\n$ terraform import module.vpc.aws_security_group_rule.egress sg-08ed5e41159e59299_egress_all_0_0_0.0.0.0\/0\n<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Output:<\/h6>\n\n\n\n<pre class=\"wp-block-verse has-dark-gray-background-color has-text-color has-background\" style=\"color:#d7f900;\">module.vpc.aws_security_group.sg: Importing from ID \"sg-08ed5e41159e59299\"...\nmodule.vpc.aws_security_group.sg: Import prepared!\n  Prepared aws_security_group for import\nmodule.vpc.aws_security_group.sg: Refreshing state... [id=sg-08ed5e41159e59299]\n\nmodule.vpc.aws_security_group_rule.ingress[0]: Importing from ID \"sg-08ed5e41159e59299_ingress_tcp_1_65535_10.0.32.0\/20_10.0.48.0\/20\"...\nmodule.vpc.aws_security_group_rule.ingress[0]: Import prepared!\n  Prepared aws_security_group_rule for import\nmodule.vpc.aws_security_group_rule.ingress[0]: Refreshing state... [id=sg-08ed5e41159e59299_ingress_tcp_1_65535_10.0.32.0\/20_10.0.48.0\/20]\n\nmodule.vpc.aws_security_group_rule.ingress[1]: Importing from ID \"sg-08ed5e41159e59299_ingress_tcp_443_443_10.0.0.0\/20_10.0.16.0\/20\"...\nmodule.vpc.aws_security_group_rule.ingress[1]: Import prepared!\n  Prepared aws_security_group_rule for import\nmodule.vpc.aws_security_group_rule.ingress[1]: Refreshing state... [id=sg-08ed5e41159e59299_ingress_tcp_443_443_10.0.0.0\/20_10.0.16.0\/20]\n\nmodule.vpc.aws_security_group_rule.ingress[2]: Importing from ID \"sg-08ed5e41159e59299_ingress_tcp_80_80_10.0.64.0\/20_10.0.80.0\/20\"...\nmodule.vpc.aws_security_group_rule.ingress[2]: Import prepared!\n  Prepared aws_security_group_rule for import\nmodule.vpc.aws_security_group_rule.ingress[2]: Refreshing state... [id=sg-08ed5e41159e59299_ingress_tcp_80_80_10.0.64.0\/20_10.0.80.0\/20]\n\nmodule.vpc.aws_security_group_rule.egress: Importing from ID \"sg-08ed5e41159e59299_egress_all_0_0_0.0.0.0\/0\"...\nmodule.vpc.aws_security_group_rule.egress: Import prepared!\n  Prepared aws_security_group_rule for import\nmodule.vpc.aws_security_group_rule.egress: Refreshing state... [id=sg-08ed5e41159e59299_egress_all_0_0_0.0.0.0\/0]<\/pre>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Once all the resources are imported, run the plan command to check if anything is getting changed\/destroyed, resolve it, and apply the configuration.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/1uCEtgtSNNnFcYNS2aONl-LMkLTVo4H8KXN9A0Q32SAYtwQhLP36JNJsJM1dWJY6gNTONy9gRA5zRIl0FsDJTDM8v5c5t1rq95mRxI482c6U0sY88RPZxpJrRL0JEd2eRiAHPPnXStEr-I4zEw\" alt=\"\" width=\"553\" height=\"292\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">So, Terraform upgrade is now completed with the import command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion:<\/strong><\/h2>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Key takeaways from this blog:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>How to upgrade the TF version<\/li><li>Multiple terraform commands<\/li><\/ol>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Both the ways seem to work fine for upgrade, <strong>Option-1<\/strong> is best suited for infrastructure that is in sync with the TF code, and <strong>Option-2<\/strong> can be used to cut the middle versions out and directly import existing resources to new code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The choice is yours. Hope this blog helps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Time to go!<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/fEUBKC66HAjLgNoxqtfV9OUseGrRRbI1hGElXLmZuPtZOadmsiVUkYnCxBvJbSmyori7oA4rT800DjiKTEn7r-YyoaBbOoi4Kq8_beZQrM0qxjNEJMTaabzxsSJrNFR55o2OfvRlnHwOUvNMaw\" alt=\"\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you have come this far, a big shout-out to you. Thanks for reading the whole blog.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Happy Learning! \ud83d\ude42 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Image References:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/tenor.com\/view\/oops-steve-carell-yikes-the-office-michael-scott-gif-13573950\" target=\"_blank\">https:\/\/tenor.com\/view\/oops-steve-carell-yikes-the-office-michael-scott-gif-13573950<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/imgflip.com\/memetemplate\/292486392\/Thats-As-Clear-As-I-Can-Make-It\" target=\"_blank\">https:\/\/imgflip.com\/memetemplate\/292486392\/Thats-As-Clear-As-I-Can-Make-It<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/tenor.com\/view\/the-office-ugh-silly-dance-gif-16763353\" target=\"_blank\">https:\/\/tenor.com\/view\/the-office-ugh-silly-dance-gif-16763353<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Blog Pundit:<\/strong>&nbsp;<a href=\"https:\/\/opstree.com\/blog\/\/author\/bhupendersinghb5dca0b393\/\"><strong>Bhupender rawat<\/strong><\/a>&nbsp;and&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/opstree.com\/blog\/\/author\/sandeep7c51ad81ba\/\" target=\"_blank\"><strong>Sandeep Rawat<\/strong><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><a rel=\"noreferrer noopener\" href=\"https:\/\/www.opstree.com\/contact-us?utm_source=WordPress&amp;utm_medium=Blog&amp;utm_campaign=Terraform_Version_Upgrade\" target=\"_blank\">Opstree<\/a><\/strong>&nbsp;is an End to End DevOps solution provider.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.opstree.com\/contact-us?utm_source=WordPress&amp;utm_medium=Blog&amp;utm_campaign=Terraform_Version_Upgrade\" target=\"_blank\" rel=\"noreferrer noopener\">CONTACT US<\/a><\/div>\n<\/div>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong>Connect Us <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-social-links aligncenter is-content-justification-right is-layout-flex wp-container-core-social-links-is-layout-026eaadd wp-block-social-links-is-layout-flex\"><li class=\"wp-social-link wp-social-link-linkedin wp-block-social-link\"><a href=\"https:\/\/www.linkedin.com\/company\/opstree-solutions\" class=\"wp-block-social-link-anchor\" target=\"_blank\" rel=\"noopener\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">LinkedIn<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-youtube wp-block-social-link\"><a href=\"https:\/\/www.youtube.com\/channel\/UCeLma6SpNYH7jjYKSBNSexw\" class=\"wp-block-social-link-anchor\" target=\"_blank\" rel=\"noopener\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">YouTube<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-github wp-block-social-link\"><a href=\"https:\/\/github.com\/OpsTree\" class=\"wp-block-social-link-anchor\" target=\"_blank\" rel=\"noopener\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">GitHub<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-facebook wp-block-social-link\"><a href=\"https:\/\/www.facebook.com\/opstree\" class=\"wp-block-social-link-anchor\" target=\"_blank\" rel=\"noopener\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Facebook<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-medium wp-block-social-link\"><a href=\"https:\/\/medium.com\/buildpiper\" class=\"wp-block-social-link-anchor\" target=\"_blank\" rel=\"noopener\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M13.2,12c0,3-2.4,5.4-5.3,5.4S2.6,15,2.6,12s2.4-5.4,5.3-5.4S13.2,9,13.2,12 M19.1,12c0,2.8-1.2,5-2.7,5s-2.7-2.3-2.7-5s1.2-5,2.7-5C17.9,7,19.1,9.2,19.1,12 M21.4,12c0,2.5-0.4,4.5-0.9,4.5c-0.5,0-0.9-2-0.9-4.5s0.4-4.5,0.9-4.5C21,7.5,21.4,9.5,21.4,12\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Medium<\/span><\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Starting the blog with the question &#8211; What is Terraform? It can be called a magic wand that creates Infrastructure on the basis of the code that you write.&nbsp; In Hashicorp\u2019s words, &#8220;Terraform is an open-source Infrastructure as A Code software tool that enables you to safely and predictably create, change, and improve infrastructure.&#8220;<\/p>\n","protected":false},"author":201814660,"featured_media":29900,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[28070474],"tags":[44070,768739308,59002157,343865,3021235],"class_list":["post-11194","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-automation","tag-devops","tag-infrastructure-as-code","tag-technical-blog","tag-terraform"],"blocksy_meta":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/opstree.com\/blog\/wp-content\/uploads\/2025\/11\/DevSecOps-1.jpg","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfDBOm-2Uy","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/11194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/users\/201814660"}],"replies":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/comments?post=11194"}],"version-history":[{"count":25,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/11194\/revisions"}],"predecessor-version":[{"id":11316,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/11194\/revisions\/11316"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media\/29900"}],"wp:attachment":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media?parent=11194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/categories?post=11194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/tags?post=11194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}