From d6f2a21f1b191eb5bfc7f38beb48bdb783211570 Mon Sep 17 00:00:00 2001 From: Ernie Billing Date: Mon, 16 Nov 2020 16:40:27 -0800 Subject: [PATCH] [#175098075] removed local variables that were causing import failure --- .../mssql-db-fog-outputs.tf | 17 +++++------------ pkg/providers/tf/job_runner.go | 4 +++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf b/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf index 3497f8268..10b4d8651 100644 --- a/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf +++ b/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf @@ -1,16 +1,9 @@ - -locals { - serverName = var.existing ? var.instance_name : azurerm_sql_failover_group.failover_group[0].name - serverFQDN = format("%s.database.windows.net", local.serverName) - dbName = var.existing ? var.db_name : azurerm_mssql_database.primary_db[0].name -} - -output sqldbName {value = local.dbName} -output sqlServerName {value = local.serverName} -output sqlServerFullyQualifiedDomainName {value = local.serverFQDN} -output hostname {value = local.serverFQDN} +output sqldbName {value = var.existing ? var.db_name : azurerm_mssql_database.primary_db[0].name} +output sqlServerName {value = var.existing ? var.instance_name : azurerm_sql_failover_group.failover_group[0].name} +output sqlServerFullyQualifiedDomainName {value = format("%s.database.windows.net", var.existing ? var.instance_name : azurerm_sql_failover_group.failover_group[0].name)} +output hostname {value = format("%s.database.windows.net", var.existing ? var.instance_name : azurerm_sql_failover_group.failover_group[0].name)} output port {value = 1433} -output name {value = local.dbName} +output name {value = var.existing ? var.db_name : azurerm_mssql_database.primary_db[0].name} output username {value = var.server_credential_pairs[var.server_pair].admin_username} output password {value = var.server_credential_pairs[var.server_pair].admin_password} output status { diff --git a/pkg/providers/tf/job_runner.go b/pkg/providers/tf/job_runner.go index bb89427b5..0e998c169 100644 --- a/pkg/providers/tf/job_runner.go +++ b/pkg/providers/tf/job_runner.go @@ -141,11 +141,13 @@ func (runner *TfJobRunner) Import(ctx context.Context, id string, importResource } go func() { + logger := utils.NewLogger("Import") resources := make(map[string]string) for _, resource := range importResources { resources[fmt.Sprintf("%s", resource.TfResource)] = resource.IaaSResource } if err := workspace.Import(resources); err != nil { + logger.Error("Import Failed", err) runner.operationFinished(err, workspace, deployment) return } @@ -160,9 +162,9 @@ func (runner *TfJobRunner) Import(ctx context.Context, id string, importResource } workspace.Modules[0].Definitions["main"] = tf - logger := utils.NewLogger("Import") logger.Info("new workspace", lager.Data{ "workspace": workspace, + "tf": tf, }) err = workspace.Apply()