From 2f461959b0cf64af0daaa5fe5a21ff7104da2a84 Mon Sep 17 00:00:00 2001 From: Sankalp Sanand Date: Mon, 22 Jan 2024 13:22:29 -0500 Subject: [PATCH] Fixed infra defaults for deploy commands (#1917) --- CHANGELOG.md | 1 + covalent/cloud_resource_manager/core.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb0319120..0df4c8bf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed the scenario where any deploy commands would fail if the user had a non deploy compatible plugin installed +- Fixed deploy commands' default value of plugins not being propagated to the tfvars file ## [0.233.0-rc.0] - 2024-01-07 diff --git a/covalent/cloud_resource_manager/core.py b/covalent/cloud_resource_manager/core.py index 4721fb70c..974e2f61c 100644 --- a/covalent/cloud_resource_manager/core.py +++ b/covalent/cloud_resource_manager/core.py @@ -425,6 +425,17 @@ def up(self, print_callback: Callable, dry_run: bool = True) -> None: # Setup terraform infra variables as passed by the user tf_vars_env_dict = os.environ.copy() + # Write the default values to the terraform.tfvars file + infra_settings = self.ExecutorInfraDefaults.schema()["properties"] + with open(tfvars_file, "w", encoding="utf-8") as f: + for key, value in infra_settings.items(): + if "default" in value: + tf_vars_env_dict[f"TF_VAR_{key}"] = value["default"] + + if value["default"] != "": + f.write(f'{key}="{value["default"]}"\n') + + # Overwrite the default values with the user passed values if self.executor_options: with open(tfvars_file, "w", encoding="utf-8") as f: for key, value in self.executor_options.items():