Skip to content

Commit df3f644

Browse files
authored
Merge pull request #47 from IvanOfThings/feat/change-clickhouse-driver
BREAKING CHANGE: change the used clickhouse driver to the official one
2 parents 64286f7 + b6cf5ce commit df3f644

30 files changed

+768
-932
lines changed

.github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ jobs:
7171
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
7272
ports:
7373
- 8123:8123
74-
- 9090:9000
75-
- 9099:9009
74+
- 9000:9000
75+
- 9009:9009
7676
# Set health checks to wait until redis has started
7777
options: >-
7878
--health-cmd "clickhouse-client --database=system --query='select * from databases'"
@@ -121,7 +121,7 @@ jobs:
121121
TF_CLICKHOUSE_HOST: "127.0.0.1"
122122
TF_CLICKHOUSE_USERNAME: "default"
123123
TF_CLICKHOUSE_PASSWORD: ""
124-
TF_CLICKHOUSE_PORT: "8123"
124+
TF_CLICKHOUSE_PORT: "9000"
125125

126126
# Set whatever additional acceptance test env vars here. You can
127127
# optionally use data from your repository secrets using the

GNUmakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ default: testacc
1111
# Run acceptance tests
1212
.PHONY: testacc
1313
testacc:
14-
TF_ACC=1 TF_CLICKHOUSE_HOST="127.0.0.1" TF_CLICKHOUSE_USERNAME="default" TF_CLICKHOUSE_PASSWORD="" TF_CLICKHOUSE_PORT=8923 go test -tags testing ./... -v $(TESTARGS) -timeout 120m
14+
TF_ACC=1 TF_CLICKHOUSE_HOST="127.0.0.1" TF_CLICKHOUSE_USERNAME="default" TF_CLICKHOUSE_PASSWORD="" TF_CLICKHOUSE_PORT=9000 go test -tags testing ./... -v $(TESTARGS) -timeout 120m
1515

1616
build:
1717
go build -o ${BINARY}

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ Then commit the changes to `go.mod` and `go.sum`.
4040
## Using the provider
4141

4242

43-
Definining provider
43+
Definining provider. The port should be the Clickhouse native protocol port (9000 by default, and 9440 for Clickhouse Cloud)
4444

4545
```hcl
4646
provider "clickhouse" {
47-
port = 8123
47+
port = 9000 # Clickhouse native protocol port
4848
host = "127.0.0.1"
4949
username = "default"
5050
password = ""
@@ -57,7 +57,7 @@ In order to definte url, username and password in a safety way it is possible to
5757
TF_CLICKHOUSE_USERNAME=default
5858
TF_CLICKHOUSE_PASSWORD=""
5959
TF_CLICKHOUSE_HOST="127.0.0.1"
60-
TF_CLICKHOUSE_PORT=8123
60+
TF_CLICKHOUSE_PORT=9000
6161
```
6262

