Merge pull request #189 from cloud-neutral-toolkit/codex/fix-path-errors-in-render_provider_backend.py

Fix provider backend rendering path and avoid committing generated files
This commit is contained in:
cloudneutral 2025-12-11 19:14:25 +08:00 committed by GitHub
commit a8ca0fd9f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

3
.gitignore vendored
View File

@ -42,6 +42,9 @@ coverage.xml
# Generated Terraform provider/backend files for AWS cloud envs
iac-template/terraform-hcl-standard/aws-cloud/envs/*/provider.tf
iac-template/terraform-hcl-standard/aws-cloud/envs/*/backend.tf
# Generated provider/backend files for component stacks
iac-template/terraform-hcl-standard/aws-cloud/component/*/provider.tf
iac-template/terraform-hcl-standard/aws-cloud/component/*/backend.tf
# Ansible
*.retry

View File

@ -13,7 +13,7 @@ CONFIG_DIR = Path(
os.environ.get("AWS_CLOUD_CONFIG_PATH", PROJECT_ROOT / "aws-cloud" / "config")
)
TEMPLATE_DIR = CURRENT_DIR / "templates"
ENVS_DIR = CURRENT_DIR / "envs"
ENVS_DIR = CURRENT_DIR / "component"
sys.path.append(str(PROJECT_ROOT / "utils"))
from config_loader import load_merged_config # noqa: E402
@ -81,7 +81,10 @@ def render_templates():
backend_template = env.get_template("backend.tf.j2")
for module_name, module_config in modules.items():
module_dir = ENVS_DIR / module_name
module_dir_name = module_config.get("component_dir") or module_name.split("-", 1)[
-1
]
module_dir = ENVS_DIR / module_dir_name
if not module_dir.exists():
print(f"⚠️ Skipping {module_name}: {module_dir} not found")
continue