From 415dd1aeab075cc1d2b7aeabea64e28d0a27453b Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 21 Jul 2023 13:19:49 +0100 Subject: [PATCH] Add resource group name to matcha.state after provisioning the remote state rg and storage --- src/matcha_ml/infrastructure/remote_state_storage/output.tf | 5 +++++ src/matcha_ml/state/matcha_state.py | 2 +- src/matcha_ml/templates/azure_template.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/matcha_ml/infrastructure/remote_state_storage/output.tf b/src/matcha_ml/infrastructure/remote_state_storage/output.tf index 6c50a7b5..d5516cba 100644 --- a/src/matcha_ml/infrastructure/remote_state_storage/output.tf +++ b/src/matcha_ml/infrastructure/remote_state_storage/output.tf @@ -22,3 +22,8 @@ output "cloud_azure_location"{ description = "The Azure location in which the resources are provisioned" value = var.location } + +output "cloud_azure_resource_group_name" { + description = "Name of the Azure resource group" + value = module.resource_group.name +} diff --git a/src/matcha_ml/state/matcha_state.py b/src/matcha_ml/state/matcha_state.py index d31c7948..cd8f90ae 100644 --- a/src/matcha_ml/state/matcha_state.py +++ b/src/matcha_ml/state/matcha_state.py @@ -140,7 +140,7 @@ def __init__( Raises: MatchaError: if the state file does not exist. - MatchaError: if MatchaStateService is initialize with both 'matcha_state' and 'terraform_output' arguments. + MatchaError: if MatchaStateService is initialized with both 'matcha_state' and 'terraform_output' arguments. """ if matcha_state is not None and terraform_output is not None: raise MatchaError( diff --git a/src/matcha_ml/templates/azure_template.py b/src/matcha_ml/templates/azure_template.py index e7b2a4fe..3aeeba4c 100644 --- a/src/matcha_ml/templates/azure_template.py +++ b/src/matcha_ml/templates/azure_template.py @@ -53,6 +53,7 @@ def build_template( # Add matcha.state file one directory above the template config_dict = vars(config) _ = config_dict.pop("password", None) + config_dict["resource-group-name"] = f"{config_dict['prefix']}-resources" initial_state_file_dict = {"cloud": config_dict} matcha_state = MatchaState.from_dict(initial_state_file_dict) MatchaStateService(matcha_state=matcha_state)