Skip to content

Commit 7d6b3ed

Browse files
Add One Lake Datalake support (#228)
1 parent a24ea60 commit 7d6b3ed

12 files changed

+65
-7
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.1.3...HEAD)
8+
## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.1.4...HEAD)
9+
10+
## [1.1.4](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.1.3...v1.1.4)
11+
12+
## Added
13+
- Resource `fivetran_destination` updates:
14+
- Added field `fivetran_destination.config.workspace_name` for OneLake.
15+
- Added field `fivetran_destination.config.lakehouse_name` for OneLake.
916

1017
## [1.1.3](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.1.2...1.1.3)
1118

docs/data-sources/destination.md

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Optional:
5555
- `host` (String) Server name
5656
- `http_path` (String) HTTP path
5757
- `is_private_key_encrypted` (String) Indicates that a private key is encrypted. The default value: `false`. The field can be specified if authentication type is `KEY_PAIR`.
58+
- `lakehouse_name` (String, Sensitive) OneLake lakehouse name
5859
- `passphrase` (String, Sensitive) In case private key is encrypted, you are required to enter passphrase that was used to encrypt the private key. The field can be specified if authentication type is `KEY_PAIR`.
5960
- `password` (String, Sensitive) Database user password
6061
- `personal_access_token` (String, Sensitive) Personal access token
@@ -74,6 +75,7 @@ Optional:
7475
- `tunnel_port` (String) SSH server port name. Must be populated if `connection_type` is set to `SshTunnel`.
7576
- `tunnel_user` (String) SSH user name. Must be populated if `connection_type` is set to `SshTunnel`.
7677
- `user` (String) Database user name
78+
- `workspace_name` (String, Sensitive) OneLake workspace name
7779

7880
Read-Only:
7981

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description: |-
1616
terraform {
1717
required_providers {
1818
fivetran = {
19-
version = "1.1.2"
19+
version = "1.1.4"
2020
source = "fivetran/fivetran"
2121
}
2222
}

docs/resources/destination.md

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Optional:
7575
- `host` (String) Server name
7676
- `http_path` (String) HTTP path
7777
- `is_private_key_encrypted` (String) Indicates that a private key is encrypted. The default value: `false`. The field can be specified if authentication type is `KEY_PAIR`.
78+
- `lakehouse_name` (String, Sensitive) OneLake lakehouse name
7879
- `passphrase` (String, Sensitive) In case private key is encrypted, you are required to enter passphrase that was used to encrypt the private key. The field can be specified if authentication type is `KEY_PAIR`.
7980
- `password` (String, Sensitive) Database user password
8081
- `personal_access_token` (String, Sensitive) Personal access token
@@ -94,6 +95,7 @@ Optional:
9495
- `tunnel_port` (String) SSH server port name. Must be populated if `connection_type` is set to `SshTunnel`.
9596
- `tunnel_user` (String) SSH user name. Must be populated if `connection_type` is set to `SshTunnel`.
9697
- `user` (String) Database user name
98+
- `workspace_name` (String, Sensitive) OneLake workspace name
9799

98100
Read-Only:
99101

fivetran/data_source_destination.go

+14
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,18 @@ func dataSourceDestinationSchemaConfig() *schema.Schema {
251251
Sensitive: true,
252252
Description: "Secret Value of your Azure Data Lake Storage",
253253
},
254+
"workspace_name": {
255+
Type: schema.TypeString,
256+
Optional: true,
257+
Sensitive: true,
258+
Description: "OneLake workspace name",
259+
},
260+
"lakehouse_name": {
261+
Type: schema.TypeString,
262+
Optional: true,
263+
Sensitive: true,
264+
Description: "OneLake lakehouse name",
265+
},
254266
},
255267
},
256268
}
@@ -346,6 +358,8 @@ func dataSourceDestinationConfig(resp *destinations.DestinationDetailsResponse)
346358
c["tenant_id"] = resp.Data.Config.TenantId
347359
c["client_id"] = resp.Data.Config.ClientId
348360
c["secret_value"] = resp.Data.Config.SecretValue
361+
c["workspace_name"] = resp.Data.Config.WorkspaceName
362+
c["lakehouse_name"] = resp.Data.Config.LakehouseName
349363

350364
config = append(config, c)
351365

fivetran/provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
var limit = 1000 // REST API response objects limit per HTTP request
13-
const Version = "1.1.3" // Current provider version
13+
const Version = "1.1.4" // Current provider version
1414

