{"id":1774,"date":"2022-08-23T05:46:17","date_gmt":"2022-08-23T04:46:17","guid":{"rendered":"https:\/\/www.easydeploy.io\/blog\/?p=1774"},"modified":"2023-03-30T04:40:08","modified_gmt":"2023-03-30T03:40:08","slug":"terraform-workspaces-on-terraform-cloud","status":"publish","type":"post","link":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/","title":{"rendered":"How to Use Terraform Workspaces on Terraform Cloud with VCS?"},"content":{"rendered":"<p><span data-contrast=\"auto\">In our previous articles, we have plained about the <a href=\"https:\/\/www.easydeploy.io\/blog\/terraform-cloud-bitbucket-repository\/\">Terraform Cloud<\/a>, <a href=\"https:\/\/www.easydeploy.io\/blog\/terraform-state-file\/\">Terraform Statefile<\/a> and <a href=\"https:\/\/www.easydeploy.io\/blog\/s3-bucket-aws-terraform-cli-command\/\">Simple Terraform Script<\/a><strong>.<\/strong> In this article, we are going to get some deep knowledge about the <strong>Terraform Workspace<\/strong> with Terraform Cloud. This is an automation process with an end-to-end setup from Bitbucket to AWS via Terraform Cloud for managing multiple environments. <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h2><span data-contrast=\"none\">What is Terraform Workspace?<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\"><strong>Workspaces<\/strong> are simply referring <strong>environments.<\/strong> <span style=\"color: #000080;\"><strong>It helps to store multiple State files independently for multiple environments<\/strong><\/span>.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">If we use multiple environments like<strong> develop, staging<\/strong> and <strong>production,<\/strong> we need to manage independent codes for each and every environment.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">But with the help of Workspaces, we can use a single code for multiple environments and manage the <strong>State files<\/strong> of all the environments independently.\u00a0 It helps to create multiple State files with the same Terraform configurations.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h2><span data-contrast=\"none\">Create Code and Push it to Bitbucket<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h2>\n<h3><span data-contrast=\"none\">Create a Repository\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">Open your Bitbucket account and create a repository.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1779 size-full\" title=\"Terraform workspace Branch\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Branch.png\" alt=\"Terraform workspace Branch\" width=\"1898\" height=\"643\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Branch.png 1898w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Branch-300x102.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Branch-1024x347.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Branch-768x260.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Branch-1536x520.png 1536w\" sizes=\"(max-width: 1898px) 100vw, 1898px\" \/><\/p>\n<ul style=\"font-weight: 400;\">\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">In that repository create a branch called <\/span><b><span data-contrast=\"auto\">feature <\/span><\/b><span data-contrast=\"auto\">from <\/span><b><span data-contrast=\"auto\">master <\/span><\/b><span data-contrast=\"auto\">branch.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">In <strong>VS Code<\/strong> editor open terminal and use <strong>git clone<\/strong> command to clone the repository to your local machine. Then get in the repository folder.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1782 \" title=\"Terraform workspace Create Branch feature\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-feature.png\" alt=\"Terraform workspace Create Branch feature\" width=\"489\" height=\"395\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-feature.png 756w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-feature-300x242.png 300w\" sizes=\"(max-width: 489px) 100vw, 489px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1787 size-full\" title=\"Terraform Workspace Git Clone\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-Git-Clone.png\" alt=\"Terraform Workspace Git Clone\" width=\"1102\" height=\"151\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-Git-Clone.png 1102w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-Git-Clone-300x41.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-Git-Clone-1024x140.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-Git-Clone-768x105.png 768w\" sizes=\"(max-width: 1102px) 100vw, 1102px\" \/><\/p>\n<p>Then use <strong>git checkout<\/strong> command to create a new branch on the local called <strong>feature.<\/strong> And you have automatically entered in that <strong>feature<\/strong> branch.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1786 size-full\" title=\"Terraform workspace git checkout Command\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-checkout-Command.png\" alt=\"Terraform workspace git checkout Command\" width=\"802\" height=\"52\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-checkout-Command.png 802w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-checkout-Command-300x19.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-checkout-Command-768x50.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/p>\n<h3><span data-contrast=\"none\">Write a code to Create EC2 Instance <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">In the repository folder create a file as <strong>main.tf<\/strong>. Copy the below code and paste it in <strong>main.tf<\/strong> file.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<pre><span data-contrast=\"none\">##################### PROVIDER ###############################<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">provider<\/span> <span data-contrast=\"none\">\"aws\"<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">access_key <\/span><span data-contrast=\"none\">=<\/span><span data-contrast=\"none\"> var<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">access_key<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">secret_key <\/span><span data-contrast=\"none\">=<\/span><span data-contrast=\"none\"> var<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">secret_key<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">region\u00a0\u00a0\u00a0\u00a0 <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">\"us-east-1\"<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">###################### LOCALS ###############################<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">locals<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">common_tags <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">{<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\"> \u00a0\u00a0 <\/span><span data-contrast=\"none\">project<\/span><span data-contrast=\"none\">\u00a0\u00a0\u00a0\u00a0 = <\/span><span data-contrast=\"none\">\"Test\"<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\"> \u00a0\u00a0 <\/span><span data-contrast=\"none\">environment<\/span><span data-contrast=\"none\"> = <\/span><span data-contrast=\"none\">terraform<\/span><span data-contrast=\"none\">.workspace<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">  }<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">name_prefix\u00a0\u00a0\u00a0 <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">\"<\/span><span data-contrast=\"none\">${<\/span><span data-contrast=\"none\">var<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">name<\/span><span data-contrast=\"none\">}<\/span><span data-contrast=\"none\">-<\/span><span data-contrast=\"none\">${<\/span><span data-contrast=\"none\">terraform<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">workspace<\/span><span data-contrast=\"none\">}<\/span><span data-contrast=\"none\">\"<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">################### EC2 INSTANCE ##############################<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">resource<\/span> <span data-contrast=\"none\">\"aws_instance\"<\/span> <span data-contrast=\"none\">\"test\"<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">count\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><span data-contrast=\"none\">=<\/span><span data-contrast=\"none\"> var<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">instance_count<\/span><span data-contrast=\"none\">[<\/span><span data-contrast=\"none\">terraform<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">workspace<\/span><span data-contrast=\"none\">]<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">ami\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">\"ami-052efd3df9dad4825\"<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">instance_type <\/span><span data-contrast=\"none\">=<\/span><span data-contrast=\"none\"> var<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">instance_type<\/span><span data-contrast=\"none\">[<\/span><span data-contrast=\"none\">terraform<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">workspace<\/span><span data-contrast=\"none\">]<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">tags <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">merge<\/span><span data-contrast=\"none\">(<\/span><span data-contrast=\"none\">local<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">common_tags<\/span><span data-contrast=\"none\">, {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\"> \u00a0\u00a0 <\/span><span data-contrast=\"none\">Name<\/span><span data-contrast=\"none\"> = <\/span><span data-contrast=\"none\">\"<\/span><span data-contrast=\"none\">${<\/span><span data-contrast=\"none\">local<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">name_prefix<\/span><span data-contrast=\"none\">}<\/span><span data-contrast=\"none\">-<\/span><span data-contrast=\"none\">${<\/span><span data-contrast=\"none\">count<\/span><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">index<\/span><span data-contrast=\"none\">}<\/span><span data-contrast=\"none\">\"<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">  })<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0\r\n<\/span><\/pre>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Using this terraform file, we can create an EC2 Instance.<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">In <strong>locals<\/strong> block we can give a common value for all the resources that we created from this code.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">For the environment section we use a variable <\/span><strong>terraform.<\/strong><span data-contrast=\"none\"><strong>workspace<\/strong>,<\/span><span data-contrast=\"auto\"> which is take the value of the name of the terraform workspace.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">In the resource block, we use two variables for count and <strong>instance_type<\/strong> section. For these two values, we will give values in another file called<strong> terraform.tfvars<\/strong>.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><span data-contrast=\"auto\">Create other 2 files called <strong>variables.tf<\/strong> and <strong>terraform.tfvars<\/strong> and paste the below codes to their respective files.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<pre><span data-contrast=\"none\">############### VARIABLES ###################<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">variable<\/span> <span data-contrast=\"none\">\"access_key\"<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">type <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">string<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">variable<\/span> <span data-contrast=\"none\">\"secret_key\"<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">type <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">string<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">variable<\/span> <span data-contrast=\"none\">\"name\"<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">type <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">string<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">variable<\/span> <span data-contrast=\"none\">\"instance_type\"<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">type <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">map<\/span><span data-contrast=\"none\">(<\/span><span data-contrast=\"none\">string<\/span><span data-contrast=\"none\">)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">variable<\/span> <span data-contrast=\"none\">\"instance_count\"<\/span><span data-contrast=\"none\"> {<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">type <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">map<\/span><span data-contrast=\"none\">(<\/span><span data-contrast=\"none\">number<\/span><span data-contrast=\"none\">)<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span><\/pre>\n<pre><span data-contrast=\"none\">############## TFVARS ####################<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">instance_count <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">{<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">\"Dev\"<\/span><span data-contrast=\"none\">\u00a0 = <\/span><span data-contrast=\"none\">1<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">\"Prod\"<\/span><span data-contrast=\"none\"> = 2<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">\r\ninstance_type <\/span><span data-contrast=\"none\">=<\/span> <span data-contrast=\"none\">{<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">\"Dev\"<\/span><span data-contrast=\"none\">\u00a0 = <\/span><span data-contrast=\"none\">\"t2.micro\"<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n  <span data-contrast=\"none\">\"Prod\"<\/span><span data-contrast=\"none\"> = <\/span><span data-contrast=\"none\">\"t3.small\"<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span>\r\n<span data-contrast=\"none\">}<\/span><span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:285}\">\u00a0<\/span><\/pre>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\">The <strong>terraform.tfvars<\/strong> file is a file that contains default values for the variables that we referred in <strong>variables.tf<\/strong> file.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">Here we are going to use workspaces for differentiate the environments.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">For this we use a map function. So, for each section, we set key-value pairs. For Key section, enter the name of the workspaces that are we going to create like <strong>Dev<\/strong> and <strong>Prod.<\/strong><\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><span data-contrast=\"auto\">For value section under the <strong>instance_count<\/strong>, enter values for <strong>Dev<\/strong> and <strong>Prod<\/strong> for <strong>1<\/strong> &amp; <strong>2<\/strong>.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><span data-contrast=\"auto\">Again, for the <strong>instance_type<\/strong>,\u00a0 enter the values as <strong>t2.micro<\/strong> and <strong>t3.small<\/strong>.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">So, when we deploy this code on <strong>Dev<\/strong> workspace, it creates a single EC2 instance with <strong>t2.micro<\/strong> type. But when deploy it on <strong>Prod<\/strong> workspace, it creates <strong>2<\/strong> Instances with <strong>t3.small<\/strong> type. Now we are going to deploy it and test it, weather it works properly or not.<\/span><\/p>\n<p>Just keep it in mind. We have to check this differences at the end of this session.<\/p>\n<h3><span data-contrast=\"none\">Push the Code to Bitbucket\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">In VS code terminal type &#8220;<strong>git add<\/strong> <strong>*<\/strong>&#8221; command for getting ready to push all the code to the remote repository.<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\"><strong>Git commit<\/strong> command to give a commit message.<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\"><strong>Git push<\/strong> command to push the code to the <strong>feature<\/strong> branch in remote repository.<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1788 \" title=\"Terraform workspace git push Command\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-push-Command.png\" alt=\"Terraform workspace git push Command\" width=\"764\" height=\"315\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-push-Command.png 922w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-push-Command-300x124.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-git-push-Command-768x317.png 768w\" sizes=\"(max-width: 764px) 100vw, 764px\" \/><\/p>\n<p><span data-contrast=\"auto\">Once you push the code to the remote repository, then you have to setup terraform cloud with the Bitbucket for automation process.<\/span><\/p>\n<h2><span data-contrast=\"none\">Setup Terraform Workspace with Bitbucket<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h2>\n<h3><span data-contrast=\"none\">Create 2 Branches on Bitbucket\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">Now we are going to create 2 branches for connect with terraform workspaces.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1781 \" title=\"Terraform workspace Create Branch Dev\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-Dev.png\" alt=\"Terraform workspace Create Branch Dev\" width=\"450\" height=\"358\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-Dev.png 770w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-Dev-300x239.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-Dev-768x611.png 768w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1778 \" title=\"Terraform workspace Create Branch Prod\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-Prod.png\" alt=\"Terraform workspace Create Branch Prod\" width=\"467\" height=\"378\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-Prod.png 757w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Create-Branch-Prod-300x243.png 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/p>\n<p><span data-contrast=\"auto\">Create 2 branches in the repository called <strong>Dev<\/strong> and <strong>Prod<\/strong> from the <strong>master<\/strong> branch. These two branches represent as development and production environments.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3><span data-contrast=\"none\">Create 2 Workspaces on Terraform Cloud\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">Now go to your Terraform Cloud page. First, we are going to create <strong>Dev workspace.<\/strong> So, click the button <strong>New workspace<\/strong> for create workspaces.<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1789 size-full\" title=\"Terraform workspace New\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-New.png\" alt=\"Terraform workspace New\" width=\"1825\" height=\"320\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-New.png 1825w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-New-300x53.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-New-1024x180.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-New-768x135.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-New-1536x269.png 1536w\" sizes=\"(max-width: 1825px) 100vw, 1825px\" \/><\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1783 \" title=\"Terraform workspace Dev Choose Repo\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Choose-Repo.png\" alt=\"Terraform workspace Dev Choose Repo\" width=\"672\" height=\"273\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Choose-Repo.png 1268w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Choose-Repo-300x122.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Choose-Repo-1024x416.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Choose-Repo-768x312.png 768w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/>\u00a0<\/span><span class=\"NormalTextRun SCXW24648209 BCX0\">For Choose a repository section, choose the one which <\/span><span class=\"NormalTextRun SCXW24648209 BCX0\">contains<\/span><span class=\"NormalTextRun SCXW24648209 BCX0\"> your terraform code.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1784 \" title=\"Terraform workspace Dev Name\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Name.png\" alt=\"Terraform workspace Dev Name\" width=\"680\" height=\"444\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Name.png 1170w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Name-300x196.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Name-1024x670.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Name-768x502.png 768w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/p>\n<p><span class=\"TextRun SCXW79416805 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW79416805 BCX0\">For workspace name enter <strong>Dev.<\/strong> This is the name that we mentioned in the code for <strong>workspace.<\/strong> This name will be replaced for <\/span><strong><span class=\"NormalTextRun SpellingErrorV2Themed SCXW79416805 BCX0\">terraform.workspace<\/span><\/strong><span class=\"NormalTextRun SCXW79416805 BCX0\"> in the code, whenever we ran the code in this workspace.<\/span><\/span><span class=\"EOP SCXW79416805 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1785 \" title=\"Terraform workspace Dev Set Branch and Create\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Set-Branch-and-Create.png\" alt=\"Terraform workspace Dev Set Branch and Create\" width=\"690\" height=\"383\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Set-Branch-and-Create.png 1165w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Set-Branch-and-Create-300x166.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Set-Branch-and-Create-1024x568.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Dev-Set-Branch-and-Create-768x426.png 768w\" sizes=\"(max-width: 690px) 100vw, 690px\" \/><\/p>\n<ul style=\"font-weight: 400;\">\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">For VCS branch enter the name of the branch that represents <strong>development<\/strong> environment. For this case I enter <strong>Dev,<\/strong> which I create in my Bitbucket repository.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">Check the little box under the Pull Requests section. So, whenever we merge a pull request on the Dev branch an automatic plan will be triggered on this workspace.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">Then click <strong>Create workspace<\/strong> button.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><span data-contrast=\"auto\">Repeat the same process to create another workspace for Bitbucket branch <strong>Prod.<\/strong><\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1791 \" title=\"Terraform workspace Prod Name\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Name.png\" alt=\"Terraform workspace Prod Name\" width=\"644\" height=\"428\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Name.png 1145w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Name-300x200.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Name-1024x681.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Name-768x511.png 768w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/p>\n<p><span class=\"TextRun SCXW234688919 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW234688919 BCX0\">For the name enter <strong>Prod,<\/strong> which we mentioned in our code for workspace.<\/span><\/span><span class=\"EOP SCXW234688919 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559685&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1790 \" title=\"Terraform workspace Prod Error\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Error.png\" alt=\"Terraform workspace Prod Error\" width=\"640\" height=\"325\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Error.png 1512w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Error-300x152.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Error-1024x519.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Error-768x390.png 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<ul style=\"font-weight: 400;\">\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"6\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Look at the error mentioned in the above picture, it throws error when click the create workspace. But why it throws error?<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"6\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">You can see there for the VCS branch section; I have entered a wrong branch name. For &#8220;<strong>Prod<\/strong>&#8221; I entered <strong>&#8220;prod&#8221;.<\/strong> For this Terraform seeks a branch as <strong>prod<\/strong> in the Bitbucket repository and it didn\u2019t identify any of the branch called <strong>prod.<\/strong> So, it can\u2019t connect with Bitbucket.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"6\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">So, this section is a <strong>case sensitive<\/strong>. You have to enter the branch name correctly. And the branch should be in Bitbucket Repository that you have connected with Terraform Cloud.<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1792 \" title=\"Terraform workspace Prod Set Branch and Create\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Set-Branch-and-Create.png\" alt=\"Terraform workspace Prod Set Branch and Create\" width=\"622\" height=\"350\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Set-Branch-and-Create.png 1165w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Set-Branch-and-Create-300x169.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Set-Branch-and-Create-1024x576.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Prod-Set-Branch-and-Create-768x432.png 768w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><\/p>\n<p><span data-contrast=\"auto\">So, you have to enter a correct branch name <strong>Prod<\/strong>, and click<strong> Create workspace<\/strong> button. Now we are done for creating workspaces and connect them with their respective branches.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559685&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3><span data-contrast=\"none\">Configure Variable Sets<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">In the terraform code we have set some <strong>variables.<\/strong> But we didn\u2019t have any values for them. So now we are going to set variables in our terraform workspaces.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">We have 2 workspaces and we have to add variables in those 2 workspaces. But the values of the variables are same for all the workspaces. <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">So, for setting variables in the all workspaces individually in their respective variables section. But alternatively, we can use <strong>variable set<\/strong>. This one is help us to use a single variable for multiple workspaces.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">You can see the below image, click the Settings button and again click <strong>variables sets,<\/strong> it navigates you to variables set page. Now click the <strong>create variable set<\/strong> button.<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1795 \" title=\"Terraform workspace Variable Set\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Variable-Set.png\" alt=\"Terraform workspace Variable Set\" width=\"898\" height=\"349\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Variable-Set.png 1856w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Variable-Set-300x117.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Variable-Set-1024x398.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Variable-Set-768x298.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Variable-Set-1536x597.png 1536w\" sizes=\"(max-width: 898px) 100vw, 898px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1793 \" title=\"Terraform workspace Select Workspaces for Variable Sets\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Select-Workspaces-for-Variable-Sets.png\" alt=\"Terraform workspace Select Workspaces for Variable Sets\" width=\"688\" height=\"222\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Select-Workspaces-for-Variable-Sets.png 1167w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Select-Workspaces-for-Variable-Sets-300x97.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Select-Workspaces-for-Variable-Sets-1024x331.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Select-Workspaces-for-Variable-Sets-768x248.png 768w\" sizes=\"(max-width: 688px) 100vw, 688px\" \/><\/p>\n<p><span data-contrast=\"auto\">For workspaces section you can select weather Apply to all or Apply to specific. The first one is set the variables to all the workspaces that are present in the organization. The second one is helps us to select specific workspaces.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">For the best practice always select the second one and choose the workspaces that we need to set the variables.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1780 \" title=\"Terraform workspace Configure Variable Sets\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Configure-Variable-Sets.png\" alt=\"Terraform workspace Configure Variable Sets\" width=\"739\" height=\"471\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Configure-Variable-Sets.png 1300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Configure-Variable-Sets-300x191.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Configure-Variable-Sets-1024x652.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-Configure-Variable-Sets-768x489.png 768w\" sizes=\"(max-width: 739px) 100vw, 739px\" \/><\/p>\n<p><span data-contrast=\"auto\">Click add variable button to add variables, and for case sensitive variables like <strong>access_key<\/strong> and <strong>secret_key,<\/strong> you have to check the <strong>box sensitive<\/strong>. Then only the sensitive variables won\u2019t be showed anywhere, after you set the variables.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Once you done adding variables, then click the button <strong>Create variable<\/strong> set.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1796 \" title=\"Terraform workspace variable Sets in workspaces\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-variable-Sets-in-workspaces.png\" alt=\"Terraform workspace variable Sets in workspaces\" width=\"953\" height=\"483\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-variable-Sets-in-workspaces.png 1751w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-variable-Sets-in-workspaces-300x152.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-variable-Sets-in-workspaces-1024x519.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-variable-Sets-in-workspaces-768x389.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-workspace-variable-Sets-in-workspaces-1536x779.png 1536w\" sizes=\"(max-width: 953px) 100vw, 953px\" \/><\/p>\n<p><span data-contrast=\"auto\">Now you can go to your any of the workspaces\u2019 variables section, you can see the variables sets.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">We are done all the setup. Now it\u2019s time to deploy the code and see the magic happens. Let\u2019s do it.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h2><span data-contrast=\"none\">Merge Code and Deploy it on AWS<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h2>\n<h3><span data-contrast=\"none\">Merge from feature branch to Dev<\/span><\/h3>\n<h3><span data-contrast=\"none\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1814 \" title=\"Terraform Workspaces Pull Requests\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Pull-Requests.png\" alt=\"Terraform Workspaces Pull Requests\" width=\"969\" height=\"362\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Pull-Requests.png 1908w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Pull-Requests-300x112.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Pull-Requests-1024x382.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Pull-Requests-768x287.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Pull-Requests-1536x573.png 1536w\" sizes=\"(max-width: 969px) 100vw, 969px\" \/>\u00a0<\/span><\/h3>\n<p><span class=\"TextRun SCXW265106932 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW265106932 BCX0\">In your Bitbucket repository, go to the <strong>pull requests<\/strong> section and click <strong>Create pull request.<\/strong><\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1799 \" title=\"Terraform Workspaces Dev Create Pull Requests\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Create-Pull-Requests.png\" alt=\"Terraform Workspaces Dev Create Pull Requests\" width=\"602\" height=\"497\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Create-Pull-Requests.png 978w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Create-Pull-Requests-300x248.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Create-Pull-Requests-768x634.png 768w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/p>\n<p><span class=\"TextRun SCXW231194477 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW231194477 BCX0\">From branch section select <strong>feature<\/strong> branch and to branch section select <strong>Dev<\/strong> branch. Add a title for the pull request and click <strong>create pull request.<\/strong><\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1803 \" title=\"Terraform Workspaces Dev Merge pull Requests\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-pull-Requests.png\" alt=\"Terraform Workspaces Dev Merge pull Requests\" width=\"803\" height=\"376\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-pull-Requests.png 1563w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-pull-Requests-300x140.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-pull-Requests-1024x480.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-pull-Requests-768x360.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-pull-Requests-1536x719.png 1536w\" sizes=\"(max-width: 803px) 100vw, 803px\" \/><\/p>\n<p><span class=\"TextRun SCXW211377034 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW211377034 BCX0\">Now the pull request is in the pending stage. In right side below there is a link shows for terraform cloud, which triggers a plan for the code on a terraform workspace. Click the link It will redirect you to that Dev workspace.<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1804 \" title=\"Terraform Workspaces Dev Plan finished\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-finished.png\" alt=\"Terraform Workspaces Dev Plan finished\" width=\"880\" height=\"490\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-finished.png 1403w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-finished-300x167.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-finished-1024x570.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-finished-768x428.png 768w\" sizes=\"(max-width: 880px) 100vw, 880px\" \/><\/p>\n<p><span data-contrast=\"auto\">And you can see there will be a run occurs for a plan and it is successfully finished. It shows it is going to create an<strong> Ec2 Instance<\/strong>.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Now go to the previous page and click the <strong>Merge<\/strong> Button, to merge the <strong>feature<\/strong> branch to <strong>Dev.<\/strong><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1802 \" title=\"Terraform Workspaces Dev Merge Pull Request confirm\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-Pull-Request-confirm.png\" alt=\"Terraform Workspaces Dev Merge Pull Request confirm\" width=\"492\" height=\"409\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-Pull-Request-confirm.png 771w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-Pull-Request-confirm-300x249.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Merge-Pull-Request-confirm-768x638.png 768w\" sizes=\"(max-width: 492px) 100vw, 492px\" \/><\/p>\n<p><span class=\"TextRun SCXW109821510 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW109821510 BCX0\">After the <strong>merge<\/strong> completed, <\/span><span class=\"NormalTextRun SCXW109821510 BCX0\">you<\/span><span class=\"NormalTextRun SCXW109821510 BCX0\"> can see a <strong>plan triggers<\/strong> on the terraform workspace called <strong>Dev.<\/strong><\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1805 \" title=\"Terraform Workspaces Dev Plan Triggerd\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-Triggerd.png\" alt=\"Terraform Workspaces Dev Plan Triggerd\" width=\"921\" height=\"284\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-Triggerd.png 1817w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-Triggerd-300x93.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-Triggerd-1024x316.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-Triggerd-768x237.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Plan-Triggerd-1536x474.png 1536w\" sizes=\"(max-width: 921px) 100vw, 921px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1801 \" title=\"Terraform Workspaces Dev Finished Plan\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Finished-Plan.png\" alt=\"Terraform Workspaces Dev Finished Plan\" width=\"809\" height=\"445\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Finished-Plan.png 1470w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Finished-Plan-300x165.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Finished-Plan-1024x563.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Finished-Plan-768x422.png 768w\" sizes=\"(max-width: 809px) 100vw, 809px\" \/><\/p>\n<p><span class=\"TextRun SCXW31191454 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW31191454 BCX0\">Once it finishes the plan, it needs a confirmation for apply the code. Click the <strong>Confirm<\/strong>\u00a0<strong>&amp; Apply<\/strong> button.<\/span><\/span><span class=\"EOP SCXW31191454 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1798 \" title=\"Terraform Workspaces Dev Apply Finished\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Apply-Finished.png\" alt=\"Terraform Workspaces Dev Apply Finished\" width=\"926\" height=\"365\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Apply-Finished.png 1770w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Apply-Finished-300x118.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Apply-Finished-1024x404.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Apply-Finished-768x303.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-Apply-Finished-1536x606.png 1536w\" sizes=\"(max-width: 926px) 100vw, 926px\" \/><\/p>\n<p><span class=\"TextRun SCXW206231376 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW206231376 BCX0\">After the apply is successfully finished, go to your AWS account to see the EC2 instance is created Perfectly or not.<\/span><\/span><span class=\"EOP SCXW206231376 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1797 size-full\" title=\"Terraform Workspaces Dev EC2\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Ddev-EC2.png\" alt=\"Terraform Workspaces Dev EC2\" width=\"1548\" height=\"97\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Ddev-EC2.png 1548w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Ddev-EC2-300x19.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Ddev-EC2-1024x64.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Ddev-EC2-768x48.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Ddev-EC2-1536x96.png 1536w\" sizes=\"(max-width: 1548px) 100vw, 1548px\" \/><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">You can see the Instance type is <strong>t2<\/strong>.<strong>micro<\/strong>, which we mentioned in the code for <strong>Dev<\/strong> workspace, the type of the instance will be <strong>t2.micro<\/strong> and the count of the instance is <strong>1<\/strong>.So here the Instance in <strong>only one<\/strong> and the type also set perfectly.<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">And you need check another one in tags section. Select the Instance and clicks <strong>Tags<\/strong>.<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1800 \" title=\"Terraform Workspaces Dev EC2 tags\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-EC2-tags.png\" alt=\"Terraform Workspaces Dev EC2 tags\" width=\"786\" height=\"289\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-EC2-tags.png 1562w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-EC2-tags-300x110.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-EC2-tags-1024x377.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-EC2-tags-768x283.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Dev-EC2-tags-1536x565.png 1536w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p><span data-contrast=\"none\">As you saw the above image, in the <strong>Tags<\/strong> section, for the <strong>Key environment<\/strong> it gives a value <strong>Dev,<\/strong> which is the name of the <strong>workspace,<\/strong> where the code is run. These values will be automatically applied based on the workspaces.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><span data-contrast=\"auto\">Repeat the same process for <strong>Prod<\/strong> workspace.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559685&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3><span data-contrast=\"none\">Merge from Dev branch to Prod<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span class=\"TextRun SCXW42141448 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW42141448 BCX0\">Create a pull request from <strong>Dev<\/strong> branch to <strong>Prod.<\/strong><\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1813 \" title=\"Terraform Workspaces Prod Pull Request\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Pull-Request.png\" alt=\"Terraform Workspaces Prod Pull Request\" width=\"665\" height=\"561\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Pull-Request.png 972w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Pull-Request-300x253.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Pull-Request-768x648.png 768w\" sizes=\"(max-width: 665px) 100vw, 665px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1810 \" title=\"Terraform Workspaces Prod Merge Pull Request\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Merge-Pull-Request.png\" alt=\"Terraform Workspaces Prod Merge Pull Request\" width=\"777\" height=\"342\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Merge-Pull-Request.png 1576w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Merge-Pull-Request-300x132.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Merge-Pull-Request-1024x450.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Merge-Pull-Request-768x338.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Merge-Pull-Request-1536x675.png 1536w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/p>\n<p><span class=\"TextRun SCXW146468214 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW146468214 BCX0\">You will <\/span><span class=\"NormalTextRun SCXW146468214 BCX0\">able<\/span><span class=\"NormalTextRun SCXW146468214 BCX0\"> see the below right corner, a link for\u00a0<\/span><span class=\"NormalTextRun SCXW146468214 BCX0\">Terraform\u00a0cloud. Click it and check the plan is success or not.<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1811 size-full\" title=\"Terraform Workspaces Prod Plan Finished\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-FIished.png\" alt=\"Terraform Workspaces Prod Plan Finished\" width=\"1767\" height=\"656\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-FIished.png 1767w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-FIished-300x111.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-FIished-1024x380.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-FIished-768x285.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-FIished-1536x570.png 1536w\" sizes=\"(max-width: 1767px) 100vw, 1767px\" \/><\/p>\n<p><span data-contrast=\"auto\">In this plan It says there will be <strong>2 EC2 instances<\/strong> are going to created. Because We mentioned in the code for count of the instance is <strong>2<\/strong> for Prod workspace.<\/span><\/p>\n<p><span data-contrast=\"auto\">So, complete the merge request in the Bitbucket repository, a plan will be triggered automatically on the <strong>Prod<\/strong> workspace.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1812 \" title=\"Terraform Workspaces Prod Plan triggered\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-triggered.png\" alt=\"Terraform Workspaces Prod Plan triggered\" width=\"910\" height=\"204\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-triggered.png 1792w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-triggered-300x67.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-triggered-1024x230.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-triggered-768x172.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Plan-triggered-1536x345.png 1536w\" sizes=\"(max-width: 910px) 100vw, 910px\" \/><\/p>\n<p><span class=\"TextRun SCXW169293311 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW169293311 BCX0\">Once the plan finished, apply the code and wait for apply finished.<\/span><\/span><\/p>\n<p><span class=\"EOP SCXW169293311 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1806 \" title=\"Terraform Workspaces Prod Apply Finished\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Apply-Finished.png\" alt=\"Terraform Workspaces Prod Apply Finished\" width=\"940\" height=\"408\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Apply-Finished.png 1762w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Apply-Finished-300x130.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Apply-Finished-1024x445.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Apply-Finished-768x333.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-Apply-Finished-1536x667.png 1536w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/>\u00a0<\/span><\/p>\n<p><span class=\"TextRun SCXW169412323 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW169412323 BCX0\">Once it\u2019s done you can check the AWS Cloud for creation of <strong>2 EC2<\/strong> Instances.<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1809 size-full\" title=\"Terraform Workspaces Prod EC2\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2.png\" alt=\"Terraform Workspaces Prod EC2\" width=\"1547\" height=\"193\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2.png 1547w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-300x37.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-1024x128.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-768x96.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-1536x192.png 1536w\" sizes=\"(max-width: 1547px) 100vw, 1547px\" \/><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">You can see there will be extra<strong> 2 EC2 instances<\/strong> are added in the name <strong>test-workspace-Prod-0<\/strong> and <strong>1<\/strong>.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">The type of the <strong>2 Prod Instance<\/strong>s also has<strong> t3.small<\/strong>, which we refer in terraform code for <strong>Prod<\/strong> workspace.<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Check the <strong>Tags<\/strong> of the Instances is set to <strong>Prod<\/strong> for <strong>environment.<\/strong><\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1807 \" title=\"Terraform Workspaces Prod EC2 Tags 1\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-1.png\" alt=\"Terraform Workspaces Prod EC2 Tags 1\" width=\"554\" height=\"236\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-1.png 1002w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-1-300x128.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-1-768x327.png 768w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1808 \" title=\"Terraform Workspaces Prod EC2 Tags 2\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-2.png\" alt=\"Terraform Workspaces Prod EC2 Tags 2\" width=\"565\" height=\"253\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-2.png 898w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-2-300x134.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspaces-Prod-EC2-Tags-2-768x344.png 768w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/p>\n<p><span data-contrast=\"auto\">Yes, all the <strong>2<\/strong> Instances are containing the <strong>Tags<\/strong> value <strong>Prod<\/strong> for Key <strong>environment<\/strong>.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559685&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">So, yeah. This is all I want to cover you about the workspaces on terraform cloud. <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559685&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h2><span data-contrast=\"none\">State Files in Terraform Cloud Workspaces<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">There is one more thing I want to show you. When we are working with Terraform Cloud, terraform stores its <strong>state file<\/strong> on cloud not local. You can see the State files on all of the workspaces.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1815 size-full\" title=\"Terraform Workspace Dev State File\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/37.png\" alt=\"Terraform Workspace Dev State File\" width=\"1793\" height=\"886\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/37.png 1793w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/37-300x148.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/37-1024x506.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/37-768x380.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/37-1536x759.png 1536w\" sizes=\"(max-width: 1793px) 100vw, 1793px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1794 size-full\" title=\"Terraform Workspace Prod State File\" src=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-State-File.png\" alt=\"Terraform Workspace Prod State File\" width=\"1790\" height=\"877\" srcset=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-State-File.png 1790w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-State-File-300x147.png 300w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-State-File-1024x502.png 1024w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-State-File-768x376.png 768w, https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/Terraform-Workspace-State-File-1536x753.png 1536w\" sizes=\"(max-width: 1790px) 100vw, 1790px\" \/><\/p>\n<p><span data-contrast=\"auto\">You can see the <strong>State Files <\/strong>on the state section for every <strong>workspace<\/strong> that you have created . These state files are created from the same code, but they are <strong>isolated<\/strong> from one another. That&#8217;s why terraform workspace is a very handy feature for multiple environment use cases.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our previous articles, we have plained about the Terraform Cloud, Terraform Statefile and Simple Terraform Script. In this article, we are going to get some deep knowledge about the Terraform Workspace with Terraform Cloud. This is an automation process with an end-to-end setup from Bitbucket to AWS via Terraform Cloud for managing multiple environments. [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":1918,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[424],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Terraform Workspace on Terraform Cloud | complete Guide<\/title>\n<meta name=\"description\" content=\"Maximize your potential in Terraform by learning how to use Terraform Workspace on Terraform Cloud. Reach us to enhance your business.\" \/>\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.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Terraform Workspace on Terraform Cloud | complete Guide\" \/>\n<meta property=\"og:description\" content=\"Maximize your potential in Terraform by learning how to use Terraform Workspace on Terraform Cloud. Reach us to enhance your business.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/\" \/>\n<meta property=\"og:site_name\" content=\"easydeploy.io\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/Jerinrathnam\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-23T04:46:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-30T03:40:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2240\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jerin Rathnam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@jerin_rathnam\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jerin Rathnam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/\"},\"author\":{\"name\":\"Jerin Rathnam\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#\/schema\/person\/939543ac3b33fadea8b5115ab9a1280f\"},\"headline\":\"How to Use Terraform Workspaces on Terraform Cloud with VCS?\",\"datePublished\":\"2022-08-23T04:46:17+00:00\",\"dateModified\":\"2023-03-30T03:40:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/\"},\"wordCount\":1775,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg\",\"articleSection\":[\"Terraform\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/\",\"url\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/\",\"name\":\"Using Terraform Workspace on Terraform Cloud | complete Guide\",\"isPartOf\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg\",\"datePublished\":\"2022-08-23T04:46:17+00:00\",\"dateModified\":\"2023-03-30T03:40:08+00:00\",\"description\":\"Maximize your potential in Terraform by learning how to use Terraform Workspace on Terraform Cloud. Reach us to enhance your business.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage\",\"url\":\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg\",\"contentUrl\":\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg\",\"width\":2240,\"height\":1260,\"caption\":\"Terraform Workspaces\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.easydeploy.io\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use Terraform Workspaces on Terraform Cloud with VCS?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#website\",\"url\":\"https:\/\/www.easydeploy.io\/blog\/\",\"name\":\"easydeploy.io\",\"description\":\"A Cloud Architect Company\",\"publisher\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.easydeploy.io\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#organization\",\"name\":\"EasyDeploy Technologies Pvt Ltd\",\"url\":\"https:\/\/www.easydeploy.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2019\/02\/easydeploy.png\",\"contentUrl\":\"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2019\/02\/easydeploy.png\",\"width\":536,\"height\":100,\"caption\":\"EasyDeploy Technologies Pvt Ltd\"},\"image\":{\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#\/schema\/person\/939543ac3b33fadea8b5115ab9a1280f\",\"name\":\"Jerin Rathnam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.easydeploy.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ca2c2ab4a28d380073334816b42aaa40?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ca2c2ab4a28d380073334816b42aaa40?s=96&d=mm&r=g\",\"caption\":\"Jerin Rathnam\"},\"description\":\"Jerin Rathnam is a proficient DevOps engineer who is dedicated to streamlining software development and deployment processes. He has extensive knowledge of cloud infrastructure, containerization, and CI\/CD pipelines, which enables him to effectively connect development and operations. Jerin specializes in creating numerous Terraform modules for multi-cloud infrastructure and possesses immense expertise in configuring and managing cloud infrastructure. His profound understanding of containerization, along with his experience in orchestration tools like Docker and Kubernetes, further supports his skills as a valuable DevOps engineer.\",\"sameAs\":[\"https:\/\/www.gemjerin.site\",\"https:\/\/www.facebook.com\/Jerinrathnam\",\"https:\/\/www.instagram.com\/gem_jerin_rathnam\/\",\"https:\/\/www.linkedin.com\/in\/jerin-rathnam\/\",\"https:\/\/x.com\/jerin_rathnam\",\"@jerinrathnam\"],\"url\":\"https:\/\/www.easydeploy.io\/blog\/author\/jerin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Terraform Workspace on Terraform Cloud | complete Guide","description":"Maximize your potential in Terraform by learning how to use Terraform Workspace on Terraform Cloud. Reach us to enhance your business.","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.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/","og_locale":"en_GB","og_type":"article","og_title":"Using Terraform Workspace on Terraform Cloud | complete Guide","og_description":"Maximize your potential in Terraform by learning how to use Terraform Workspace on Terraform Cloud. Reach us to enhance your business.","og_url":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/","og_site_name":"easydeploy.io","article_author":"https:\/\/www.facebook.com\/Jerinrathnam","article_published_time":"2022-08-23T04:46:17+00:00","article_modified_time":"2023-03-30T03:40:08+00:00","og_image":[{"width":2240,"height":1260,"url":"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg","type":"image\/jpeg"}],"author":"Jerin Rathnam","twitter_card":"summary_large_image","twitter_creator":"@jerin_rathnam","twitter_misc":{"Written by":"Jerin Rathnam","Estimated reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#article","isPartOf":{"@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/"},"author":{"name":"Jerin Rathnam","@id":"https:\/\/www.easydeploy.io\/blog\/#\/schema\/person\/939543ac3b33fadea8b5115ab9a1280f"},"headline":"How to Use Terraform Workspaces on Terraform Cloud with VCS?","datePublished":"2022-08-23T04:46:17+00:00","dateModified":"2023-03-30T03:40:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/"},"wordCount":1775,"commentCount":2,"publisher":{"@id":"https:\/\/www.easydeploy.io\/blog\/#organization"},"image":{"@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage"},"thumbnailUrl":"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg","articleSection":["Terraform"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/","url":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/","name":"Using Terraform Workspace on Terraform Cloud | complete Guide","isPartOf":{"@id":"https:\/\/www.easydeploy.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage"},"image":{"@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage"},"thumbnailUrl":"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg","datePublished":"2022-08-23T04:46:17+00:00","dateModified":"2023-03-30T03:40:08+00:00","description":"Maximize your potential in Terraform by learning how to use Terraform Workspace on Terraform Cloud. Reach us to enhance your business.","breadcrumb":{"@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#primaryimage","url":"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg","contentUrl":"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2022\/08\/terraform-workspaces.jpg","width":2240,"height":1260,"caption":"Terraform Workspaces"},{"@type":"BreadcrumbList","@id":"https:\/\/www.easydeploy.io\/blog\/terraform-workspaces-on-terraform-cloud\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.easydeploy.io\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Use Terraform Workspaces on Terraform Cloud with VCS?"}]},{"@type":"WebSite","@id":"https:\/\/www.easydeploy.io\/blog\/#website","url":"https:\/\/www.easydeploy.io\/blog\/","name":"easydeploy.io","description":"A Cloud Architect Company","publisher":{"@id":"https:\/\/www.easydeploy.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.easydeploy.io\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/www.easydeploy.io\/blog\/#organization","name":"EasyDeploy Technologies Pvt Ltd","url":"https:\/\/www.easydeploy.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.easydeploy.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2019\/02\/easydeploy.png","contentUrl":"https:\/\/www.easydeploy.io\/blog\/wp-content\/uploads\/2019\/02\/easydeploy.png","width":536,"height":100,"caption":"EasyDeploy Technologies Pvt Ltd"},"image":{"@id":"https:\/\/www.easydeploy.io\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.easydeploy.io\/blog\/#\/schema\/person\/939543ac3b33fadea8b5115ab9a1280f","name":"Jerin Rathnam","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.easydeploy.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ca2c2ab4a28d380073334816b42aaa40?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ca2c2ab4a28d380073334816b42aaa40?s=96&d=mm&r=g","caption":"Jerin Rathnam"},"description":"Jerin Rathnam is a proficient DevOps engineer who is dedicated to streamlining software development and deployment processes. He has extensive knowledge of cloud infrastructure, containerization, and CI\/CD pipelines, which enables him to effectively connect development and operations. Jerin specializes in creating numerous Terraform modules for multi-cloud infrastructure and possesses immense expertise in configuring and managing cloud infrastructure. His profound understanding of containerization, along with his experience in orchestration tools like Docker and Kubernetes, further supports his skills as a valuable DevOps engineer.","sameAs":["https:\/\/www.gemjerin.site","https:\/\/www.facebook.com\/Jerinrathnam","https:\/\/www.instagram.com\/gem_jerin_rathnam\/","https:\/\/www.linkedin.com\/in\/jerin-rathnam\/","https:\/\/x.com\/jerin_rathnam","@jerinrathnam"],"url":"https:\/\/www.easydeploy.io\/blog\/author\/jerin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/posts\/1774"}],"collection":[{"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/comments?post=1774"}],"version-history":[{"count":16,"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/posts\/1774\/revisions"}],"predecessor-version":[{"id":2675,"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/posts\/1774\/revisions\/2675"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/media\/1918"}],"wp:attachment":[{"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/media?parent=1774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/categories?post=1774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.easydeploy.io\/blog\/wp-json\/wp\/v2\/tags?post=1774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}