Skip to content

Commit

Permalink
wip: add test script
Browse files Browse the repository at this point in the history
  • Loading branch information
hknutsen committed Dec 20, 2023
1 parent 3ef487d commit ea08bbb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/terraform-ci/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3

import argparse
import os
import glob


def getTerraformDirs(path):
terraformPath = os.path.join(path, "terraform")
dirs = []

if os.path.isfile(terraformPath):
return dirs

files = glob.glob(terraformPath + "/**/*.tf", recursive=True)
modulesPath = os.path.join(terraformPath, "modules")
for file in files:
# Ignore module files
if not file.startswith(modulesPath):
dir = os.path.dirname(file)
if dir not in dirs:
dirs.append(dir)

return dirs


parser = argparse.ArgumentParser()
parser.add_argument("-p", "--path", type=str, default=".")
args = parser.parse_args()
path = args.path

terraformDirs = getTerraformDirs(path)
print(terraformDirs)

0 comments on commit ea08bbb

Please sign in to comment.