1515
func Provider() *schema.Provider {
1616
var resourceMap = map[string]*schema.Resource{

fivetran/resource_destination.go

+24
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,18 @@ func resourceDestinationSchemaConfig() *schema.Schema {
280280
Sensitive: true,
281281
Description: "Secret Value of your Azure Data Lake Storage",
282282
},
283+
"workspace_name": {
284+
Type: schema.TypeString,
285+
Optional: true,
286+
Sensitive: true,
287+
Description: "OneLake workspace name",
288+
},
289+
"lakehouse_name": {
290+
Type: schema.TypeString,
291+
Optional: true,
292+
Sensitive: true,
293+
Description: "OneLake lakehouse name",
294+
},
283295
},
284296
},
285297
}
@@ -511,6 +523,8 @@ func resourceDestinationReadConfig(resp *destinations.DestinationDetailsResponse
511523
c["container_name"] = resp.Data.Config.ContainerName
512524
c["tenant_id"] = resp.Data.Config.TenantId
513525
c["client_id"] = resp.Data.Config.ClientId
526+
c["workspace_name"] = resp.Data.Config.WorkspaceName
527+
c["lakehouse_name"] = resp.Data.Config.LakehouseName
514528

515529
config = append(config, c)
516530

@@ -685,5 +699,15 @@ func resourceDestinationCreateConfig(config []interface{}) (*destinations.Destin
685699
hasConfig = true
686700
}
687701

702+
if v := c["workspace_name"].(string); v != "" {
703+
fivetranConfig.WorkspaceName(v)
704+
hasConfig = true
705+
}
706+
707+
if v := c["lakehouse_name"].(string); v != "" {
708+
fivetranConfig.LakehouseName(v)
709+
hasConfig = true
710+
}
711+
688712
return fivetranConfig, hasConfig
689713
}

fivetran/tests/mock/datasource_destination_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ func TestDataSourceDestinationConfigMappingMock(t *testing.T) {
8383
resource.TestCheckResourceAttr("data.fivetran_destination.test_destintion", "config.0.tenant_id", "tenant_id"),
8484
resource.TestCheckResourceAttr("data.fivetran_destination.test_destintion", "config.0.client_id", "client_id"),
8585
resource.TestCheckResourceAttr("data.fivetran_destination.test_destintion", "config.0.secret_value", "******"),
86+
resource.TestCheckResourceAttr("data.fivetran_destination.test_destintion", "config.0.workspace_name", "workspace_name"),
87+
resource.TestCheckResourceAttr("data.fivetran_destination.test_destintion", "config.0.lakehouse_name", "lakehouse_name"),
8688
),
8789
}
8890

fivetran/tests/mock/resource_destination_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ const (
8686
"container_name": "container_name",
8787
"tenant_id": "tenant_id",
8888
"client_id": "client_id",
89-
"secret_value": "******"
90-
89+
"secret_value": "******",
90+
"workspace_name": "workspace_name",
91+
"lakehouse_name": "lakehouse_name"
9192
}
9293
}
9394
`
@@ -147,6 +148,8 @@ func setupMockClientDestinationConfigMapping(t *testing.T) {
147148
assertKeyExistsAndHasValue(t, config, "tenant_id", "tenant_id")
148149
assertKeyExistsAndHasValue(t, config, "client_id", "client_id")
149150
assertKeyExistsAndHasValue(t, config, "secret_value", "secret_value")
151+
assertKeyExistsAndHasValue(t, config, "workspace_name", "workspace_name")
152+
assertKeyExistsAndHasValue(t, config, "lakehouse_name", "lakehouse_name")
150153

151154
assertKeyExistsAndHasValue(t, config, "tunnel_port", "123")
152155

@@ -216,6 +219,8 @@ func TestResourceDestinationMappingMock(t *testing.T) {
216219
tenant_id = "tenant_id"
217220
client_id = "client_id"
218221
secret_value = "secret_value"
222+
workspace_name = "workspace_name"
223+
lakehouse_name = "lakehouse_name"
219224
}
220225
}`,
221226

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module github.com/fivetran/terraform-provider-fivetran
22

33
require (
4-
github.com/fivetran/go-fivetran v0.7.13
4+
github.com/fivetran/go-fivetran v0.7.14
55
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
66
)
77

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
2323
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
2424
github.com/fivetran/go-fivetran v0.7.13 h1:FYb4+5OzAFGnUnrTLDElyA8c0ZmI3WGYv+KuKWsaVPw=
2525
github.com/fivetran/go-fivetran v0.7.13/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y=
26+
github.com/fivetran/go-fivetran v0.7.14 h1:EXijYfLl3R1yXVXbYfGrn49MnBPvZQ3N+q3yxk1qq+c=
27+
github.com/fivetran/go-fivetran v0.7.14/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y=
2628
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
2729
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
2830
github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A=

templates/index.md.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description: |-
1616
terraform {
1717
required_providers {
1818
fivetran = {
19-
version = "1.1.3"
19+
version = "1.1.4"
2020
source = "fivetran/fivetran"
2121
}
2222
}

0 commit comments

Comments
 (0)