Skip to content

Commit c51fd88

Browse files
authored
Merge branch 'main' into spaces_data_source
2 parents 1636949 + 261d77e commit c51fd88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2110
-197
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
- '8.11.4'
103103
- '8.12.2'
104104
- '8.13.4'
105-
- '8.14.0'
105+
- '8.14.3'
106106
steps:
107107
- uses: actions/checkout@v4
108108
- uses: actions/setup-go@v5

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
## [Unreleased]
22

3+
## [0.11.5] - 2024-08-12
4+
35
- Fix setting `id` for Fleet outputs and servers ([#666](https://github.com/elastic/terraform-provider-elasticstack/pull/666))
6+
- Fix `elasticstack_fleet_enrollment_tokens` returning empty tokens in some case ([#683](https://github.com/elastic/terraform-provider-elasticstack/pull/683))
7+
- Add support for Kibana synthetics private locations ([#696](https://github.com/elastic/terraform-provider-elasticstack/pull/696))
8+
- Support setting `restriction` in `elasticstack_elasticsearch_security_api_key` role definitions ([#577](https://github.com/elastic/terraform-provider-elasticstack/pull/577))
9+
- Fix type of `group_by` attribute in the `kibana_slo` resource to be compatible with versions 8.14+ ([#701](https://github.com/elastic/terraform-provider-elasticstack/pull/701))
410

511
## [0.11.4] - 2024-06-13
612

@@ -160,7 +166,7 @@
160166
- Add `elasticstack_elasticsearch_watch` for managing Elasticsearch Watches ([#155](https://github.com/elastic/terraform-provider-elasticstack/pull/155))
161167
- Add `elasticstack_kibana_alerting_rule` for managing Kibana alerting rules ([#292](https://github.com/elastic/terraform-provider-elasticstack/pull/292))
162168
- Add client for communicating with the Fleet APIs ([#311](https://github.com/elastic/terraform-provider-elasticstack/pull/311)])
163-
- Add `elasticstack_fleet_enrollment_tokens` and `elasticstack_fleet_agent_policy` for managing Fleet enrollment tokens and agent policies ([#322](https://github.com/elastic/terraform-provider-elasticstack/pull/322)])
169+
- Add `elasticstack_fleet_enrollment_tokens` and `elasticstack_fleet_agent_policy` for managing Fleet enrollment tokens and agent policies ([#322](https://github.com/elastic/terraform-provider-elasticstack/pull/322))
164170
- Add `elasticstack_fleet_output` and `elasticstack_fleet_server_host` for managing Fleet outputs and server hosts ([#327](https://github.com/elastic/terraform-provider-elasticstack/pull/327)])
165171
- Add `elasticstack_kibana_action_connector` for managing Kibana action connectors ([#306](https://github.com/elastic/terraform-provider-elasticstack/pull/306))
166172

@@ -309,7 +315,8 @@
309315
- Initial set of docs
310316
- CI integration
311317
312-
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.4...HEAD
318+
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.5...HEAD
319+
[0.11.5]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.4...v0.11.5
313320
[0.11.4]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.3...v0.11.4
314321
[0.11.3]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.2...v0.11.3
315322
[0.11.2]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.1...v0.11.2

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.DEFAULT_GOAL = help
22
SHELL := /bin/bash
33

4-
VERSION ?= 0.11.4
4+
5+
VERSION ?= 0.11.5
56

67
NAME = elasticstack
78
BINARY = terraform-provider-${NAME}
@@ -58,8 +59,8 @@ testacc: ## Run acceptance tests
5859
test: ## Run unit tests
5960
go test -v $(TEST) $(TESTARGS) -timeout=5m -parallel=4
6061

61-
# Retry command - first argumment is how many attempts are required, second argument is the command to run
62-
# Backoff starts with 1 second and double with next itteration
62+
# Retry command - first argument is how many attempts are required, second argument is the command to run
63+
# Backoff starts with 1 second and double with next iteration
6364
retry = until [ $$(if [ -z "$$attempt" ]; then echo -n "0"; else echo -n "$$attempt"; fi) -ge $(1) ]; do \
6465
backoff=$$(if [ -z "$$backoff" ]; then echo "1"; else echo "$$backoff"; fi); \
6566
sleep $$backoff; \

docs/resources/elasticsearch_security_api_key.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,37 @@ resource "elasticstack_elasticsearch_security_api_key" "api_key" {
4141
})
4242
}
4343
44+
# restriction on a role descriptor for an API key is supported since Elastic 8.9
45+
resource "elasticstack_elasticsearch_security_api_key" "api_key_with_restriction" {
46+
# Set the name
47+
name = "My API key"
48+
# Set the role descriptors
49+
role_descriptors = jsonencode({
50+
role-a = {
51+
cluster = ["all"],
52+
indices = [
53+
{
54+
names = ["index-a*"],
55+
privileges = ["read"]
56+
}
57+
],
58+
restriction = {
59+
workflows = ["search_application_query"]
60+
}
61+
}
62+
})
63+
64+
# Set the expiration for the API key
65+
expiration = "1d"
66+
67+
# Set the custom metadata for this user
68+
metadata = jsonencode({
69+
"env" = "testing"
70+
"open" = false
71+
"number" = 49
72+
})
73+
}
74+
4475
output "api_key" {
4576
value = elasticstack_elasticsearch_security_api_key.api_key
4677
sensitive = true
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
subcategory: "Kibana"
3+
layout: ""
4+
page_title: "Elasticstack: elasticstack_kibana_synthetics_private_location Resource"
5+
description: |-
6+
Creates or updates a Kibana synthetics private location.
7+
---
8+
9+
# Resource: elasticstack_kibana_synthetics_private_location
10+
11+
Creates or updates a Kibana synthetics private location.
12+
See [Monitor via a private agent](https://www.elastic.co/guide/en/observability/current/synthetics-private-location.html#monitor-via-private-agent)
13+
and [API docs](https://www.elastic.co/guide/en/kibana/current/create-private-location-api.html)
14+
15+
## Example Usage
16+
17+
```terraform
18+
provider "elasticstack" {
19+
fleet {}
20+
kibana {}
21+
}
22+
23+
resource "elasticstack_fleet_agent_policy" "sample" {
24+
name = "Sample Agent Policy"
25+
namespace = "default"
26+
description = "A sample agent policy"
27+
monitor_logs = true
28+
monitor_metrics = true
29+
skip_destroy = false
30+
}
31+
32+
resource "elasticstack_kibana_synthetics_private_location" "example" {
33+
label = "example label"
34+
space_id = "default"
35+
agent_policy_id = elasticstack_fleet_agent_policy.sample.policy_id
36+
tags = ["tag-a", "tag-b"]
37+
geo = {
38+
lat = 40.7128
39+
lon = 74.0060
40+
}
41+
}
42+
```
43+
44+
<!-- schema generated by tfplugindocs -->
45+
## Schema
46+
47+
### Required
48+
49+
- `agent_policy_id` (String) The ID of the agent policy associated with the private location. To create a private location for synthetics monitor you need to create an agent policy in fleet and use its agentPolicyId
50+
- `label` (String) A label for the private location, used as unique identifier
51+
52+
### Optional
53+
54+
- `geo` (Attributes) Geographic coordinates (WGS84) for the location (see [below for nested schema](#nestedatt--geo))
55+
- `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used.
56+
- `tags` (List of String) An array of tags to categorize the private location.
57+
58+
### Read-Only
59+
60+
- `id` (String) Generated id for the private location. For monitor setup please use private location label.
61+
62+
<a id="nestedatt--geo"></a>
63+
### Nested Schema for `geo`
64+
65+
Required:
66+
67+
- `lat` (Number) The latitude of the location.
68+
- `lon` (Number) The longitude of the location.
69+
70+
## Import
71+
72+
Import is supported using the following syntax:
73+
74+
```shell
75+
terraform import elasticstack_kibana_synthetics_private_location.my_location <private_location_id>
76+
```

examples/resources/elasticstack_elasticsearch_security_api_key/resource.tf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,37 @@ resource "elasticstack_elasticsearch_security_api_key" "api_key" {
2626
})
2727
}
2828

29+
# restriction on a role descriptor for an API key is supported since Elastic 8.9
30+
resource "elasticstack_elasticsearch_security_api_key" "api_key_with_restriction" {
31+
# Set the name
32+
name = "My API key"
33+
# Set the role descriptors
34+
role_descriptors = jsonencode({
35+
role-a = {
36+
cluster = ["all"],
37+
indices = [
38+
{
39+
names = ["index-a*"],
40+
privileges = ["read"]
41+
}
42+
],
43+
restriction = {
44+
workflows = ["search_application_query"]
45+
}
46+
}
47+
})
48+
49+
# Set the expiration for the API key
50+
expiration = "1d"
51+
52+
# Set the custom metadata for this user
53+
metadata = jsonencode({
54+
"env" = "testing"
55+
"open" = false
56+
"number" = 49
57+
})
58+
}
59+
2960
output "api_key" {
3061
value = elasticstack_elasticsearch_security_api_key.api_key
3162
sensitive = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import elasticstack_kibana_synthetics_private_location.my_location <private_location_id>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
provider "elasticstack" {
2+
fleet {}
3+
kibana {}
4+
}
5+
6+
resource "elasticstack_fleet_agent_policy" "sample" {
7+
name = "Sample Agent Policy"
8+
namespace = "default"
9+
description = "A sample agent policy"
10+
monitor_logs = true
11+
monitor_metrics = true
12+
skip_destroy = false
13+
}
14+
15+
resource "elasticstack_kibana_synthetics_private_location" "example" {
16+
label = "example label"
17+
space_id = "default"
18+
agent_policy_id = elasticstack_fleet_agent_policy.sample.policy_id
19+
tags = ["tag-a", "tag-b"]
20+
geo = {
21+
lat = 40.7128
22+
lon = 74.0060
23+
}
24+
}

generated/slo-spec.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,11 @@ components:
11731173
example: true
11741174
groupBy:
11751175
description: optional group by field to use to generate an SLO per distinct value
1176-
type: string
1176+
oneOf:
1177+
- type: string
1178+
- type: array
1179+
items:
1180+
type: string
11771181
example: some.field
11781182
instanceId:
11791183
description: the value derived from the groupBy field, if present, otherwise '*'
@@ -1320,7 +1324,11 @@ components:
13201324
$ref: '#/components/schemas/settings'
13211325
groupBy:
13221326
description: optional group by field to use to generate an SLO per distinct value
1323-
type: string
1327+
oneOf:
1328+
- type: string
1329+
- type: array
1330+
items:
1331+
type: string
13241332
example: some.field
13251333
tags:
13261334
description: List of tags

generated/slo/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ docs/Objective.md
4545
docs/Settings.md
4646
docs/SloAPI.md
4747
docs/SloResponse.md
48+
docs/SloResponseGroupBy.md
4849
docs/SloResponseIndicator.md
4950
docs/Summary.md
5051
docs/SummaryStatus.md
@@ -94,6 +95,7 @@ model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go
9495
model_objective.go
9596
model_settings.go
9697
model_slo_response.go
98+
model_slo_response_group_by.go
9799
model_slo_response_indicator.go
98100
model_summary.go
99101
model_summary_status.go

generated/slo/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Class | Method | HTTP request | Description
128128
- [Objective](docs/Objective.md)
129129
- [Settings](docs/Settings.md)
130130
- [SloResponse](docs/SloResponse.md)
131+
- [SloResponseGroupBy](docs/SloResponseGroupBy.md)
131132
- [SloResponseIndicator](docs/SloResponseIndicator.md)
132133
- [Summary](docs/Summary.md)
133134
- [SummaryStatus](docs/SummaryStatus.md)

generated/slo/api/openapi.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,7 @@ components:
10621062
example: true
10631063
type: boolean
10641064
groupBy:
1065-
description: optional group by field to use to generate an SLO per distinct
1066-
value
1067-
example: some.field
1068-
type: string
1065+
$ref: '#/components/schemas/slo_response_groupBy'
10691066
instanceId:
10701067
description: "the value derived from the groupBy field, if present, otherwise\
10711068
\ '*'"
@@ -1289,10 +1286,7 @@ components:
12891286
settings:
12901287
$ref: '#/components/schemas/settings'
12911288
groupBy:
1292-
description: optional group by field to use to generate an SLO per distinct
1293-
value
1294-
example: some.field
1295-
type: string
1289+
$ref: '#/components/schemas/slo_response_groupBy'
12961290
tags:
12971291
description: List of tags
12981292
items:
@@ -1783,6 +1777,15 @@ components:
17831777
- $ref: '#/components/schemas/indicator_properties_custom_metric'
17841778
- $ref: '#/components/schemas/indicator_properties_histogram'
17851779
- $ref: '#/components/schemas/indicator_properties_timeslice_metric'
1780+
slo_response_groupBy:
1781+
description: optional group by field to use to generate an SLO per distinct
1782+
value
1783+
example: some.field
1784+
oneOf:
1785+
- type: string
1786+
- items:
1787+
type: string
1788+
type: array
17861789
create_slo_request_indicator:
17871790
oneOf:
17881791
- $ref: '#/components/schemas/indicator_properties_custom_kql'

generated/slo/docs/CreateSloRequest.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Name | Type | Description | Notes
1212
**BudgetingMethod** | [**BudgetingMethod**](BudgetingMethod.md) | |
1313
**Objective** | [**Objective**](Objective.md) | |
1414
**Settings** | Pointer to [**Settings**](Settings.md) | | [optional]
15-
**GroupBy** | Pointer to **string** | optional group by field to use to generate an SLO per distinct value | [optional]
15+
**GroupBy** | Pointer to [**SloResponseGroupBy**](SloResponseGroupBy.md) | | [optional]
1616
**Tags** | Pointer to **[]string** | List of tags | [optional]
1717

1818
## Methods
@@ -206,20 +206,20 @@ HasSettings returns a boolean if a field has been set.
206206

207207
### GetGroupBy
208208

209-
`func (o *CreateSloRequest) GetGroupBy() string`
209+
`func (o *CreateSloRequest) GetGroupBy() SloResponseGroupBy`
210210

211211
GetGroupBy returns the GroupBy field if non-nil, zero value otherwise.
212212

213213
### GetGroupByOk
214214

215-
`func (o *CreateSloRequest) GetGroupByOk() (*string, bool)`
215+
`func (o *CreateSloRequest) GetGroupByOk() (*SloResponseGroupBy, bool)`
216216

217217
GetGroupByOk returns a tuple with the GroupBy field if it's non-nil, zero value otherwise
218218
and a boolean to check if the value has been set.
219219

220220
### SetGroupBy
221221

222-
`func (o *CreateSloRequest) SetGroupBy(v string)`
222+
`func (o *CreateSloRequest) SetGroupBy(v SloResponseGroupBy)`
223223

224224
SetGroupBy sets GroupBy field to given value.
225225

0 commit comments

Comments
 (0)