Flexible stage 2s in FAST resource manager (#2840)

* wip

* WIP

* wip

* wip

* apply untested

* tests

* support tag expansion for tenant-level installations in IAM conditions

* fix stage config output

* inventories

* remove dev files

* tfdoc

* enable org policies for stage folders

* resman README

* tfdoc

* stage 3 documentation

* inventory

* support extra_dirs in testing franework

* remove org policy files from stage 1

* Add principal interpolation to iam_by_principals (#2847)

* Add principal interpolation to iam_by_principals

* Fix tests

* relax schemas

* relax schemas

---------

Co-authored-by: Julio Castillo <jccb@google.com>
This commit is contained in:
Ludovico Magnocavallo
2025-01-29 13:16:35 +01:00
committed by GitHub
parent 1009dd248b
commit 95ec5ee3b5
58 changed files with 1607 additions and 1394 deletions

View File

@@ -64,7 +64,7 @@ def _prepare_root_module(path):
def plan_summary(module_path, basedir, tf_var_files=None, extra_files=None,
**tf_vars):
extra_dirs=None, **tf_vars):
"""
Run a Terraform plan on the module located at `module_path`.
@@ -105,7 +105,11 @@ def plan_summary(module_path, basedir, tf_var_files=None, extra_files=None,
extra_files = [(module_path / filename).resolve()
for x in extra_files or []
for filename in glob.glob(x, root_dir=module_path)]
tf.setup(extra_files=extra_files, upgrade=True)
extra_dirs = [
(module_path / dirname).resolve() for dirname in extra_dirs or []
]
tf.setup(extra_files=extra_files + extra_dirs, upgrade=True)
# raise SystemExit(extra_dirs)
tf_var_files = [(basedir / x).resolve() for x in tf_var_files or []]
plan = tf.plan(output=True, tf_var_file=tf_var_files, tf_vars=tf_vars)
@@ -148,20 +152,21 @@ def plan_summary_fixture(request):
"""
def inner(module_path, basedir=None, tf_var_files=None, extra_files=None,
**tf_vars):
extra_dirs=None, **tf_vars):
if basedir is None:
basedir = Path(request.fspath).parent
return plan_summary(module_path=module_path, basedir=basedir,
tf_var_files=tf_var_files, extra_files=extra_files,
**tf_vars)
extra_dirs=extra_dirs, **tf_vars)
return inner
def plan_validator(module_path, inventory_paths, basedir, tf_var_files=None,
extra_files=None, **tf_vars):
extra_files=None, extra_dirs=None, **tf_vars):
summary = plan_summary(module_path=module_path, tf_var_files=tf_var_files,
extra_files=extra_files, basedir=basedir, **tf_vars)
extra_files=extra_files, extra_dirs=extra_dirs,
basedir=basedir, **tf_vars)
# allow single single string for inventory_paths
if not isinstance(inventory_paths, list):