Skip to content

Commit b9bc262

Browse files
ldvcwilfriedroset
authored andcommitted
feat: Rewrite using the new Framework instead of the old SDKv2.
Signed-off-by: Ludovic Terrier <ludovic.terrier@ovhcloud.com>
1 parent 7cc5efb commit b9bc262

29 files changed

Lines changed: 1612 additions & 1004 deletions

.golangci.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
version: "2"
2+
run:
3+
build-tags:
4+
- netgo
5+
- requires_docker
6+
- requires_libpcap
7+
output:
8+
formats:
9+
text:
10+
path: stdout
11+
colors: false
12+
linters:
13+
default: none
14+
enable:
15+
# Checks whether HTTP response body is closed successfully.
16+
- bodyclose
17+
# Checks whether Rows.Err of rows is checked successfully.
18+
# - rowserrcheck # Does not support generics yet (see https://github.com/golangci/golangci-lint/issues/2649)
19+
# Detects places where loop variables are copied.
20+
- copyloopvar
21+
# Checks assignments with too many blank identifiers (e.g. x, , , _, := f()).
22+
- dogsled
23+
# Tool for code clone detection.
24+
- dupl
25+
# Checking for unchecked errors in Go code.
26+
# These unchecked errors can be critical bugs in some cases.
27+
- errcheck
28+
# Find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
29+
- errorlint
30+
- fatcontext
31+
# Finds repeated strings that could be replaced by a constant.
32+
- goconst
33+
# Checks that printf-like functions are named with f at the end.
34+
- goprintffuncname
35+
# Inspects source code for security problems.
36+
- gosec
37+
# Vet examines Go source code and reports suspicious constructs.
38+
- govet
39+
# Detects when assignments to existing variables are not used.
40+
- ineffassign
41+
# Finds commonly misspelled English words.
42+
- misspell
43+
# Checks that functions with naked returns are not longer than a maximum size (can be zero).
44+
- nakedret
45+
# It's a set of rules from staticcheck.
46+
# Reports ill-formed or insufficient nolint directives.
47+
- nolintlint
48+
# Fast, configurable, extensible, flexible, and beautiful linter for Go.
49+
- revive
50+
- staticcheck
51+
# Remove unnecessary type conversions.
52+
- unconvert
53+
# Reports unused function parameters.
54+
- unparam
55+
# Reports unused function parameters.
56+
- unused
57+
settings:
58+
errorlint:
59+
errorf: false
60+
asserts: false
61+
comparison: true
62+
exclusions:
63+
generated: lax
64+
presets:
65+
- comments
66+
- common-false-positives
67+
- legacy
68+
- std-error-handling
69+
rules:
70+
- linters:
71+
- revive
72+
text: if-return
73+
paths:
74+
- third_party$
75+
- builtin$
76+
- examples$
77+
formatters:
78+
enable:
79+
# Check whether code was gofmt-ed.
80+
- gofmt
81+
# Check import statements are formatted according to the 'goimport' command.
82+
- goimports
83+
exclusions:
84+
generated: lax
85+
paths:
86+
- third_party$
87+
- builtin$
88+
- examples$

GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
MIMIR_VERSION ?= 2.6.0
1+
MIMIR_VERSION ?= 2.16.1
22

33
default: testacc
44

55
# Run acceptance tests
66
.PHONY: testacc docs
77
testacc: compose-up
8-
TF_ACC=1 MIMIRTOOL_ADDRESS=http://localhost:8080 go test ./... -v $(TESTARGS) -timeout 120m
8+
TF_ACC=1 TF_LOG=INFO MIMIRTOOL_ADDRESS=http://localhost:8080 go test ./... -v $(TESTARGS) -timeout 120m
99

1010
build:
1111
go build -o dist/

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42

53
mimir:

go.mod

Lines changed: 97 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,176 +1,161 @@
11
module github.com/ovh/terraform-provider-mimirtool
22

3-
go 1.23.0
4-
5-
toolchain go1.23.7
3+
go 1.23.7
64

75
require (
86
github.com/grafana/mimir v0.0.0-20240722104006-e8e4dc777899
9-
github.com/hashicorp/terraform-plugin-docs v0.14.1
10-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
11-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
7+
github.com/hashicorp/terraform-plugin-framework v1.15.0
8+
github.com/hashicorp/terraform-plugin-go v0.28.0
9+
github.com/hashicorp/terraform-plugin-log v0.9.0
10+
github.com/hashicorp/terraform-plugin-testing v1.13.2
11+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
1212
)
1313

