Skip to content

Commit fd20c65

Browse files
authored
Merge branch 'main' into switch-to-protocol6
2 parents 45f36e6 + b7cb8e1 commit fd20c65

File tree

36 files changed

+3656
-103
lines changed

36 files changed

+3656
-103
lines changed

CHANGELOG.md

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

3+
### Added
4+
- Switch to Terraform [protocol version 6](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol#protocol-version-6) that is compatible with Terraform CLI version 1.0 and later.
5+
6+
## [0.10.0] - 2023-11-02
7+
38
### Added
49
- Add support for Kibana security role ([#435](https://github.com/elastic/terraform-provider-elasticstack/pull/435))
510
- Introduce `elasticstack_kibana_import_saved_objects` resource as an additive only way to manage Kibana saved objects ([#343](https://github.com/elastic/terraform-provider-elasticstack/pull/343)).
611
- Add support for Terraform Plugin Framework ([#343](https://github.com/elastic/terraform-provider-elasticstack/pull/343)).
712
- Fix fleet resources not having ID set on import ([#447](https://github.com/elastic/terraform-provider-elasticstack/pull/447))
813
- Fix Fleet Agent Policy monitoring settings ([#448](https://github.com/elastic/terraform-provider-elasticstack/pull/448))
9-
- Switch to Terraform [protocol version 6](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol#protocol-version-6) that is compatible with Terraform CLI version 1.0 and later.
14+
- Add `elasticstack_elasticsearch_info` data source. ([#467](https://github.com/elastic/terraform-provider-elasticstack/pull/467))
15+
- Add `elasticstack_fleet_package` and `elasticstack_fleet_package_policy` resources ([#454](https://github.com/elastic/terraform-provider-elasticstack/pull/454))
1016

1117
## [0.9.0] - 2023-10-09
1218

@@ -196,7 +202,8 @@
196202
- Initial set of docs
197203
- CI integration
198204
199-
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.9.0...HEAD
205+
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.10.0...HEAD
206+
[0.10.0]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.9.0...v0.10.0
200207
[0.9.0]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.8.0...v0.9.0
201208
[0.8.0]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.7.0...v0.8.0
202209
[0.7.0]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.6.2...v0.7.0

Makefile

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

4-
VERSION ?= 0.9.0
4+
VERSION ?= 0.10.0
55

66
NAME = elasticstack
77
BINARY = terraform-provider-${NAME}
@@ -162,7 +162,7 @@ tools: $(GOBIN) ## Install useful tools for linting, docs generation and develop
162162
@ cd tools && go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
163163
@ cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
164164
@ cd tools && go install github.com/goreleaser/goreleaser
165-
@ cd tools && go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen
165+
@ cd tools && go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen
166166

167167
.PHONY: misspell
168168
misspell:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
subcategory: "Cluster"
3+
layout: ""
4+
page_title: "Elasticstack: elasticstack_elasticsearch_info Data Source"
5+
description: |-
6+
Gets information about the Elasticsearch cluster.
7+
---
8+
9+
# Data Source: elasticstack_elasticsearch_info
10+
11+
This data source provides the information about the configured Elasticsearch cluster
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "elasticstack" {
17+
elasticsearch {}
18+
}
19+
20+
data "elasticstack_elasticsearch_info" "cluster_info" {
21+
}
22+
```
23+
24+
<!-- schema generated by tfplugindocs -->
25+
## Schema
26+
27+
### Read-Only
28+
29+
- `cluster_name` (String) Name of the cluster, based on the Cluster name setting setting.
30+
- `cluster_uuid` (String) Unique identifier for the cluster.
31+
- `id` (String) The ID of this resource.
32+
- `name` (String) Name of the node.
33+
- `tagline` (String) Elasticsearh tag line.
34+
- `version` (List of Object) Contains statistics about the number of nodes selected by the request's node filters. (see [below for nested schema](#nestedatt--version))
35+
36+
<a id="nestedatt--version"></a>
37+
### Nested Schema for `version`
38+
39+
Read-Only:
40+
41+
- `build_date` (String)
42+
- `build_flavor` (String)
43+
- `build_hash` (String)
44+
- `build_snapshot` (Boolean)
45+
- `build_type` (String)
46+
- `lucene_version` (String)
47+
- `minimum_index_compatibility_version` (String)
48+
- `minimum_wire_compatibility_version` (String)
49+
- `number` (String)

docs/guides/elasticstack-and-cloud.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ terraform {
2626
}
2727
elasticstack = {
2828
source = "elastic/elasticstack"
29-
version = "~>0.9"
29+
version = "~>0.10"
3030
}
3131
}
3232
}

docs/resources/fleet_agent_policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ resource "elasticstack_fleet_agent_policy" "test_policy" {
5757
Import is supported using the following syntax:
5858

5959
```shell
60-
terraform import elasticstack_kibana_fleet_agent_policy.my_policy <fleet_agent_policy_id>
60+
terraform import elasticstack_fleet_agent_policy.my_policy <fleet_agent_policy_id>
6161
```

docs/resources/fleet_package.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
subcategory: "Fleet"
3+
layout: ""
4+
page_title: "Elasticstack: elasticstack_fleet_package Resource"
5+
description: |-
6+
Installs or uninstalls a Fleet integration package.
7+
---
8+
9+
# Resource: elasticstack_fleet_package
10+
11+
Installs or uninstalls a Fleet integration package. The Kibana Fleet UI can be
12+
used to view available packages. Additional information for managing integration
13+
packages can be found [here](https://www.elastic.co/guide/en/fleet/current/install-uninstall-integration-assets.html).
14+
15+
To prevent the package from being uninstalled when the resource is destroyed,
16+
set `skip_destroy` to `true`.
17+
18+
## Example Usage
19+
20+
```terraform
21+
provider "elasticstack" {
22+
kibana {}
23+
}
24+
25+
resource "elasticstack_fleet_package" "test_package" {
26+
name = "tcp"
27+
version = "1.16.0"
28+
force = true
29+
}
30+
```
31+
32+
<!-- schema generated by tfplugindocs -->
33+
## Schema
34+
35+
### Required
36+
37+
- `name` (String) The package name.
38+
- `version` (String) The package version.
39+
40+
### Optional
41+
42+
- `force` (Boolean) Set to true to force the requested action.
43+
- `skip_destroy` (Boolean) Set to true if you do not wish the package to be uninstalled at destroy time, and instead just remove the package from the Terraform state.
44+
45+
### Read-Only
46+
47+
- `id` (String) The ID of this resource.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
subcategory: "Fleet"
3+
layout: ""
4+
page_title: "Elasticstack: elasticstack_fleet_package_policy Resource"
5+
description: |-
6+
Creates or updates a Fleet Package Policy.
7+
---
8+
9+
# Resource: elasticstack_fleet_package_policy
10+
11+
Creates or updates a Fleet Package Policy.
12+
13+
It is highly recommended that all inputs and streams are provided in the
14+
Terraform plan, even if some are disabled. Otherwise, differences may appear
15+
between what is in the plan versus what is returned by the Fleet API.
16+
17+
The [Kibana Fleet UI](https://www.elastic.co/guide/en/fleet/current/add-integration-to-policy.html)
18+
can be used as a reference for what data needs to be provided. Instead of saving
19+
a new integration configuration, the API request can be previewed, showing what
20+
values need to be provided for inputs and their streams.
21+
22+
## Example Usage
23+
24+
```terraform
25+
provider "elasticstack" {
26+
fleet {}
27+
}
28+
29+
// The package to use.
30+
resource "elasticstack_fleet_package" "sample" {
31+
name = "tcp"
32+
version = "1.16.0"
33+
force = true
34+
}
35+
36+
// An agent policy to hold the package policy.
37+
resource "elasticstack_fleet_agent_policy" "sample" {
38+
name = "Sample Agent Policy"
39+
namespace = "default"
40+
description = "A sample agent policy"
41+
monitor_logs = true
42+
monitor_metrics = true
43+
skip_destroy = false
44+
}
45+
46+
// The associated enrollment token.
47+
data "elasticstack_fleet_enrollment_tokens" "sample" {
48+
policy_id = elasticstack_fleet_agent_policy.sample.policy_id
49+
}
50+
51+
// The package policy.
52+
resource "elasticstack_fleet_package_policy" "sample" {
53+
name = "Sample Package Policy"
54+
namespace = "default"
55+
description = "A sample package policy"
56+
agent_policy_id = elasticstack_fleet_agent_policy.sample.policy_id
57+
package_name = elasticstack_fleet_package.sample.name
58+
package_version = elasticstack_fleet_package.sample.version
59+
60+
input {
61+
input_id = "tcp-tcp"
62+
streams_json = jsonencode({
63+
"tcp.generic" : {
64+
"enabled" : true,
65+
"vars" : {
66+
"listen_address" : "localhost",
67+
"listen_port" : 8080,
68+
"data_stream.dataset" : "tcp.generic",
69+
"tags" : [],
70+
"syslog_options" : "field: message\n#format: auto\n#timezone: Local\n",
71+
"ssl" : "#certificate: |\n# -----BEGIN CERTIFICATE-----\n# ...\n# -----END CERTIFICATE-----\n#key: |\n# -----BEGIN PRIVATE KEY-----\n# ...\n# -----END PRIVATE KEY-----\n",
72+
"custom" : ""
73+
}
74+
}
75+
})
76+
}
77+
}
78+
```
79+
80+
<!-- schema generated by tfplugindocs -->
81+
## Schema
82+
83+
### Required
84+
85+
- `agent_policy_id` (String) ID of the agent policy.
86+
- `input` (Block List, Min: 1) (see [below for nested schema](#nestedblock--input))
87+
- `name` (String) The name of the package policy.
88+
- `namespace` (String) The namespace of the package policy.
89+
- `package_name` (String) The name of the package.
90+
- `package_version` (String) The version of the package.
91+
92+
### Optional
93+
94+
- `description` (String) The description of the package policy.
95+
- `enabled` (Boolean) Enable the package policy.
96+
- `force` (Boolean) Force operations, such as creation and deletion, to occur.
97+
- `policy_id` (String) Unique identifier of the package policy.
98+
- `vars_json` (String, Sensitive) Package-level variables as JSON.
99+
100+
### Read-Only
101+
102+
- `id` (String) The ID of this resource.
103+
104+
<a id="nestedblock--input"></a>
105+
### Nested Schema for `input`
106+
107+
Required:
108+
109+
- `input_id` (String) The identifier of the input.
110+
111+
Optional:
112+
113+
- `enabled` (Boolean) Enable the input.
114+
- `streams_json` (String, Sensitive) Input streams as JSON.
115+
- `vars_json` (String, Sensitive) Input variables as JSON.
116+
117+
## Import
118+
119+
Import is supported using the following syntax:
120+
121+
```shell
122+
terraform import elasticstack_fleet_package_policy.my_policy <fleet_package_policy_id>
123+
```

examples/cloud/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform {
77
}
88
elasticstack = {
99
source = "elastic/elasticstack"
10-
version = "~>0.9"
10+
version = "~>0.10"
1111
}
1212
}
1313
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
provider "elasticstack" {
2+
elasticsearch {}
3+
}
4+
5+
data "elasticstack_elasticsearch_info" "cluster_info" {
6+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
terraform import elasticstack_kibana_fleet_agent_policy.my_policy <fleet_agent_policy_id>
1+
terraform import elasticstack_fleet_agent_policy.my_policy <fleet_agent_policy_id>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
provider "elasticstack" {
2+
kibana {}
3+
}
4+
5+
resource "elasticstack_fleet_package" "test_package" {
6+
name = "tcp"
7+
version = "1.16.0"
8+
force = true
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import elasticstack_fleet_package_policy.my_policy <fleet_package_policy_id>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
provider "elasticstack" {
2+
fleet {}
3+
}
4+
5+
// The package to use.
6+
resource "elasticstack_fleet_package" "sample" {
7+
name = "tcp"
8+
version = "1.16.0"
9+
force = true
10+
}
11+
12+
// An agent policy to hold the package policy.
13+
resource "elasticstack_fleet_agent_policy" "sample" {
14+
name = "Sample Agent Policy"
15+
namespace = "default"
16+
description = "A sample agent policy"
17+
monitor_logs = true
18+
monitor_metrics = true
19+
skip_destroy = false
20+
}
21+
22+
// The associated enrollment token.
23+
data "elasticstack_fleet_enrollment_tokens" "sample" {
24+
policy_id = elasticstack_fleet_agent_policy.sample.policy_id
25+
}
26+
27+
// The package policy.
28+
resource "elasticstack_fleet_package_policy" "sample" {
29+
name = "Sample Package Policy"
30+
namespace = "default"
31+
description = "A sample package policy"
32+
agent_policy_id = elasticstack_fleet_agent_policy.sample.policy_id
33+
package_name = elasticstack_fleet_package.sample.name
34+
package_version = elasticstack_fleet_package.sample.version
35+
36+
input {
37+
input_id = "tcp-tcp"
38+
streams_json = jsonencode({
39+
"tcp.generic" : {
40+
"enabled" : true,
41+
"vars" : {
42+
"listen_address" : "localhost",
43+
"listen_port" : 8080,
44+
"data_stream.dataset" : "tcp.generic",
45+
"tags" : [],
46+
"syslog_options" : "field: message\n#format: auto\n#timezone: Local\n",
47+
"ssl" : "#certificate: |\n# -----BEGIN CERTIFICATE-----\n# ...\n# -----END CERTIFICATE-----\n#key: |\n# -----BEGIN PRIVATE KEY-----\n# ...\n# -----END PRIVATE KEY-----\n",
48+
"custom" : ""
49+
}
50+
}
51+
})
52+
}
53+
}

generated/connectors/connectors.gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)