Managing Environments with Terraform via Directories

Ғылым және технология

We see another way of managing environments in our Terraform configuration - using a directory schema and a helper script.
I prefer this method as I find it less prone to human error than using Workspaces, and to avoid the confusion of Workspaces (locally) vs Workspaces in Terraform Cloud.
See the video, related code, and more here: cloudcasts.io/course/terrafor...

Пікірлер: 10

  • @alakdam3970
    @alakdam3970 Жыл бұрын

    One of the underrated channel. Luckily to be here 🥳🥳 Cheers mate!

  • @andrewfigaroa7031
    @andrewfigaroa70312 жыл бұрын

    Awesome!! I agree with you and I also went with the second approach combined with symlinks.

  • @r00ty

    @r00ty

    Жыл бұрын

    > combined with symlinks could you please elaborate on this?

  • @brockhard
    @brockhard8 ай бұрын

    Great video!

  • @patricknelson
    @patricknelson2 жыл бұрын

    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).

  • @larichou25
    @larichou252 жыл бұрын

    I have 2 different aws accounts for dev and prod environments. How can i set that up? And how to i manage environments ?

  • @larichou25
    @larichou252 жыл бұрын

    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?

  • @shivsticker9680

    @shivsticker9680

    Ай бұрын

    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.

  • @amcsi
    @amcsi2 жыл бұрын

    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.

  • @CloudCastsio

    @CloudCastsio

    2 жыл бұрын

    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!

Келесі