Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Add support for `data_view_id` in the `elasticstack_kibana_slo` resource ([#1305](https://github.com/elastic/terraform-provider-elasticstack/pull/1305))
- Add support for `unenrollment_timeout` in `elasticstack_fleet_agent_policy` ([#1169](https://github.com/elastic/terraform-provider-elasticstack/issues/1169))
- Handle default value for `allow_restricted_indices` in `elasticstack_elasticsearch_security_api_key` ([#1315](https://github.com/elastic/terraform-provider-elasticstack/pull/1315))
- Fixed `nil` reference in kibana synthetics API client in case of response errors ([#1320](https://github.com/elastic/terraform-provider-elasticstack/pull/1320))

## [0.11.17] - 2025-07-21

Expand Down
6 changes: 3 additions & 3 deletions libs/go-kibana-rest/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:9.1.3@sha256:d620e80b7222e32eff42ac0fc614a0a5753f6ce9859df33b9ddea49c3bf5fb01
image: docker.elastic.co/elasticsearch/elasticsearch:9.1.2@sha256:d1a8016cf55be8ffec635ed69f5a9acb0c459db35b46a4549ec5b2847a2f170a
environment:
cluster.name: test
discovery.type: single-node
Expand All @@ -11,7 +11,7 @@ services:
ports:
- "9200:9200/tcp"
set-kibana-password:
image: docker.elastic.co/kibana/kibana:9.1.3@sha256:26792c8e4a68ba0bff3efcc46755f60bf36bb16b2431014c210f2546ca1819ad
image: docker.elastic.co/kibana/kibana:9.0.3@sha256:c4c00a485fbc3619d8373f3bc74e9dd5b5a34380ef50442be4366e8fb57cd50a
restart: on-failure
links:
- elasticsearch
Expand All @@ -22,7 +22,7 @@ services:
elasticsearch:
condition: service_started
kibana:
image: docker.elastic.co/kibana/kibana:9.1.3@sha256:26792c8e4a68ba0bff3efcc46755f60bf36bb16b2431014c210f2546ca1819ad
image: docker.elastic.co/kibana/kibana:9.0.3@sha256:c4c00a485fbc3619d8373f3bc74e9dd5b5a34380ef50442be4366e8fb57cd50a
environment:
SERVER_NAME: kibana
ELASTICSEARCH_HOSTS: http://es:9200
Expand Down
8 changes: 4 additions & 4 deletions libs/go-kibana-rest/kbapi/api.kibana_logstash_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func newKibanaLogstashPipelineGetFunc(c *resty.Client) KibanaLogstashPipelineGet
if resp.StatusCode() == 404 {
return nil, nil
}
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
logstashPipeline := &LogstashPipeline{}
err = json.Unmarshal(resp.Body(), logstashPipeline)
Expand All @@ -97,7 +97,7 @@ func newKibanaLogstashPipelineListFunc(c *resty.Client) KibanaLogstashPipelineLi
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
logstashPipelinesList := &LogstashPipelinesList{}
err = json.Unmarshal(resp.Body(), logstashPipelinesList)
Expand Down Expand Up @@ -140,7 +140,7 @@ func newKibanaLogstashPipelineCreateOrUpdateFunc(c *resty.Client) KibanaLogstash

log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}

// Retrive the object to return it
Expand Down Expand Up @@ -174,7 +174,7 @@ func newKibanaLogstashPipelineDeleteFunc(c *resty.Client) KibanaLogstashPipeline
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return NewAPIError(resp.StatusCode(), resp.Status())
return NewAPIError(resp.StatusCode(), "%s", resp.Status())
}

return nil
Expand Down
8 changes: 4 additions & 4 deletions libs/go-kibana-rest/kbapi/api.kibana_role_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func newKibanaRoleManagementGetFunc(c *resty.Client) KibanaRoleManagementGet {
if resp.StatusCode() == 404 {
return nil, nil
}
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
kibanaRole := &KibanaRole{}
err = json.Unmarshal(resp.Body(), kibanaRole)
Expand All @@ -124,7 +124,7 @@ func newKibanaRoleManagementListFunc(c *resty.Client) KibanaRoleManagementList {
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
kibanaRoles := make(KibanaRoles, 0, 1)
err = json.Unmarshal(resp.Body(), &kibanaRoles)
Expand Down Expand Up @@ -165,7 +165,7 @@ func newKibanaRoleManagementCreateOrUpdateFunc(c *resty.Client) KibanaRoleManage
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}

// Retrive the object to return it
Expand Down Expand Up @@ -197,7 +197,7 @@ func newKibanaRoleManagementDeleteFunc(c *resty.Client) KibanaRoleManagementDele
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return NewAPIError(resp.StatusCode(), resp.Status())
return NewAPIError(resp.StatusCode(), "%s", resp.Status())
}

return nil
Expand Down
14 changes: 7 additions & 7 deletions libs/go-kibana-rest/kbapi/api.kibana_save_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func newKibanaSavedObjectGetFunc(c *resty.Client) KibanaSavedObjectGet {
if resp.StatusCode() == 404 {
return nil, nil
}
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())

}
var data map[string]interface{}
Expand Down Expand Up @@ -165,7 +165,7 @@ func newKibanaSavedObjectFindFunc(c *resty.Client) KibanaSavedObjectFind {
if resp.StatusCode() == 404 {
return nil, nil
}
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())

}
var data map[string]interface{}
Expand Down Expand Up @@ -214,7 +214,7 @@ func newKibanaSavedObjectCreateFunc(c *resty.Client) KibanaSavedObjectCreate {
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
var dataResponse map[string]interface{}
err = json.Unmarshal(resp.Body(), &dataResponse)
Expand Down Expand Up @@ -263,7 +263,7 @@ func newKibanaSavedObjectUpdateFunc(c *resty.Client) KibanaSavedObjectUpdate {
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
var dataResponse map[string]interface{}
err = json.Unmarshal(resp.Body(), &dataResponse)
Expand Down Expand Up @@ -304,7 +304,7 @@ func newKibanaSavedObjectDeleteFunc(c *resty.Client) KibanaSavedObjectDelete {
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return NewAPIError(resp.StatusCode(), resp.Status())
return NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
var dataResponse map[string]interface{}
err = json.Unmarshal(resp.Body(), &dataResponse)
Expand Down Expand Up @@ -356,7 +356,7 @@ func newKibanaSavedObjectExportFunc(c *resty.Client) KibanaSavedObjectExport {
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}

data := resp.Body()
Expand Down Expand Up @@ -396,7 +396,7 @@ func newKibanaSavedObjectImportFunc(c *resty.Client) KibanaSavedObjectImport {
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
var dataResponse map[string]interface{}
err = json.Unmarshal(resp.Body(), &dataResponse)
Expand Down
2 changes: 1 addition & 1 deletion libs/go-kibana-rest/kbapi/api.kibana_shorten_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func newKibanaShortenURLCreateFunc(c *resty.Client) KibanaShortenURLCreate {

log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}

shortenURLResponse := &ShortenURLResponse{}
Expand Down
14 changes: 7 additions & 7 deletions libs/go-kibana-rest/kbapi/api.kibana_spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func newKibanaSpaceGetFunc(c *resty.Client) KibanaSpaceGet {
if resp.StatusCode() == 404 {
return nil, nil
}
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())

}
kibanaSpace := &KibanaSpace{}
Expand All @@ -113,7 +113,7 @@ func newKibanaSpaceListFunc(c *resty.Client) KibanaSpaceList {
}
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
kibanaSpaces := make(KibanaSpaces, 0, 1)
err = json.Unmarshal(resp.Body(), &kibanaSpaces)
Expand Down Expand Up @@ -148,7 +148,7 @@ func newKibanaSpaceCreateFunc(c *resty.Client) KibanaSpaceCreate {

log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
kibanaSpace = &KibanaSpace{}
err = json.Unmarshal(resp.Body(), kibanaSpace)
Expand Down Expand Up @@ -189,7 +189,7 @@ func newKibanaSpaceCopySavedObjectsFunc(c *resty.Client) KibanaSpaceCopySavedObj

log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return NewAPIError(resp.StatusCode(), resp.Status())
return NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
data := make(map[string]interface{})
err = json.Unmarshal(resp.Body(), &data)
Expand All @@ -205,7 +205,7 @@ func newKibanaSpaceCopySavedObjectsFunc(c *resty.Client) KibanaSpaceCopySavedObj
}
}
if len(errors) > 0 {
return NewAPIError(500, strings.Join(errors, "\n"))
return NewAPIError(500, "%s", strings.Join(errors, "\n"))
}

return nil
Expand All @@ -231,7 +231,7 @@ func newKibanaSpaceDeleteFunc(c *resty.Client) KibanaSpaceDelete {
log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {

return NewAPIError(resp.StatusCode(), resp.Status())
return NewAPIError(resp.StatusCode(), "%s", resp.Status())

}

Expand Down Expand Up @@ -261,7 +261,7 @@ func newKibanaSpaceUpdateFunc(c *resty.Client) KibanaSpaceUpdate {

log.Debug("Response: ", resp)
if resp.StatusCode() >= 300 {
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
kibanaSpace = &KibanaSpace{}
err = json.Unmarshal(resp.Body(), kibanaSpace)
Expand Down
2 changes: 1 addition & 1 deletion libs/go-kibana-rest/kbapi/api.kibana_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func newKibanaStatusGetFunc(c *resty.Client) KibanaStatusGet {
if resp.StatusCode() == 404 {
return nil, nil
}
return nil, NewAPIError(resp.StatusCode(), resp.Status())
return nil, NewAPIError(resp.StatusCode(), "%s", resp.Status())
}
kibanaStatus := make(KibanaStatus)
err = json.Unmarshal(resp.Body(), &kibanaStatus)
Expand Down
10 changes: 8 additions & 2 deletions libs/go-kibana-rest/kbapi/api.kibana_synthetics.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ func newKibanaSyntheticsMonitorDeleteFunc(c *resty.Client) KibanaSyntheticsMonit
}

result, err := unmarshal(resp, []MonitorDeleteStatus{})
if err != nil {
return nil, err
}
return *result, err
}
}
Expand Down Expand Up @@ -481,6 +484,9 @@ func newKibanaSyntheticsParameterDeleteFunc(c *resty.Client) KibanaSyntheticsPar
}

result, err := unmarshal(resp, []ParameterDeleteStatus{})
if err != nil {
return nil, err
}
return *result, err
}
}
Expand All @@ -503,9 +509,9 @@ func handleKibanaError(err error, resp *resty.Response) error {
kibanaErr := KibanaError{}
err := json.Unmarshal(resp.Body(), &kibanaErr)
if err != nil {
return NewAPIError(resp.StatusCode(), resp.Status(), err)
return NewAPIError(resp.StatusCode(), "status: %s, err: %s", resp.Status(), err)
}
return NewAPIError(resp.StatusCode(), kibanaErr.Message, kibanaErr.Error)
return NewAPIError(resp.StatusCode(), "message: %s, err: %s", kibanaErr.Message, kibanaErr.Error)
}
return nil
}
Expand Down
1 change: 1 addition & 0 deletions libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsPrivateLocationAPI() {
created, err := pAPI.Create(ctx, cfg)

assert.NoError(s.T(), err)
assert.NotNil(s.T(), created)
assert.Equal(s.T(), created.Label, cfg.Label)
assert.Equal(s.T(), created.AgentPolicyId, cfg.AgentPolicyId)

Expand Down