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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Add 'elasticstack_fleet_package' data source ([#469](https://github.com/elastic/terraform-provider-elasticstack/pull/469))
- Add `tags` option to Kibana's SLOs ([#495](https://github.com/elastic/terraform-provider-elasticstack/pull/495))
- Add support for Authorization header - Bearer Token and ES-Client-Authentication fields added.([#500](https://github.com/elastic/terraform-provider-elasticstack/pull/500))
- Add support for managing Kibana Data Views ([#502](https://github.com/elastic/terraform-provider-elasticstack/pull/502))

### Fixed
- Rename fleet package objects to `elasticstack_fleet_integration` and `elasticstack_fleet_integration_policy` ([#476](https://github.com/elastic/terraform-provider-elasticstack/pull/476))
- Fix a provider crash when managing SLOs outside of the default Kibana space. ([#485](https://github.com/elastic/terraform-provider-elasticstack/pull/485))
Expand Down
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ help: ## this help

.PHONY: generate-alerting-client
generate-alerting-client: ## generate Kibana alerting client
@ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
@ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.0.1 generate \
-i https://raw.githubusercontent.com/elastic/kibana/$(SWAGGER_VERSION)/x-pack/plugins/alerting/docs/openapi/bundled.json \
--skip-validate-spec \
--git-repo-id terraform-provider-elasticstack \
Expand All @@ -279,17 +279,30 @@ generate-alerting-client: ## generate Kibana alerting client
@ rm -rf generated/alerting/go.mod generated/alerting/go.sum generated/alerting/test
@ go fmt ./generated/alerting/...

.PHONY: generate-data-views-client
generate-data-views-client: ## generate Kibana data-views client
@ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.0.1 generate \
-i /local/generated/data_views/bundled.yaml \
--skip-validate-spec \
--git-repo-id terraform-provider-elasticstack \
--git-user-id elastic \
-p isGoSubmodule=true \
-p packageName=data_views \
-p generateInterfaces=true \
-g go \
-o /local/generated/data_views
@ rm -rf generated/data_views/go.mod generated/data_views/go.sum generated/data_views/test
@ go fmt ./generated/data_views/...

.PHONY: generate-connectors-client
generate-connectors-client: tools ## generate Kibana connectors client
@ cd tools && go generate
@ go fmt ./generated/connectors/...

## -i https://raw.githubusercontent.com/elastic/kibana/main/x-pack/plugins/observability/docs/openapi/slo/bundled.yaml \

.PHONY: generate-slo-client
generate-slo-client: tools ## generate Kibana slo client
@ rm -rf generated/slo
@ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.0.0-beta generate \
@ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.0.1 generate \
-i /local/generated/slo-spec.yml \
--git-repo-id terraform-provider-elasticstack \
--git-user-id elastic \
Expand All @@ -304,4 +317,4 @@ generate-slo-client: tools ## generate Kibana slo client
@ go fmt ./generated/...

.PHONY: generate-clients
generate-clients: generate-alerting-client generate-slo-client generate-connectors-client ## generate all clients
generate-clients: generate-alerting-client generate-slo-client generate-data-views-client generate-connectors-client ## generate all clients
82 changes: 82 additions & 0 deletions docs/resources/kibana_data_view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "elasticstack_kibana_data_view Resource - terraform-provider-elasticstack"
subcategory: ""
description: |-
Manages Kibana data views
---

# elasticstack_kibana_data_view (Resource)

Manages Kibana data views



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `data_view` (Attributes) (see [below for nested schema](#nestedatt--data_view))

### Optional

- `override` (Boolean) Overrides an existing data view if a data view with the provided title already exists.
- `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used.

### Read-Only

- `id` (String) Generated ID for the data view.

<a id="nestedatt--data_view"></a>
### Nested Schema for `data_view`

Optional:

- `allow_no_index` (Boolean) Allows the Data view saved object to exist before the data is available.
- `field_attrs` (Attributes Map) Map of field attributes by field name. (see [below for nested schema](#nestedatt--data_view--field_attrs))
- `field_formats` (Attributes Map) Map of field formats by field name. (see [below for nested schema](#nestedatt--data_view--field_formats))
- `id` (String) Saved object ID.
- `name` (String) The Data view name.
- `namespaces` (List of String) Array of space IDs for sharing the Data view between multiple spaces.
- `runtime_field_map` (Attributes Map) Map of runtime field definitions by field name. (see [below for nested schema](#nestedatt--data_view--runtime_field_map))
- `source_filters` (List of String) List of field names you want to filter out in Discover.
- `time_field_name` (String) Timestamp field name, which you use for time-based Data views.
- `title` (String) Comma-separated list of data streams, indices, and aliases that you want to search. Supports wildcards (*).

<a id="nestedatt--data_view--field_attrs"></a>
### Nested Schema for `data_view.field_attrs`

Optional:

- `count` (Number) Popularity count for the field.
- `custom_label` (String) Custom label for the field.


<a id="nestedatt--data_view--field_formats"></a>
### Nested Schema for `data_view.field_formats`

Required:

- `id` (String)

Optional:

- `params` (Attributes) (see [below for nested schema](#nestedatt--data_view--field_formats--params))

<a id="nestedatt--data_view--field_formats--params"></a>
### Nested Schema for `data_view.field_formats.params`

Optional:

- `pattern` (String)



<a id="nestedatt--data_view--runtime_field_map"></a>
### Nested Schema for `data_view.runtime_field_map`

Required:

- `script_source` (String) Script of the runtime field.
- `type` (String) Mapping type of the runtime field. For more information, check [Field data types](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/mapping-types.html).
2 changes: 1 addition & 1 deletion generated/alerting/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ docs/ActionsInnerFrequency.md
docs/AlertResponseProperties.md
docs/AlertResponsePropertiesExecutionStatus.md
docs/AlertResponsePropertiesSchedule.md
docs/AlertingApi.md
docs/AlertingAPI.md
docs/CreateRuleRequest.md
docs/FindRules200Response.md
docs/FindRulesHasReferenceParameter.md
Expand Down
2 changes: 1 addition & 1 deletion generated/alerting/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0-SNAPSHOT
7.1.0-SNAPSHOT
76 changes: 44 additions & 32 deletions generated/alerting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ Default configuration comes with `Servers` field that contains server objects as

### Select Server Configuration

For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
For using other server than the one defined on index 0 set context value `alerting.ContextServerIndex` of type `int`.

```golang
ctx := context.WithValue(context.Background(), alerting.ContextServerIndex, 1)
```

### Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
Templated server URL is formatted using default variables from configuration or from context value `alerting.ContextServerVariables` of type `map[string]string`.

```golang
ctx := context.WithValue(context.Background(), alerting.ContextServerVariables, map[string]string{
Expand All @@ -58,7 +58,7 @@ Note, enum values are always validated and all unused variables are silently ign

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
Similar rules for overriding default operation server index and variables applies by using `alerting.ContextOperationServerIndices` and `alerting.ContextOperationServerVariables` context maps.

```golang
ctx := context.WithValue(context.Background(), alerting.ContextOperationServerIndices, map[string]int{
Expand All @@ -77,32 +77,32 @@ All URIs are relative to *http://localhost:5601*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AlertingApi* | [**CreateRule**](docs/AlertingApi.md#createrule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId} | Creates a rule.
*AlertingApi* | [**DeleteRule**](docs/AlertingApi.md#deleterule) | **Delete** /s/{spaceId}/api/alerting/rule/{ruleId} | Deletes a rule.
*AlertingApi* | [**DisableRule**](docs/AlertingApi.md#disablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_disable | Disables a rule.
*AlertingApi* | [**EnableRule**](docs/AlertingApi.md#enablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_enable | Enables a rule.
*AlertingApi* | [**FindRules**](docs/AlertingApi.md#findrules) | **Get** /s/{spaceId}/api/alerting/rules/_find | Retrieves information about rules.
*AlertingApi* | [**GetAlertingHealth**](docs/AlertingApi.md#getalertinghealth) | **Get** /s/{spaceId}/api/alerting/_health | Retrieves the health status of the alerting framework.
*AlertingApi* | [**GetRule**](docs/AlertingApi.md#getrule) | **Get** /s/{spaceId}/api/alerting/rule/{ruleId} | Retrieves a rule by its identifier.
*AlertingApi* | [**GetRuleTypes**](docs/AlertingApi.md#getruletypes) | **Get** /s/{spaceId}/api/alerting/rule_types | Retrieves a list of rule types.
*AlertingApi* | [**LegacyCreateAlert**](docs/AlertingApi.md#legacycreatealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId} | Create an alert.
*AlertingApi* | [**LegacyDisableAlert**](docs/AlertingApi.md#legacydisablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_disable | Disables an alert.
*AlertingApi* | [**LegacyEnableAlert**](docs/AlertingApi.md#legacyenablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_enable | Enables an alert.
*AlertingApi* | [**LegacyFindAlerts**](docs/AlertingApi.md#legacyfindalerts) | **Get** /s/{spaceId}/api/alerts/alerts/_find | Retrieves a paginated set of alerts.
*AlertingApi* | [**LegacyGetAlert**](docs/AlertingApi.md#legacygetalert) | **Get** /s/{spaceId}/api/alerts/alert/{alertId} | Retrieves an alert by its identifier.
*AlertingApi* | [**LegacyGetAlertTypes**](docs/AlertingApi.md#legacygetalerttypes) | **Get** /s/{spaceId}/api/alerts/alerts/list_alert_types | Retrieves a list of alert types.
*AlertingApi* | [**LegacyGetAlertingHealth**](docs/AlertingApi.md#legacygetalertinghealth) | **Get** /s/{spaceId}/api/alerts/alerts/_health | Retrieves the health status of the alerting framework.
*AlertingApi* | [**LegacyMuteAlertInstance**](docs/AlertingApi.md#legacymutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute | Mutes an alert instance.
*AlertingApi* | [**LegacyMuteAllAlertInstances**](docs/AlertingApi.md#legacymuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_mute_all | Mutes all alert instances.
*AlertingApi* | [**LegacyUnmuteAlertInstance**](docs/AlertingApi.md#legacyunmutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute | Unmutes an alert instance.
*AlertingApi* | [**LegacyUnmuteAllAlertInstances**](docs/AlertingApi.md#legacyunmuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_unmute_all | Unmutes all alert instances.
*AlertingApi* | [**LegacyUpdateAlert**](docs/AlertingApi.md#legacyupdatealert) | **Put** /s/{spaceId}/api/alerts/alert/{alertId} | Updates the attributes for an alert.
*AlertingApi* | [**LegaryDeleteAlert**](docs/AlertingApi.md#legarydeletealert) | **Delete** /s/{spaceId}/api/alerts/alert/{alertId} | Permanently removes an alert.
*AlertingApi* | [**MuteAlert**](docs/AlertingApi.md#mutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute | Mutes an alert.
*AlertingApi* | [**MuteAllAlerts**](docs/AlertingApi.md#muteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all | Mutes all alerts.
*AlertingApi* | [**UnmuteAlert**](docs/AlertingApi.md#unmutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute | Unmutes an alert.
*AlertingApi* | [**UnmuteAllAlerts**](docs/AlertingApi.md#unmuteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all | Unmutes all alerts.
*AlertingApi* | [**UpdateRule**](docs/AlertingApi.md#updaterule) | **Put** /s/{spaceId}/api/alerting/rule/{ruleId} | Updates the attributes for a rule.
*AlertingAPI* | [**CreateRule**](docs/AlertingAPI.md#createrule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId} | Creates a rule.
*AlertingAPI* | [**DeleteRule**](docs/AlertingAPI.md#deleterule) | **Delete** /s/{spaceId}/api/alerting/rule/{ruleId} | Deletes a rule.
*AlertingAPI* | [**DisableRule**](docs/AlertingAPI.md#disablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_disable | Disables a rule.
*AlertingAPI* | [**EnableRule**](docs/AlertingAPI.md#enablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_enable | Enables a rule.
*AlertingAPI* | [**FindRules**](docs/AlertingAPI.md#findrules) | **Get** /s/{spaceId}/api/alerting/rules/_find | Retrieves information about rules.
*AlertingAPI* | [**GetAlertingHealth**](docs/AlertingAPI.md#getalertinghealth) | **Get** /s/{spaceId}/api/alerting/_health | Retrieves the health status of the alerting framework.
*AlertingAPI* | [**GetRule**](docs/AlertingAPI.md#getrule) | **Get** /s/{spaceId}/api/alerting/rule/{ruleId} | Retrieves a rule by its identifier.
*AlertingAPI* | [**GetRuleTypes**](docs/AlertingAPI.md#getruletypes) | **Get** /s/{spaceId}/api/alerting/rule_types | Retrieves a list of rule types.
*AlertingAPI* | [**LegacyCreateAlert**](docs/AlertingAPI.md#legacycreatealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId} | Create an alert.
*AlertingAPI* | [**LegacyDisableAlert**](docs/AlertingAPI.md#legacydisablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_disable | Disables an alert.
*AlertingAPI* | [**LegacyEnableAlert**](docs/AlertingAPI.md#legacyenablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_enable | Enables an alert.
*AlertingAPI* | [**LegacyFindAlerts**](docs/AlertingAPI.md#legacyfindalerts) | **Get** /s/{spaceId}/api/alerts/alerts/_find | Retrieves a paginated set of alerts.
*AlertingAPI* | [**LegacyGetAlert**](docs/AlertingAPI.md#legacygetalert) | **Get** /s/{spaceId}/api/alerts/alert/{alertId} | Retrieves an alert by its identifier.
*AlertingAPI* | [**LegacyGetAlertTypes**](docs/AlertingAPI.md#legacygetalerttypes) | **Get** /s/{spaceId}/api/alerts/alerts/list_alert_types | Retrieves a list of alert types.
*AlertingAPI* | [**LegacyGetAlertingHealth**](docs/AlertingAPI.md#legacygetalertinghealth) | **Get** /s/{spaceId}/api/alerts/alerts/_health | Retrieves the health status of the alerting framework.
*AlertingAPI* | [**LegacyMuteAlertInstance**](docs/AlertingAPI.md#legacymutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute | Mutes an alert instance.
*AlertingAPI* | [**LegacyMuteAllAlertInstances**](docs/AlertingAPI.md#legacymuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_mute_all | Mutes all alert instances.
*AlertingAPI* | [**LegacyUnmuteAlertInstance**](docs/AlertingAPI.md#legacyunmutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute | Unmutes an alert instance.
*AlertingAPI* | [**LegacyUnmuteAllAlertInstances**](docs/AlertingAPI.md#legacyunmuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_unmute_all | Unmutes all alert instances.
*AlertingAPI* | [**LegacyUpdateAlert**](docs/AlertingAPI.md#legacyupdatealert) | **Put** /s/{spaceId}/api/alerts/alert/{alertId} | Updates the attributes for an alert.
*AlertingAPI* | [**LegaryDeleteAlert**](docs/AlertingAPI.md#legarydeletealert) | **Delete** /s/{spaceId}/api/alerts/alert/{alertId} | Permanently removes an alert.
*AlertingAPI* | [**MuteAlert**](docs/AlertingAPI.md#mutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute | Mutes an alert.
*AlertingAPI* | [**MuteAllAlerts**](docs/AlertingAPI.md#muteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all | Mutes all alerts.
*AlertingAPI* | [**UnmuteAlert**](docs/AlertingAPI.md#unmutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute | Unmutes an alert.
*AlertingAPI* | [**UnmuteAllAlerts**](docs/AlertingAPI.md#unmuteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all | Unmutes all alerts.
*AlertingAPI* | [**UpdateRule**](docs/AlertingAPI.md#updaterule) | **Put** /s/{spaceId}/api/alerting/rule/{ruleId} | Updates the attributes for a rule.


## Documentation For Models
Expand Down Expand Up @@ -160,22 +160,21 @@ Class | Method | HTTP request | Description
## Documentation For Authorization



Authentication schemes defined for the API:
### basicAuth

- **Type**: HTTP basic authentication

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
auth := context.WithValue(context.Background(), alerting.ContextBasicAuth, alerting.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```


### apiKeyAuth

- **Type**: API key
Expand All @@ -184,6 +183,19 @@ r, err := client.Service.Operation(auth, args)

Note, each API key must be added to a map of `map[string]APIKey` where the key is: ApiKey and passed in as the auth context for each request.

Example

```golang
auth := context.WithValue(
context.Background(),
alerting.ContextAPIKeys,
map[string]alerting.APIKey{
"ApiKey": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
```


## Documentation for Utility Methods

Expand Down
Loading