Skip to content

Commit

Permalink
fix connection importer bug (#17)
Browse files Browse the repository at this point in the history
* fix connection importer bug

* bump golangci-lint version
  • Loading branch information
hirosassa authored Mar 6, 2022
1 parent 9eb93c2 commit aa9e359
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41
version: v1.44.2
check:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.2
0.8.2
47 changes: 32 additions & 15 deletions pkg/looker/resource_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,22 +539,39 @@ func flattenConnection(connection apiclient.DBConnection, d *schema.ResourceData
if err := d.Set("after_connect_statements", connection.AfterConnectStatements); err != nil {
return err
}

if connection.PdtContextOverride != nil {
if err := d.Set("pdt_context_override", []map[string]interface{}{
{
"context": *connection.PdtContextOverride.Context,
"host": *connection.PdtContextOverride.Host,
"port": *connection.PdtContextOverride.Port,
"username": *connection.PdtContextOverride.Username,
"password": *connection.PdtContextOverride.Password,
"certitficate": *connection.PdtContextOverride.Certificate,
"file_type": *connection.PdtContextOverride.FileType,
"database": *connection.PdtContextOverride.Database,
"schema": *connection.PdtContextOverride.Schema,
"jdbc_additional_params": *connection.PdtContextOverride.JdbcAdditionalParams,
"after_connect_statements": *connection.PdtContextOverride.AfterConnectStatements,
},
}); err != nil {
pdtContextOverride := make(map[string]interface{})

if connection.PdtContextOverride.Context != nil {
pdtContextOverride["context"] = *connection.PdtContextOverride.Context
}
if connection.PdtContextOverride.Host != nil {
pdtContextOverride["host"] = *connection.PdtContextOverride.Host
}
if connection.PdtContextOverride.Port != nil {
pdtContextOverride["port"] = *connection.PdtContextOverride.Port
}
if connection.PdtContextOverride.Username != nil {
pdtContextOverride["username"] = *connection.PdtContextOverride.Username
}
if connection.PdtContextOverride.Password != nil {
pdtContextOverride["password"] = *connection.PdtContextOverride.Password
}
if connection.PdtContextOverride.Certificate != nil {
pdtContextOverride["certificate"] = *connection.PdtContextOverride.Certificate
}
if connection.PdtContextOverride.FileType != nil {
pdtContextOverride["file_type"] = *connection.PdtContextOverride.FileType
}
if connection.PdtContextOverride.Database != nil {
pdtContextOverride["database"] = *connection.PdtContextOverride.Database
}
if connection.PdtContextOverride.Schema != nil {
pdtContextOverride["schema"] = *connection.PdtContextOverride.Schema
}

if err := d.Set("pdt_context_override", []map[string]interface{}{pdtContextOverride}); err != nil {
return err
}
}
Expand Down

0 comments on commit aa9e359

Please sign in to comment.