Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
94b234c
Add Fleet Support
taylor-swanson Mar 23, 2023
baaabd7
Update changelog
taylor-swanson Apr 27, 2023
91097b8
make fmt
taylor-swanson Apr 27, 2023
9412214
Update docs after fmt
taylor-swanson Apr 27, 2023
94142f6
Remove problematic fleet config check, Make fleet acctest config inhe…
taylor-swanson Apr 27, 2023
fee273d
Fix config issues
taylor-swanson Apr 27, 2023
cdc28ba
Regen docs
taylor-swanson Apr 27, 2023
be706e4
Add fleet endpoint to test config
taylor-swanson Apr 27, 2023
00d9443
Also add user and pass for fleet test
taylor-swanson Apr 27, 2023
0235e5f
Enable fleet in kibana, add version constraints to tests
taylor-swanson Apr 27, 2023
312f010
Fix yml
taylor-swanson Apr 27, 2023
af40310
Fix wrong password
taylor-swanson Apr 27, 2023
8c092f3
Remove fleet data-source/resources
taylor-swanson Apr 28, 2023
aa8e942
Update changelog description
taylor-swanson Apr 28, 2023
897def3
Move oapi-codegen go.mod entry to tools
taylor-swanson May 2, 2023
06b4111
Merge branch 'main' into fleet-provider
taylor-swanson May 2, 2023
6e3cffd
Revert debug.go back to what's in main
taylor-swanson May 2, 2023
073d683
Relocate duplicate print JSON lines to utils package
taylor-swanson May 2, 2023
e14f46a
Use kibana config as base config for fleet, remove redundant environm…
taylor-swanson May 3, 2023
be1eeaf
Expose ELASTICSEARCH_INSECURE env variable in acceptance testing clie…
taylor-swanson May 3, 2023
4252ddc
Clean up generate.go
taylor-swanson May 4, 2023
e628338
Merge branch 'main' into fleet-provider
taylor-swanson May 4, 2023
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
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d
xpack.fleet.enabled: true
ports:
- 5601:5601

