Generalization of tflint call for FAST stages (#2225)

* Generalization of tflint call for FAST

* Fix tfvars path

* Fix tfvars path - depending where the file is

* Fix regex

* Reeanble linting

* Align test directory to stage name

* Align all fast stages to use tftest
This commit is contained in:
Wiktor Niesiobędzki
2024-04-18 21:04:24 +02:00
committed by GitHub
parent 1563a76011
commit 024d3255e6
43 changed files with 123 additions and 108 deletions

View File

@@ -68,19 +68,14 @@ jobs:
- name: TFLint FAST
run: |
# TODO: try to generalize this
tflint --chdir fast/stages/0-bootstrap --var-file ../../../tests/fast/stages/s0_bootstrap/simple.tfvars
tflint --chdir fast/stages/1-resman --var-file ../../../tests/fast/stages/s1_resman/simple.tfvars
tflint --chdir fast/stages/2-networking-a-peering --var-file ../../../tests/fast/stages/s2_networking_a_peering/common.tfvars
tflint --chdir fast/stages/2-networking-b-vpn --var-file ../../../tests/fast/stages/s2_networking_b_vpn/common.tfvars
tflint --chdir fast/stages/2-networking-c-nva --var-file ../../../tests/fast/stages/s2_networking_c_nva/common.tfvars
tflint --chdir fast/stages/2-networking-d-separate-envs --var-file ../../../tests/fast/stages/s2_networking_d_separate_envs/common.tfvars
tflint --chdir fast/stages/2-security --var-file ../../../tests/fast/stages/s2_security/common.tfvars
tflint --chdir fast/stages/3-data-platform/dev --var-file ../../../../tests/fast/stages/s3_data_platform/common.tfvars
tflint --chdir fast/stages/3-gcve/prod/ --var-file ../../../../tests/fast/stages/s3_gcve_minimal/simple.tfvars
tflint --chdir fast/stages/3-data-platform/dev --var-file ../../../../tests/fast/stages/s3_data_platform/common.tfvars
tflint --chdir fast/stages/3-gke-multitenant/dev --var-file ../../../../tests/fast/stages/s3_gke_multitenant/common.tfvars
tflint --chdir fast/stages/3-project-factory/dev --var-file ../../../../tests/fast/stages/s3_project_factory/common.tfvars
for STAGE_DIR in $(find fast/stages -name main.tf -printf '%h\n' ) ; do
STAGE_NAME=$(echo ${STAGE_DIR} | sed -e 's#^fast/stages/\([^/]*\)[/]\?.*$#\1#')
VAR_PATH_LEVEL="."
if [ -z $(echo ${STAGE_DIR} | sed -e 's#^fast/stages/[^/]*/\(.*\)$##') ] ; then
VAR_PATH_LEVEL=".."
fi
tflint --chdir ${STAGE_DIR} --var-file ${VAR_PATH_LEVEL}/../../../tests/fast/stages/s$(echo ${STAGE_NAME} | sed -e 's/-/_/g')/simple.tfvars
done
- name: Check documentation
id: documentation-fabric