1414
require (
15-
github.com/Masterminds/goutils v1.1.1 // indirect
16-
github.com/Masterminds/semver/v3 v3.2.0 // indirect
17-
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
18-
github.com/agext/levenshtein v1.2.3 // indirect
15+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
16+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 // indirect
17+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect
18+
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
19+
github.com/DmitriyVTitov/size v1.5.0 // indirect
20+
github.com/ProtonMail/go-crypto v1.1.6 // indirect
21+
github.com/agext/levenshtein v1.2.2 // indirect
1922
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 // indirect
20-
github.com/armon/go-radix v1.0.0 // indirect
21-
github.com/aws/aws-sdk-go v1.54.20 // indirect
23+
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
24+
github.com/armon/go-metrics v0.4.1 // indirect
25+
github.com/aws/aws-sdk-go v1.53.16 // indirect
26+
github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 // indirect
2227
github.com/beorn7/perks v1.0.1 // indirect
23-
github.com/bgentry/speakeasy v0.1.0 // indirect
2428
github.com/cespare/xxhash/v2 v2.3.0 // indirect
29+
github.com/cloudflare/circl v1.6.1 // indirect
30+
github.com/coreos/go-semver v0.3.0 // indirect
31+
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
2532
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2633
github.com/dennwc/varint v1.0.0 // indirect
34+
github.com/dgraph-io/ristretto v0.1.1 // indirect
35+
github.com/dustin/go-humanize v1.0.1 // indirect
2736
github.com/edsrzf/mmap-go v1.1.0 // indirect
28-
github.com/fatih/color v1.17.0 // indirect
37+
github.com/efficientgo/core v1.0.0-rc.0.0.20221201130417-ba593f67d2a4 // indirect
38+
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect
39+
github.com/fatih/color v1.16.0 // indirect
2940
github.com/go-kit/log v0.2.1 // indirect
3041
github.com/go-logfmt/logfmt v0.6.0 // indirect
3142
github.com/go-logr/logr v1.4.2 // indirect
3243
github.com/go-logr/stdr v1.2.2 // indirect
33-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
44+
github.com/gogo/googleapis v1.4.1 // indirect
45+
github.com/gogo/protobuf v1.3.2 // indirect
46+
github.com/gogo/status v1.1.1 // indirect
47+
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
48+
github.com/golang/glog v1.2.4 // indirect
49+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
3450
github.com/golang/protobuf v1.5.4 // indirect
3551
github.com/golang/snappy v0.0.4 // indirect
36-
github.com/google/go-cmp v0.6.0 // indirect
52+
github.com/google/btree v1.1.2 // indirect
53+
github.com/google/go-cmp v0.7.0 // indirect
3754
github.com/google/uuid v1.6.0 // indirect
3855
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
56+
github.com/hashicorp/consul/api v1.29.1 // indirect
3957
github.com/hashicorp/errwrap v1.1.0 // indirect
4058
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
4159
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
42-
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
60+
github.com/hashicorp/go-cty v1.5.0 // indirect
4361
github.com/hashicorp/go-hclog v1.6.3 // indirect
62+
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
63+
github.com/hashicorp/go-msgpack v1.1.5 // indirect
4464
github.com/hashicorp/go-multierror v1.1.1 // indirect
45-
github.com/hashicorp/go-plugin v1.6.1 // indirect
65+
github.com/hashicorp/go-plugin v1.6.3 // indirect
66+
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
67+
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
68+
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
4669
github.com/hashicorp/go-uuid v1.0.3 // indirect
4770
github.com/hashicorp/go-version v1.7.0 // indirect
48-
github.com/hashicorp/hc-install v0.6.4 // indirect
49-
github.com/hashicorp/hcl/v2 v2.21.0 // indirect
71+
github.com/hashicorp/golang-lru v1.0.2 // indirect
72+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
73+
github.com/hashicorp/hc-install v0.9.2 // indirect
74+
github.com/hashicorp/hcl/v2 v2.23.0 // indirect
5075
github.com/hashicorp/logutils v1.0.0 // indirect
51-
github.com/hashicorp/terraform-exec v0.21.0 // indirect
52-
github.com/hashicorp/terraform-json v0.22.1 // indirect
53-
github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect
54-
github.com/hashicorp/terraform-plugin-log v0.9.0
55-
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
76+
github.com/hashicorp/memberlist v0.5.0 // indirect
77+
github.com/hashicorp/serf v0.10.1 // indirect
78+
github.com/hashicorp/terraform-exec v0.23.0 // indirect
79+
github.com/hashicorp/terraform-json v0.25.0 // indirect
80+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 // indirect
81+
github.com/hashicorp/terraform-registry-address v0.2.5 // indirect
5682
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
5783
github.com/hashicorp/yamux v0.1.1 // indirect
58-
github.com/huandu/xstrings v1.4.0 // indirect
59-
github.com/imdario/mergo v0.3.16 // indirect
6084
github.com/jmespath/go-jmespath v0.4.0 // indirect
6185
github.com/jpillora/backoff v1.0.0 // indirect
86+
github.com/klauspost/compress v1.17.9 // indirect
87+
github.com/kylelemons/godebug v1.1.0 // indirect
6288
github.com/mattn/go-colorable v0.1.13 // indirect
6389
github.com/mattn/go-isatty v0.0.20 // indirect
64-
github.com/mitchellh/cli v1.1.5 // indirect
90+
github.com/miekg/dns v1.1.59 // indirect
6591
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
6692
github.com/mitchellh/copystructure v1.2.0 // indirect
93+
github.com/mitchellh/go-homedir v1.1.0 // indirect
6794
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
6895
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
6996
github.com/mitchellh/mapstructure v1.5.0 // indirect
7097
github.com/mitchellh/reflectwalk v1.0.2 // indirect
98+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
7199
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
72100
github.com/oklog/run v1.1.0 // indirect
73101
github.com/oklog/ulid v1.3.1 // indirect
74102
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
103+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
75104
github.com/pkg/errors v0.9.1 // indirect
76105
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
77-
github.com/posener/complete v1.2.3 // indirect
78106
github.com/prometheus/client_golang v1.19.1 // indirect
79107
github.com/prometheus/client_model v0.6.1 // indirect
80-
github.com/prometheus/common v0.55.0 // indirect
108+
github.com/prometheus/common v0.54.1-0.20240615204547-04635d2962f9 // indirect
81109
github.com/prometheus/common/sigv4 v0.1.0 // indirect
82110
github.com/prometheus/procfs v0.15.1 // indirect
83111
github.com/prometheus/prometheus v1.99.0 // indirect
84-
github.com/russross/blackfriday v1.6.0 // indirect
85-
github.com/shopspring/decimal v1.3.1 // indirect
86-
github.com/sirupsen/logrus v1.9.3 // indirect
87-
github.com/spf13/cast v1.5.0 // indirect
88-
github.com/stretchr/testify v1.9.0 // indirect
89-
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
90-
github.com/zclconf/go-cty v1.15.0 // indirect
91-
go.opentelemetry.io/otel v1.28.0 // indirect
92-
go.opentelemetry.io/otel/trace v1.28.0 // indirect
93-
go.uber.org/atomic v1.11.0 // indirect
94-
go.uber.org/goleak v1.3.0 // indirect
95-
golang.org/x/crypto v0.36.0 // indirect
96-
golang.org/x/net v0.38.0 // indirect
97-
golang.org/x/oauth2 v0.27.0 // indirect
98-
golang.org/x/sync v0.12.0 // indirect
99-
golang.org/x/sys v0.31.0 // indirect
100-
golang.org/x/text v0.23.0 // indirect
101-
google.golang.org/appengine v1.6.8 // indirect
102-
google.golang.org/grpc v1.65.0 // indirect
103-
google.golang.org/protobuf v1.34.2 // indirect
104-
gopkg.in/yaml.v2 v2.4.0 // indirect
105-
gopkg.in/yaml.v3 v3.0.1
106-
)
107-
108-
require github.com/grafana/dskit v0.0.0-20240719153732-6e8a03e781de
109-
110-
require (
111-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 // indirect
112-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
113-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
114-
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
115-
github.com/DmitriyVTitov/size v1.5.0 // indirect
116-
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
117-
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
118-
github.com/armon/go-metrics v0.4.1 // indirect
119-
github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 // indirect
120-
github.com/cloudflare/circl v1.6.1 // indirect
121-
github.com/coreos/go-semver v0.3.1 // indirect
122-
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
123-
github.com/dgraph-io/ristretto v0.1.1 // indirect
124-
github.com/dustin/go-humanize v1.0.1 // indirect
125-
github.com/efficientgo/core v1.0.0-rc.2 // indirect
126-
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect
127-
github.com/gogo/googleapis v1.4.1 // indirect
128-
github.com/gogo/protobuf v1.3.2 // indirect
129-
github.com/gogo/status v1.1.1 // indirect
130-
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
131-
github.com/golang/glog v1.2.4 // indirect
132-
github.com/google/btree v1.1.2 // indirect
133-
github.com/hashicorp/consul/api v1.29.2 // indirect
134-
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
135-
github.com/hashicorp/go-msgpack v1.1.5 // indirect
136-
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
137-
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
138-
github.com/hashicorp/golang-lru v1.0.2 // indirect
139-
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
140-
github.com/hashicorp/memberlist v0.5.1 // indirect
141-
github.com/hashicorp/serf v0.10.1 // indirect
142-
github.com/klauspost/compress v1.17.9 // indirect
143-
github.com/kylelemons/godebug v1.1.0 // indirect
144-
github.com/miekg/dns v1.1.61 // indirect
145-
github.com/mitchellh/go-homedir v1.1.0 // indirect
146-
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
147-
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
148112
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
113+
github.com/sirupsen/logrus v1.9.3 // indirect
114+
github.com/stretchr/testify v1.10.0 // indirect
149115
github.com/thanos-io/objstore v0.0.0-20240622095743-1afe5d4bc3cd // indirect
150116
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
151117
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
118+
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
152119
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
153120
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
154121
github.com/xlab/treeprint v1.2.0 // indirect
155-
go.etcd.io/etcd/api/v3 v3.5.15 // indirect
156-
go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect
157-
go.etcd.io/etcd/client/v3 v3.5.15 // indirect
158-
go.opentelemetry.io/otel/metric v1.28.0 // indirect
122+
github.com/zclconf/go-cty v1.16.3 // indirect
123+
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
124+
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
125+
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
126+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
127+
go.opentelemetry.io/otel v1.34.0 // indirect
128+
go.opentelemetry.io/otel/metric v1.34.0 // indirect
129+
go.opentelemetry.io/otel/trace v1.34.0 // indirect
130+
go.uber.org/atomic v1.11.0 // indirect
131+
go.uber.org/goleak v1.3.0 // indirect
159132
go.uber.org/multierr v1.11.0 // indirect
160-
go.uber.org/zap v1.27.0 // indirect
161-
golang.org/x/mod v0.19.0 // indirect
133+
go.uber.org/zap v1.21.0 // indirect
134+
golang.org/x/crypto v0.39.0 // indirect
135+
golang.org/x/mod v0.25.0 // indirect
136+
golang.org/x/net v0.40.0 // indirect
137+
golang.org/x/oauth2 v0.26.0 // indirect
138+
golang.org/x/sync v0.15.0 // indirect
139+
golang.org/x/sys v0.33.0 // indirect
140+
golang.org/x/text v0.26.0 // indirect
162141
golang.org/x/time v0.5.0 // indirect
163-
golang.org/x/tools v0.23.0 // indirect
164-
google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect
165-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect
166-
k8s.io/apimachinery v0.30.3 // indirect
167-
k8s.io/client-go v0.30.3 // indirect
168-
k8s.io/klog/v2 v2.130.1 // indirect
169-
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
142+
golang.org/x/tools v0.33.0 // indirect
143+
google.golang.org/appengine v1.6.8 // indirect
144+
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
145+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
146+
google.golang.org/grpc v1.72.1 // indirect
147+
google.golang.org/protobuf v1.36.6 // indirect
148+
gopkg.in/yaml.v2 v2.4.0 // indirect
149+
k8s.io/apimachinery v0.29.3 // indirect
150+
k8s.io/client-go v0.29.3 // indirect
151+
k8s.io/klog/v2 v2.120.1 // indirect
152+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
170153
)
171154

172-
// Using a fork of Prometheus with Mimir-specific changes.
173-
replace github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20240711155029-3af4160b0afb
155+
require (
156+
github.com/grafana/dskit v0.0.0-20240719153732-6e8a03e781de
157+
gopkg.in/yaml.v3 v3.0.1
158+
)
174159

175160
// Replace memberlist with our fork which includes some fixes that haven't been
176161
// merged upstream yet:
@@ -189,3 +174,6 @@ replace github.com/grafana/regexp => github.com/grafana/regexp v0.0.0-2024053107
189174

190175
// Replace goautoneg with a fork until https://github.com/munnerz/goautoneg/pull/6 is merged
191176
replace github.com/munnerz/goautoneg => github.com/grafana/goautoneg v0.0.0-20240607115440-f335c04c58ce
177+
178+
// Using a fork of Prometheus with Mimir-specific changes.
179+
replace github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20240711155029-3af4160b0afb

0 commit comments

Comments
 (0)