Expand Down Expand Up @@ -128,3 +129,6 @@ jobs:
ELASTICSEARCH_USERNAME: "elastic"
ELASTICSEARCH_PASSWORD: ${{ env.ELASTIC_PASSWORD }}
KIBANA_ENDPOINT: "http://localhost:5601"
FLEET_ENDPOINT: "http://localhost:5601"
FLEET_USERNAME: "elastic"
FLEET_PASSWORD: ${{ env.ELASTIC_PASSWORD }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Add `elasticstack_elasticsearch_transform` for managing Elasticsearch transforms ([#284](https://github.com/elastic/terraform-provider-elasticstack/pull/284))
- Add `elasticstack_elasticsearch_watch` for managing Elasticsearch Watches ([#155](https://github.com/elastic/terraform-provider-elasticstack/pull/155))
- Add `elasticstack_kibana_alerting_rule` for managing Kibana alerting rules ([#292](https://github.com/elastic/terraform-provider-elasticstack/pull/292))
- Add `elasticstack_fleet_*` for managing Fleet objects ([#311](https://github.com/elastic/terraform-provider-elasticstack/pull/311)])

### Fixed
- Updated unsupported queue_max_bytes_number and queue_max_bytes_units with queue.max_bytes ([#266](https://github.com/elastic/terraform-provider-elasticstack/issues/266))
Expand Down
48 changes: 48 additions & 0 deletions docs/data-sources/fleet_enrollment_tokens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
subcategory: "Fleet"
layout: ""
page_title: "Elasticstack: elasticstack_fleet_enrollment_tokens Data Source"
description: |-
Gets information about Fleet Enrollment Tokens. See https://www.elastic.co/guide/en/fleet/current/fleet-enrollment-tokens.html
---

# Data Source: elasticstack_fleet_enrollment_tokens

This data source provides information about Fleet Enrollment Tokens.

## Example Usage

```terraform
provider "elasticstack" {
fleet {}
}

data "elasticstack_fleet_enrollment_tokens" "test" {
policy_id = "223b1bf8-240f-463f-8466-5062670d0754"
}
```

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

### Optional

- `policy_id` (String) The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.

### Read-Only

- `id` (String) Internal identifier of the data source.
- `tokens` (List of Object) A list of enrollment tokens. (see [below for nested schema](#nestedatt--tokens))

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

Read-Only:

- `active` (Boolean)
- `api_key` (String)
- `api_key_id` (String)
- `created_at` (String)
- `key_id` (String)
- `name` (String)
- `policy_id` (String)
14 changes: 14 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ provider "elasticstack" {
### Optional

- `elasticsearch` (Block List, Max: 1) Elasticsearch connection configuration block. (see [below for nested schema](#nestedblock--elasticsearch))
- `fleet` (Block List, Max: 1) Fleet connection configuration block. (see [below for nested schema](#nestedblock--fleet))
- `kibana` (Block List, Max: 1) Kibana connection configuration block. (see [below for nested schema](#nestedblock--kibana))

<a id="nestedblock--elasticsearch"></a>
Expand All @@ -106,6 +107,19 @@ Optional:
- `username` (String) Username to use for API authentication to Elasticsearch.


<a id="nestedblock--fleet"></a>
### Nested Schema for `fleet`

Optional:

- `api_key` (String, Sensitive) API key to use for API authentication to Fleet.
- `ca_certs` (List of String) A list of paths to CA certificates to validate the certificate presented by the Fleet server.
- `endpoint` (String, Sensitive) The Fleet server where the terraform provider will point to, this must include the http(s) schema and port number.
- `insecure` (Boolean) Disable TLS certificate validation
- `password` (String, Sensitive) Password to use for API authentication to Fleet.
- `username` (String) Username to use for API authentication to Fleet.


<a id="nestedblock--kibana"></a>
### Nested Schema for `kibana`

Expand Down
60 changes: 60 additions & 0 deletions docs/resources/fleet_agent_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
subcategory: "Fleet"
layout: ""
page_title: "Elasticstack: elasticstack_fleet_agent_policy Resource"
description: |-
Creates or updates a Fleet Agent Policy.
---

# Resource: elasticstack_fleet_agent_policy

Creates or updates a Fleet Agent Policy. See https://www.elastic.co/guide/en/fleet/current/fleet-api-docs.html#create-agent-policy-api

## Example Usage

```terraform
provider "elasticstack" {
fleet {}
}

resource "elasticstack_fleet_agent_policy" "test_policy" {
name = "Test Policy"
namespace = "default"
description = "Test Agent Policy"
sys_monitoring = true
monitor_logs = true
monitor_metrics = true
}
```

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

### Required

- `name` (String) The name of the agent policy.
- `namespace` (String) The namespace of the agent policy.

### Optional

- `data_output_id` (String) The identifier for the data output.
- `description` (String) The description of the agent policy.
- `download_source_id` (String) The identifier for the Elastic Agent binary download server.
- `fleet_server_host_id` (String) The identifier for the Fleet server host.
- `monitor_logs` (Boolean) Enable collection of agent logs.
- `monitor_metrics` (Boolean) Enable collection of agent metrics.
- `monitoring_output_id` (String) The identifier for monitoring output.
- `sys_monitoring` (Boolean) Enable collection of system logs and metrics.

### Read-Only

- `id` (String) Internal identifier of the resource.
- `policy_id` (String) Unique identifier of the agent policy.

## Import

Import is supported using the following syntax:

```shell
terraform import elasticstack_kibana_fleet_agent_policy.my_policy <space id>/<policy id>
```
61 changes: 61 additions & 0 deletions docs/resources/fleet_output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
subcategory: "Fleet"
layout: ""
page_title: "Elasticstack: elasticstack_fleet_output Resource"
description: |-
Creates or updates a Fleet Output.
---

# Resource: elasticstack_fleet_output

Creates or updates a Fleet Output.

## Example Usage

```terraform
provider "elasticstack" {
fleet {}
}

resource "elasticstack_fleet_output" "test_output" {
name = "Test Output"
type = "elasticsearch"
config_yaml = yamlencode({
"ssl.verification_mode" : "none"
})
default_integrations = false
default_monitoring = false
hosts = [
"https://elasticsearch:9200"
]
}
```

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

### Required

- `name` (String) The name of the output.
- `type` (String) The output type.

### Optional

- `ca_sha256` (String) Fingerprint of the Elasticsearch CA certificate.
- `config_yaml` (String, Sensitive) Advanced YAML configuration. YAML settings here will be added to the output section of each agent policy.
- `default_integrations` (Boolean) Make this output the default for agent integrations.
- `default_monitoring` (Boolean) Make this output the default for agent monitoring.
- `hosts` (List of String) A list of hosts.

### Read-Only

- `id` (String) Internal identifier of the resource.
- `output_id` (String) Unique identifier of the output.

## Import

Import is supported using the following syntax:

```shell
terraform import elasticstack_fleet_output.my_output <space id>/<output id>
```
52 changes: 52 additions & 0 deletions docs/resources/fleet_server_host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
subcategory: "Fleet"
layout: ""
page_title: "Elasticstack: elasticstack_fleet_server_host Resource"
description: |-
Creates or updates a Fleet Server Host.
---

# Resource: elasticstack_fleet_server_host

Creates or updates a Fleet Server Host.

## Example Usage

```terraform
provider "elasticstack" {
fleet {}
}

resource "elasticstack_fleet_server_host" "test_host" {
name = "Test Host"
default = false
hosts = [
"https://fleet-server:8220"
]
}
```

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

### Required

- `hosts` (List of String) A list of hosts.
- `name` (String) The name of the Fleet server host.

### Optional

- `default` (Boolean) Set as default.

### Read-Only

- `host_id` (String) Unique identifier of the Fleet server host.
- `id` (String) Internal identifier of the resource.

## Import

Import is supported using the following syntax:

```shell
terraform import elasticstack_fleet_server_host.my_host <space id>/<host id>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
provider "elasticstack" {
fleet {}
}

data "elasticstack_fleet_enrollment_tokens" "test" {
policy_id = "223b1bf8-240f-463f-8466-5062670d0754"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import elasticstack_kibana_fleet_agent_policy.my_policy <space id>/<policy id>
12 changes: 12 additions & 0 deletions examples/resources/elasticstack_fleet_agent_policy/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
provider "elasticstack" {
fleet {}
}

resource "elasticstack_fleet_agent_policy" "test_policy" {
name = "Test Policy"
namespace = "default"
description = "Test Agent Policy"
sys_monitoring = true
monitor_logs = true
monitor_metrics = true
}
1 change: 1 addition & 0 deletions examples/resources/elasticstack_fleet_output/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import elasticstack_fleet_output.my_output <space id>/<output id>
16 changes: 16 additions & 0 deletions examples/resources/elasticstack_fleet_output/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
provider "elasticstack" {
fleet {}
}

resource "elasticstack_fleet_output" "test_output" {
name = "Test Output"
type = "elasticsearch"
config_yaml = yamlencode({
"ssl.verification_mode" : "none"
})
default_integrations = false
default_monitoring = false
hosts = [
"https://elasticsearch:9200"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import elasticstack_fleet_server_host.my_host <space id>/<host id>
11 changes: 11 additions & 0 deletions examples/resources/elasticstack_fleet_server_host/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
provider "elasticstack" {
fleet {}
}

resource "elasticstack_fleet_server_host" "test_host" {
name = "Test Host"
default = false
hosts = [
"https://fleet-server:8220"
]
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/elastic/terraform-provider-elasticstack
go 1.19

require (
github.com/deepmap/oapi-codegen v1.12.4
github.com/disaster37/go-kibana-rest/v8 v8.5.0
github.com/elastic/go-elasticsearch/v7 v7.17.7
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
Expand All @@ -16,12 +17,14 @@ require (

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand Down
Loading