6363
```hcl
@@ -73,7 +73,7 @@ Configuring provider
7373

7474
```hcl
7575
provider "clickhouse" {
76-
port = 8923
76+
port = 9000
7777
host = "127.0.0.1"
7878
username = "default"
7979
password = ""
@@ -97,7 +97,7 @@ I is possible to use macros defined for cluster, databases, installation names i
9797

9898
```hcl
9999
provider "clickhouse" {
100-
port = 8123
100+
port = 9000
101101
host = "127.0.0.1"
102102
username = "default"
103103
password = ""

docs/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ provider "clickhouse" {
3939
- `default_cluster` (String) Default cluster, if provided will be used when no cluster is provided
4040
- `host` (String, Sensitive) Clickhouse server url
4141
- `password` (String, Sensitive) Clickhouse user password with admin privileges
42-
- `port` (Number) Clickhouse server port
42+
- `port` (Number) Clickhouse server native protocol port (TCP)
43+
- `secure` (Boolean) Clickhouse secure connection
4344
- `username` (String) Clickhouse username with admin privileges

go.mod

+23-12
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,34 @@ go 1.19
55
replace github.com/hashicorp/terraform-provider-scaffolding => github.com/IvanOfThings/terraform-provider-clickhouse v0.1.0
66

77
require (
8+
github.com/ClickHouse/clickhouse-go/v2 v2.15.0
89
github.com/go-playground/validator/v10 v10.11.1
910
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
1011
github.com/hashicorp/terraform-plugin-docs v0.13.0
1112
github.com/hashicorp/terraform-plugin-log v0.7.0
1213
github.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0
1314
github.com/joho/godotenv v1.4.0
14-
github.com/leprosus/golang-clickhouse v1.0.0
1515
)
1616

1717
require (
18+
github.com/ClickHouse/ch-go v0.58.2 // indirect
1819
github.com/Masterminds/goutils v1.1.1 // indirect
1920
github.com/Masterminds/semver/v3 v3.1.1 // indirect
2021
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
2122
github.com/agext/levenshtein v1.2.2 // indirect
23+
github.com/andybalholm/brotli v1.0.6 // indirect
2224
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
2325
github.com/armon/go-radix v1.0.0 // indirect
2426
github.com/bgentry/speakeasy v0.1.0 // indirect
2527
github.com/davecgh/go-spew v1.1.1 // indirect
2628
github.com/fatih/color v1.13.0 // indirect
29+
github.com/go-faster/city v1.0.1 // indirect
30+
github.com/go-faster/errors v0.6.1 // indirect
2731
github.com/go-playground/locales v0.14.0 // indirect
2832
github.com/go-playground/universal-translator v0.18.0 // indirect
29-
github.com/golang/protobuf v1.5.2 // indirect
33+
github.com/golang/protobuf v1.5.3 // indirect
3034
github.com/google/go-cmp v0.5.9 // indirect
31-
github.com/google/uuid v1.3.0 // indirect
35+
github.com/google/uuid v1.3.1 // indirect
3236
github.com/hashicorp/errwrap v1.1.0 // indirect
3337
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
3438
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -48,8 +52,8 @@ require (
4852
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
4953
github.com/huandu/xstrings v1.3.2 // indirect
5054
github.com/imdario/mergo v0.3.13 // indirect
55+
github.com/klauspost/compress v1.16.7 // indirect
5156
github.com/leodido/go-urn v1.2.1 // indirect
52-
github.com/leprosus/golang-composer v1.0.0 // indirect
5357
github.com/mattn/go-colorable v0.1.12 // indirect
5458
github.com/mattn/go-isatty v0.0.14 // indirect
5559
github.com/mitchellh/cli v1.1.4 // indirect
@@ -59,20 +63,27 @@ require (
5963
github.com/mitchellh/mapstructure v1.5.0 // indirect
6064
github.com/mitchellh/reflectwalk v1.0.2 // indirect
6165
github.com/oklog/run v1.0.0 // indirect
66+
github.com/paulmach/orb v0.10.0 // indirect
67+
github.com/pierrec/lz4/v4 v4.1.18 // indirect
68+
github.com/pkg/errors v0.9.1 // indirect
6269
github.com/posener/complete v1.2.3 // indirect
6370
github.com/russross/blackfriday v1.6.0 // indirect
71+
github.com/segmentio/asm v1.2.0 // indirect
6472
github.com/shopspring/decimal v1.3.1 // indirect
6573
github.com/spf13/cast v1.5.0 // indirect
6674
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
6775
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
6876
github.com/vmihailenco/tagparser v0.1.1 // indirect
6977
github.com/zclconf/go-cty v1.11.0 // indirect
70-
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
71-
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
72-
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect
73-
golang.org/x/text v0.3.7 // indirect
74-
google.golang.org/appengine v1.6.6 // indirect
75-
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect
76-
google.golang.org/grpc v1.48.0 // indirect
77-
google.golang.org/protobuf v1.28.1 // indirect
78+
go.opentelemetry.io/otel v1.19.0 // indirect
79+
go.opentelemetry.io/otel/trace v1.19.0 // indirect
80+
golang.org/x/crypto v0.14.0 // indirect
81+
golang.org/x/net v0.17.0 // indirect
82+
golang.org/x/sys v0.13.0 // indirect
83+
golang.org/x/text v0.13.0 // indirect
84+
google.golang.org/appengine v1.6.7 // indirect
85+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
86+
google.golang.org/grpc v1.57.1 // indirect
87+
google.golang.org/protobuf v1.30.0 // indirect
88+
gopkg.in/yaml.v3 v3.0.1 // indirect
7889
)

0 commit comments

Comments
 (0)