I spent a lot of hours to understand how things are segregating bet' workspace and folder based structure flow in terraform. After i pumped into here, got to know how simple it is. Heads up to you Will Brock. Simple and Sweet explanation. Awesome Job. Thanks a lot.
@WillBrock4 жыл бұрын
Awesome! I'm glad they were helpful
@kaypakaipa85593 жыл бұрын
Thanks for this course bro. Its perfect for mere mortals like myself. I fully get it now.
@bajajrahul0013 жыл бұрын
Thanks Will for these videos ! I finally got my head around the concept of Workspaces. Appreciate it !
@welingtonws2 жыл бұрын
Will, thanks a lot for this Terraform course. It's been very useful as I'm dealing with TF currently in my job
@WillBrock2 жыл бұрын
No problem, I'm glad it's helping out
@dilgamr.sharifov66523 жыл бұрын
Very useful video, finally with this video i cleared my confusion about Terraform workspaces.
@WillBrock3 жыл бұрын
Thanks! Glad it was helpful
@Emmakungaba Жыл бұрын
Great content Will. You cleared my confusion. Thanks
@gihanmahmoud56513 жыл бұрын
So glad someone addressed the initial confusion I had when I first was introduced to Workspace. Because I thought initially that by defining a workspace, it automatically deploys resources to different "profile" automatically on the cloud server I am working on. But that's not the case. It is more of a logical grouping with its own state file that helps manages different prod/non-prod environments GIVEN the right config.
@virabadrasana Жыл бұрын
Very good quality. Thank you.👍👍👍
@thelemminguk2 жыл бұрын
Excellent video, very well explained
@WillBrock2 жыл бұрын
Thanks!
@nitishgavankar96663 жыл бұрын
Hi Will, What if, In Dev Workspace, I use -var-file prod.tfvars. this will apply the prod vars in Dev workspace. !! if that's the case, It all depends on varfiles, rather than Workspace. Then what is the use of differnt workspaces. - "is it maintaining different tfstate files for same config ? " please correct me if I am wrong.
@WillBrock3 жыл бұрын
If you're in the dev workspace it won't affect anything in the prod workspace since each workspace has their own state files.
@felipeozoski3 жыл бұрын
Thank you so much for this playlist!!! we all really appreciate it!
@rakeshjha114 жыл бұрын
This was really good explanation of Workspaces, request you to add a video on Workspace, directory, module comparison.
@shyamcheekoti72162 жыл бұрын
Thank you, what is locals resource? I am not clear on that part. And one more doubt when run terraform apply with different variable files at that time only environments Got segregated and accordingly apply ?
@keithsexton89622 жыл бұрын
very clearly explained - thanks for the information.
@abettertomorrow4311 Жыл бұрын
This was a good explanation, thanks Curious, what if you define instance name in the dev.tfvars with a dev prefix. Same for PRD. Would you still need workspace? I guess to manage different .tfstate files?
@ramthirumalai68703 жыл бұрын
Thanks Will very useful just learned about workspaces.
@WillBrock3 жыл бұрын
Awesome
@HasanUckun Жыл бұрын
it was so helpful Will, thank you very much!
@vijeeshvijayan99662 жыл бұрын
Very well simply explained and much appreciated you for this wonderful video
@80amnesia2 жыл бұрын
nice thanks, clean example
@rajivnayanverma68222 жыл бұрын
Thanks Will for this wornderful video. But I have a question here apart from instance name which was picked based on workspace I couldn't understand what else could be the use case . If being in dev workspace you will pass prod.tfvars as argument the script will create the infra with prod configuration I beleive then what is new here ? can you pls clarify ?
@production-aws66443 жыл бұрын
exactly what i was looking for. Nice intro in to terraform ive always used CF instead
@ramithraghunath10733 жыл бұрын
when you changed instance to t2xlarge, why it didn't provision a new instance and instead changed the instance type of existing instance?
@WillBrock3 жыл бұрын
Thats how it works when you change it in the aws interface. It modifies the existing resource in place and does not destroy it.
@wysefavor2 жыл бұрын
So workspace allows you to have different state files for different environment . Each environment can have its own workspace hence its own state file.. right ?
@adamkeinan15352 жыл бұрын
Great Channel Will. Subscribed!
@WillBrock2 жыл бұрын
Thanks!
@himanshuupadhyay31293 жыл бұрын
Excellent video will. Thankyou for this playlist. Are you planning to make a video on workspaces vs directory structure as you mentioned in the video?
@thumpanekolla26612 жыл бұрын
You are amazing mate. Thanks for the explanation in the best possible way with the demo. Keep Up the good work. ( Just subscribed 😀 )
@WillBrock2 жыл бұрын
Thanks!
@ujwaldhakal60044 жыл бұрын
One of the good tuts out there... Keep up the good work
@mayureshpatilvlogs4 жыл бұрын
Awesome video Dude. Can we use workspace concept if we are using modules in main. tf file.
@WillBrock4 жыл бұрын
You can
@temiwale883 жыл бұрын
This is very good. Thank you Will!
@azy222224 жыл бұрын
Hey @Will Brock thanks for this video. Question for you - must you call the -var-file for each environment? Is there a way to add this elsewhere so it's not in the CLI. I'm trying to find use cases to use Terraform workspace over Terragrunt
@WillBrock4 жыл бұрын
Hi, yes you need to call the -var-file otherwise it won't know what variables to use. You could also set environment variables.
@azy222224 жыл бұрын
@@WillBrock hmmm interesting
@erikwhitesides3 жыл бұрын
i think the way Will Brock presented this is bound to fail.... someone will accidentally apply prod variables to dev environment. unless you set up a pipeline and no one actually runs terraform plan/apply on their terminal. in variables.tf you could do a map like variable "testing" { default = { dev = "abc" prod = "def"}} , then you call it like var.testing[terraform.workspace]. if you want values to come from tfvars you could probably use some other technique like an if statement
@ThiagoTorresFaioli3 жыл бұрын
but there is a problem! When you change workspace and run "terraform plan" the existing resource that was created previously will be marked as ... "1 to change" ...
@WillBrock3 жыл бұрын
No it won't. They are isolated from each other.
@dvirpashut30232 жыл бұрын
thks will.... the best explenation i found... your great!!!!!!!!!!!!11
@WillBrock Жыл бұрын
Glad it helped!
@DevOps-AWS55 Жыл бұрын
Awesome Training
@WillBrock Жыл бұрын
Thanks
@AvinashReddy214 жыл бұрын
Awesome video ! Question- How can I further break down the project into infrastructure types ? Lets say under dev --> App(a folder), database(a folder). How can I maintain separate state for apps and database under dev ?
@WillBrock4 жыл бұрын
If you want separate state for databases and app you need to create two separate configurations not in the same workspace. Depending on your needs it might make sense to keep them both in the same state files.
@Ronnie9P2 жыл бұрын
how do you destroy the resources created under each workspace ? you forgot to mention that
@WillBrock2 жыл бұрын
terraform destroy just like you would do without using a workspace
@Ronnie9P2 жыл бұрын
@@WillBrockyou also have to add the variables when you use terraform destroy
@chandrashekhar24612 жыл бұрын
appreciate it! so easy to understand
@WillBrock2 жыл бұрын
Glad to hear
@Techtalkswithrahul3 жыл бұрын
Still waiting for workspace vs directory structure video which you mentioned in the video that you will create
@hamidapremani61514 жыл бұрын
Very well-explained.
@karenzhu61003 жыл бұрын
Thanks sooo much!!! Need this!
@saeedsherani72752 жыл бұрын
Hi Will. Such an amazing teaching for terraform. Can you please make a video on how to use workspace for different account. Like sandbox and dev accounts in AWS>
@fxy29332 жыл бұрын
Why do such amazing videos come to me so late ??? 😃
@WillBrock2 жыл бұрын
Lol thanks for the kind words
@swalkers80084 жыл бұрын
Excellent demo and explanation. Thanks so much. I have a few questions: 1) After setting up the two separate workspaces, is there still a point for the terraform.tfvars 2) how would git keep track of the workspace?
@WillBrock4 жыл бұрын
For number 1 you can still have a terraform.tfvars depending on your needs. You would use git to keep track of the code only and not the state files. You could use git to track the state files but it's not recommend. Instead you should use a remote backend like S3 to keep track of the state.
@swalkers80084 жыл бұрын
@@WillBrock thank you for the reply. Let me put the state file to gitignore. I will also research more on remote state
@WillBrock4 жыл бұрын
@@swalkers8008 no problem. There is a video in my terraform playlist on backends if you wanted to learn more
@matthewwarner16333 жыл бұрын
Thanks for the awesome tutorials! Is it possible to have a workspace default to a .tfvars file? I find it easy to forget which workspace I'm in and apply the wrong .tfvars file. I have a dev, qa and prod.tfvars files and want to use them in my dev, qa and prod workspace respectively.
@WillBrock3 жыл бұрын
Not that I know of. I have the same problem and forget to specify the var file sometimes.
@njabulongwenyama3 жыл бұрын
@@WillBrock Enterim solution on this could be coloring your terminal to display different colors on different environments.
@stockrt2 жыл бұрын
you could automate the commands using a Makefile to create shortcuts. $ make apply dev $ make apply prod
@vinodchunchuwar36604 жыл бұрын
Please add video on usage of data "terraform_remote_state"
@WillBrock4 жыл бұрын
Is this what you're looking for? kzbin.info/www/bejne/iHO6Y2hpdpmGrLs
@thrilochanpakkapoti99 Жыл бұрын
your videos are good. i would suggest you create the course in udemy with some practice exams.
@sahdevchauhan3 жыл бұрын
Will (B)Rock!
@abraund4 ай бұрын
Workspaces do not seem to add a great deal of value? When you run terraform apply you select the right tfvars file yourself, and so the main use-case for a workspace, env differentiation, is handled via a different mechanism. A most likely naive first glance suggests one should be able to associate tfvars files with workspaces.
@TheAlexdoka3 жыл бұрын
Good work!
@desiboyz46954 жыл бұрын
Sir pls make a video on dockers using terraform from installation to pushing image to ecr . Thanks
@mamun0012 жыл бұрын
Thank you
@DigitalDave654 жыл бұрын
How many keyboards do you go through? You hit them keys hard! However, great video. You made it very simple to understand.
@WillBrock4 жыл бұрын
Haha, I was using the built in computer mic so it makes it sound loud.
@000djw0002 жыл бұрын
Ok so, to summarise, workspaces is a state thing and nothing else!
@billtoner19603 жыл бұрын
That was great, thanks.
@Oswee4 жыл бұрын
I am looking more like for multicloud setup where some things are spin up on own bare metal VM's, some dev envirionment on GCP and some prod env are provisioned on AWS. Or... demo env is set up on local VM's, but later transfered to the AWS. From the code organization perspective.