Skip to content

Draft: Don't explicitly `cd` into `TF_ROOT`

Timo Furrer requested to merge tf-tpl-no-root-cd into master

What does this MR do and why?

This MR removes the explicit cd "${TF_ROOT}" from most of the jobs which don't require it anymore, because of the -chdir "${TF_ROOT}" we do in the gitlab-terraform script.

There is a few things to consider here:

  1. Base needs to be compatible with v0.43.0 of gitlab-terraform, which already supports -chdir
  2. Before terraform-images!162 (merged) plan.json wouldn't be stored within TF_ROOT if there wasn't a cd - once terraform-images!162 (merged) this MR can be merged, too
  3. with (2) the Base.latest doesn't require any explicit cds at all
  4. even with (2) the Base still requires a cd for the build job so that it correctly stores the plan.json within TF_ROOT
  5. TF_PLAN_CACHE other than TF_ROOT/plan.cache and TF_PLAN_JSON other than TF_ROOT/plan.json are NOT supported (see terraform-images!162 (comment 1205342947)) before this MR and after this MR. Let's handle it outside of this.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports