Skip to content

Commit 2d21399

Browse files
authored
Merge branch 'elastic:main' into main
2 parents e854fa1 + 07aa264 commit 2d21399

File tree

21 files changed

+105
-569
lines changed

21 files changed

+105
-569
lines changed

.buildkite/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
steps:
22
- label: Release
33
agents:
4-
image: "golang:1.24.2@sha256:991aa6a6e4431f2f01e869a812934bd60fbc87fb939e4a1ea54b8494ab9d2fc6"
4+
image: "golang:1.24.2@sha256:18a1f2d1e1d3c49f27c904e9182375169615c65852ace724987929b910195b2c"
55
cpu: "16"
66
memory: "24G"
77
ephemeralStorage: "20G"

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
timeout-minutes: 5
2020
steps:
2121
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
22-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
22+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
2323
with:
2424
go-version-file: 'go.mod'
2525
cache: true
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
steps:
3737
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
38-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
38+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
3939
with:
4040
go-version-file: 'tools/go.mod'
4141
cache: true
@@ -129,7 +129,7 @@ jobs:
129129
- '9.0.0-SNAPSHOT'
130130
steps:
131131
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
132-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
132+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
133133
with:
134134
go-version-file: 'go.mod'
135135
cache: true

.golangci.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
# increase the default timeout for slow CI needs
2-
run:
3-
timeout: 300s
4-
concurrency: 0
1+
version: "2"
2+
linters:
3+
exclusions:
4+
generated: lax
5+
presets:
6+
- comments
7+
- common-false-positives
8+
- legacy
9+
- std-error-handling
10+
paths:
11+
- third_party$
12+
- builtin$
13+
- examples$
14+
formatters:
15+
exclusions:
16+
generated: lax
17+
paths:
18+
- third_party$
19+
- builtin$
20+
- examples$

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,18 @@ install: build ## Install built provider into the local terraform cache
245245

246246

247247
.PHONY: tools
248-
tools: $(GOBIN) ## Install useful tools for linting, docs generation and development
248+
tools: $(GOBIN) tools-golangci-lint ## Install useful tools for linting, docs generation and development
249249
@ cd tools && go install github.com/client9/misspell/cmd/misspell
250250
@ cd tools && go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
251-
@ cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
252251
@ cd tools && go install github.com/goreleaser/goreleaser/v2
253252
@ cd tools && go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen
254253
@ cd tools && go install go.uber.org/mock/mockgen
255254

255+
.PHONY: tools-golangci-lint
256+
tools-golangci-lint: ## Download golangci-lint locally if necessary.
257+
@[[ -f $(GOBIN)/golangci-lint ]] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v2.0.2
258+
259+
256260
.PHONY: misspell
257261
misspell:
258262
@ $(GOBIN)/misspell -error -source go ./internal/

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ module github.com/elastic/terraform-provider-elasticstack
22

33
go 1.23.0
44

5-
toolchain go1.24.1
5+
toolchain go1.24.2
66

