NOTE: I’m new to this, hence why I’m here so excuse my ignorance. However: What was the main disadvantage of workspaces that caused you to chose this method over that? Or was it just so you could demo it? I say that since you have to add a new build script to simplify your parameters which got more complex due to having to segment your state data in the back-end (which happens for you if you’re using workspaces). Granted, I think the cloud product might add even more security/segmentation between your remotely stored states (e.g. preventing someone who has access to read/write test state from also being able to read/write prod state). Maybe that’s what I’m missing and why the extra complexity was required here (to prevent paying for the cloud version I guess). I’m guessing either it’s because you’re just demoing or I’m confused just since I skipped a view videos (going from storing state in S3 to the “managing environments in [x]” videos).
I have 2 aws accounta for dev and prod. How do i set that up and how do i manage my environments? In order words, how will my terraform tree look like?
Delayed answer, but you can accomplish this using aws profiles and specify that with the `profile` argument in the backend object. Make sure that name corresponds to an awscli credential profile from ~/.aws/credentials. Each of the main TF files he uses here has the `backend` object near the top. Using this same tree he uses, that should work.
How come you only needed to provide the backend file location only for "init" and not the other commands? 9:17 I believe the backend files in this example tell Terraform where the appropriate state file is found for the given environment, and so since a lot of other important commands like "plan", "apply" etc. all read and write the state file, they should have the backend files specified for them. I think in this example video you couldn't tell the "bug", because near the end of the video when running the "plan" command, whether or not the backend file has been given, it would show that it plans on creating 34 new resources, because the state is empty in either case currently.
I often delete resources between videos, so needing to create all the resources was because they didn’t exist. I believe you only need those inputs for the init command, and then the lock file has that data from then on so you don’t continue to need it. However let me know if you experience otherwise!
Awesome!! I agree with you and I also went with the second approach combined with symlinks.
> combined with symlinks
could you please elaborate on this?
One of the underrated channel. Luckily to be here 🥳🥳
Cheers mate!
Great video!
NOTE: I’m new to this, hence why I’m here so excuse my ignorance. However: What was the main disadvantage of workspaces that caused you to chose this method over that? Or was it just so you could demo it?
I say that since you have to add a new build script to simplify your parameters which got more complex due to having to segment your state data in the back-end (which happens for you if you’re using workspaces). Granted, I think the cloud product might add even more security/segmentation between your remotely stored states (e.g. preventing someone who has access to read/write test state from also being able to read/write prod state). Maybe that’s what I’m missing and why the extra complexity was required here (to prevent paying for the cloud version I guess).
I’m guessing either it’s because you’re just demoing or I’m confused just since I skipped a view videos (going from storing state in S3 to the “managing environments in [x]” videos).
I have 2 different aws accounts for dev and prod environments. How can i set that up? And how to i manage environments ?
I have 2 aws accounta for dev and prod. How do i set that up and how do i manage my environments? In order words, how will my terraform tree look like?
Delayed answer, but you can accomplish this using aws profiles and specify that with the `profile` argument in the backend object. Make sure that name corresponds to an awscli credential profile from ~/.aws/credentials. Each of the main TF files he uses here has the `backend` object near the top. Using this same tree he uses, that should work.
How come you only needed to provide the backend file location only for "init" and not the other commands? 9:17
I believe the backend files in this example tell Terraform where the appropriate state file is found for the given environment, and so since a lot of other important commands like "plan", "apply" etc. all read and write the state file, they should have the backend files specified for them.
I think in this example video you couldn't tell the "bug", because near the end of the video when running the "plan" command, whether or not the backend file has been given, it would show that it plans on creating 34 new resources, because the state is empty in either case currently.
I often delete resources between videos, so needing to create all the resources was because they didn’t exist. I believe you only need those inputs for the init command, and then the lock file has that data from then on so you don’t continue to need it.
However let me know if you experience otherwise!