Skip to content

Commit

Permalink
Fix crash on destination import (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
beevital authored Jan 10, 2022
1 parent 8b49ee0 commit da101ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*.so
*.dylib

# VScode workspace files
*.code-workspace

# Test binary, built with `go test -c`
*.test

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v0.2.2...HEAD)
## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v0.2.3...HEAD)

## [0.2.3](https://github.com/fivetran/terraform-provider-fivetran/compare/v0.2.2...v0.2.3) - 2022-01-10

## Fixed
- Crash on `terraform import fivetran_destination.name <group_id>`

## [0.2.2](https://github.com/fivetran/terraform-provider-fivetran/compare/v0.2.1...v0.2.2) - 2021-12-31

Expand Down
6 changes: 4 additions & 2 deletions fivetran/resource_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ func resourceDestinationReadConfig(resp *fivetran.DestinationDetailsResponse, cu
c["database"] = resp.Data.Config.Database
c["auth"] = resp.Data.Config.Auth
c["user"] = resp.Data.Config.User
// The REST API sends the password field masked. We use the state stored password here.
c["password"] = currentConfig[0].(map[string]interface{})["password"].(string)
// The REST API sends the password field masked. We use the state stored password here if possible.
if len(currentConfig) > 0 {
c["password"] = currentConfig[0].(map[string]interface{})["password"].(string)
}
// connection_type is returned as ConnectionMethod
c["connection_type"] = dataSourceDestinationConfigNormalizeConnectionType(resp.Data.Config.ConnectionMethod)
c["tunnel_host"] = resp.Data.Config.TunnelHost
Expand Down

0 comments on commit da101ce

Please sign in to comment.