Skip to content

Commit

Permalink
Prompt user if Terraform utilised for deploying infrastructure (#1004)
Browse files Browse the repository at this point in the history
## Changes
Added prompt is_terraform_used and updated the same in the config of
WorkspaceInstaller

Resolves #393

---------

Co-authored-by: Serge Smertin <259697+nfx@users.noreply.github.com>
  • Loading branch information
prajin-29 and nfx authored Mar 5, 2024
1 parent 33533a4 commit 34b51f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/databricks/labs/ucx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class WorkspaceConfig: # pylint: disable=too-many-instance-attributes
policy_id: str | None = None
num_days_submit_runs_history: int = 30

# Flag to see if terraform has been used for deploying certain entities
is_terraform_used: bool = False

def replace_inventory_variable(self, text: str) -> str:
return text.replace("$inventory", f"hive_metastore.{self.inventory_database}")

Expand Down
4 changes: 4 additions & 0 deletions src/databricks/labs/ucx/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def warehouse_type(_):
instance_profile, spark_conf_dict = self._get_ext_hms_conf_from_policy(cluster_policy)

policy_id = self._create_cluster_policy(inventory_database, spark_conf_dict, instance_profile)

# Check if terraform is being used
is_terraform_used = self._prompts.confirm("Do you use Terraform to deploy your infrastructure?")
config = WorkspaceConfig(
inventory_database=inventory_database,
workspace_group_regex=configure_groups.workspace_group_regex,
Expand All @@ -258,6 +261,7 @@ def warehouse_type(_):
instance_profile=instance_profile,
spark_conf=spark_conf_dict,
policy_id=policy_id,
is_terraform_used=is_terraform_used,
)
self._installation.save(config)
ws_file_url = self._installation.workspace_link(config.__file__)
Expand Down

0 comments on commit 34b51f2

Please sign in to comment.