Skip to content

Commit

Permalink
[#175098075] removed local variables that were causing import failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernie Billing committed Nov 17, 2020
1 parent 05839be commit d6f2a21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion pkg/providers/tf/job_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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()
Expand Down

0 comments on commit d6f2a21

Please sign in to comment.