Extend terraform-pipeline-base with a concept of "local files"
In https://gitlab.developers.cam.ac.uk/uis/devops/user-notify/infrastructure/-/merge_requests/2, we had to add a little hack to the terraform CI pipeline jobs to persist a "local files" directory between plan
and apply
stages.
It would be convenient for this to be folded into the standard pipeline:
- Add
${TF_DATA_DIR}/local-files
to the artifacts published byplan
jobs. - Add a
TF_VAR_local_files_dir
variable toapply
andplan
jobs.
Configurations which need to persist files can do so by making use of a local_files_dir
variable as in https://gitlab.developers.cam.ac.uk/uis/devops/user-notify/infrastructure/-/merge_requests/2 but configs which don't care don't need to do anything; terraform will ignore $TF_VAR_local_files_dir
if there is no corresponding variable.