77
require (
88
github.com/disaster37/go-kibana-rest/v8 v8.5.0
99
github.com/elastic/elastic-transport-go/v8 v8.6.1
1010
github.com/elastic/go-elasticsearch/v8 v8.17.1
1111
github.com/google/gofuzz v1.2.0
1212
github.com/google/uuid v1.6.0
13-
github.com/hashicorp/go-cty v1.4.1
13+
github.com/hashicorp/go-cty v1.5.0
1414
github.com/hashicorp/go-version v1.7.0
1515
github.com/hashicorp/terraform-plugin-framework v1.14.1
1616
github.com/hashicorp/terraform-plugin-framework-jsontypes v0.2.0
@@ -23,7 +23,7 @@ require (
2323
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
2424
github.com/oapi-codegen/runtime v1.1.1
2525
github.com/stretchr/testify v1.10.0
26-
go.uber.org/mock v0.5.0
26+
go.uber.org/mock v0.5.1
2727
)
2828

2929
require (

go.sum

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuD
7070
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
7171
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
7272
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
73-
github.com/hashicorp/go-cty v1.4.1 h1:T4i4kbEKuyMoe4Ujh52Ud07VXr05dnP/Si9JiVDpx3Y=
74-
github.com/hashicorp/go-cty v1.4.1/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
73+
github.com/hashicorp/go-cty v1.5.0 h1:EkQ/v+dDNUqnuVpmS5fPqyY71NXVgT5gf32+57xY8g0=
74+
github.com/hashicorp/go-cty v1.5.0/go.mod h1:lFUCG5kd8exDobgSfyj4ONE/dc822kiYMguVKdHGMLM=
7575
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
7676
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
7777
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
@@ -203,8 +203,8 @@ go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4Jjx
203203
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
204204
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
205205
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
206-
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
207-
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
206+
go.uber.org/mock v0.5.1 h1:ASgazW/qBmR+A32MYFDB6E2POoTgOwT509VP0CT/fjs=
207+
go.uber.org/mock v0.5.1/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
208208
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
209209
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
210210
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
@@ -243,7 +243,6 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
243243
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
244244
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
245245
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
246-
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
247246
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
248247
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
249248
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=

internal/clients/api_client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ func buildEsClient(cfg config.Client) (*elasticsearch.Client, error) {
440440

441441
es, err := elasticsearch.NewClient(*cfg.Elasticsearch)
442442
if err != nil {
443-
return nil, fmt.Errorf("Unable to create Elasticsearch client: %w", err)
443+
return nil, fmt.Errorf("unable to create Elasticsearch client: %w", err)
444444
}
445445

446446
return es, nil
@@ -475,7 +475,7 @@ func buildKibanaClient(cfg config.Client) (*kibana.Client, error) {
475475
func buildKibanaOapiClient(cfg config.Client) (*kibana_oapi.Client, error) {
476476
client, err := kibana_oapi.NewClient(*cfg.KibanaOapi)
477477
if err != nil {
478-
return nil, fmt.Errorf("Unable to create KibanaOapi client: %w", err)
478+
return nil, fmt.Errorf("unable to create KibanaOapi client: %w", err)
479479
}
480480

481481
return client, nil
@@ -539,7 +539,7 @@ func buildSloClient(cfg config.Client, httpClient *http.Client) *slo.APIClient {
539539
func buildFleetClient(cfg config.Client) (*fleet.Client, error) {
540540
client, err := fleet.NewClient(*cfg.Fleet)
541541
if err != nil {
542-
return nil, fmt.Errorf("Unable to create Fleet client: %w", err)
542+
return nil, fmt.Errorf("unable to create Fleet client: %w", err)
543543
}
544544

545545
return client, nil

internal/clients/elasticsearch/enrich.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func getPolicyType(m map[string]enrichPolicyResponse) (string, error) {
3636
return policyType, nil
3737
}
3838
}
39-
return "", fmt.Errorf("Did not find expected policy type.")
39+
return "", fmt.Errorf("did not find expected policy type")
4040
}
4141

4242
func GetEnrichPolicy(ctx context.Context, apiClient *clients.ApiClient, policyName string) (*models.EnrichPolicy, diag.Diagnostics) {

internal/elasticsearch/cluster/snapshot_repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,13 @@ func flattenRepoSettings(r *models.SnapshotRepository, s map[string]*schema.Sche
431431
case schema.TypeInt, schema.TypeFloat:
432432
i, err := strconv.Atoi(v.(string))
433433
if err != nil {
434-
return nil, fmt.Errorf(`Failed to parse value = "%v" for setting = "%s"`, v, k)
434+
return nil, fmt.Errorf(`failed to parse value = "%v" for setting = "%s"`, v, k)
435435
}
436436
settings[k] = i
437437
case schema.TypeBool:
438438
b, err := strconv.ParseBool(v.(string))
439439
if err != nil {
440-
return nil, fmt.Errorf(`Failed to parse value = "%v" for setting = "%s"`, v, k)
440+
return nil, fmt.Errorf(`failed to parse value = "%v" for setting = "%s"`, v, k)
441441
}
442442
settings[k] = b
443443
default:

internal/elasticsearch/index/index/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ func (model tfModel) getFieldValueByTagValue(tagName string, t reflect.Type) (at
444444
}
445445

446446
func convertSettingsKeyToTFFieldKey(settingKey string) string {
447-
return strings.Replace(settingKey, ".", "_", -1)
447+
return strings.ReplaceAll(settingKey, ".", "_")
448448
}
449449

450450
func (model aliasTfModel) toAPIModel() (models.IndexAlias, diag.Diagnostics) {

0 commit comments

Comments
 (0)