-
Notifications
You must be signed in to change notification settings - Fork 108
Add resource for kibana synthetics monitors: http and tcp #699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
biscout42
merged 80 commits into
elastic:main
from
biscout42:kibana-synthetics-http-and-tcp-monitors
Aug 20, 2024
Merged
Changes from all commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
2252813
feat(synthetics): add http and tcp monitor resource
biscout42 e88f3d3
Merge branch 'main' into kibana-synthetics-http-and-tcp-monitors
biscout42 dc8e1a9
tcp and http monitor schema
biscout42 a76a5a0
implement kibana api for tcp monitor
biscout42 3d747c1
add tfModelV0 model for synthetic monitors
biscout42 ed50e44
allign monitor tf schema to API
biscout42 4a2419c
implement read resource
biscout42 aa09407
first version
biscout42 6c31d0a
add first test
biscout42 218f01f
add schema transformer tests
biscout42 c4673b3
Merge branch 'main' into kibana-synthetics-http-and-tcp-monitors
biscout42 02c86ba
testing synthetics
biscout42 8a372cc
fix null pointer
biscout42 843890c
limit number of supported options due-to kibana api
biscout42 f7199f8
wip
biscout42 4103571
increase es docker memory due-to es error process ended by code 137
biscout42 43cd844
try to increase GH workflow service memory
biscout42 4171e75
wip
biscout42 797b322
test connectio to package registry
biscout42 6403674
test in docker
biscout42 f95a42b
try to run package registry in docker
biscout42 6a08e21
try xpack.task_manager.max_attempts
biscout42 f98f4a8
Merge branch 'main' into kibana-synthetics-http-and-tcp-monitors
biscout42 d0d32e5
debug kibana
biscout42 1990615
try xpack.fleet.isAirGapped: true
biscout42 7763a41
try 8.15.0
biscout42 ccc25f9
try package-registry distribution
biscout42 761003e
try to use lite version
biscout42 1a33422
add re-try for package registry distribution health
biscout42 b5fdb41
enable debug for plugins.fleet
biscout42 2133ca2
Merge branch 'main' into kibana-synthetics-http-and-tcp-monitors
biscout42 7c499ca
try to set kibana loggin
biscout42 a8e885e
Merge branch 'main' into kibana-synthetics-http-and-tcp-monitors
biscout42 c60d641
try relative path
biscout42 3c9019f
Merge branch 'kibana-synthetics-http-and-tcp-monitors' of github.com:…
biscout42 9b04aa3
explore GH workflow env
biscout42 06f67c3
wip
biscout42 792c424
wip
biscout42 3e21939
wip
biscout42 0b77e80
add status check for kibana service
biscout42 6bc5ae3
use dirs
biscout42 c1ca74e
wip
biscout42 b267654
try workaround due-to missing checkout
biscout42 a46bda7
try start
biscout42 a99ba14
try to run kibana manually
biscout42 2fee656
try run
biscout42 f49d151
fixing docker: invalid reference format.
biscout42 bdff210
wip
biscout42 83019cb
wip
biscout42 a70fb1d
try the idea with env vars and longopts from kibana
biscout42 f105d97
forgot to remove mounted volume
biscout42 cc827e8
add acc tests for tcp monitor
biscout42 c8e21d2
clean-up before review
biscout42 a1b09af
add docs
biscout42 55c704e
try to force-install synthetics
biscout42 09af708
add re-try
biscout42 bcde2d1
force install synthetics only for 8.14.3
biscout42 73b8afc
try to use status api
biscout42 d2a7b91
add debug
biscout42 daa3b4c
back to force-install (synthetics doesn't report plugin status via API)
biscout42 053394a
silence
biscout42 74445af
CR comments: make `max_redirects` as int64
biscout42 ef09e64
reproduce monitor id issue - need to add namespace
biscout42 a25b691
add context to kibana synthetic API calls
biscout42 a443230
use composite id for monitors to import from napespaces
biscout42 1cbe623
migrate private location to composite id
biscout42 7bda56b
implement merge attributes
biscout42 bc704d4
add unit tests for merge and udpate docs
biscout42 e7d0568
cr comments - tests
biscout42 e478e05
docs - add spaceId
biscout42 3df3e90
Merge branch 'main' into kibana-synthetics-http-and-tcp-monitors
biscout42 0888164
add 8.15.0 for synthetics install call conditions
biscout42 f40d508
change log
biscout42 dcb8391
handle private location id w/o namespace
biscout42 ec96f68
use lable, as before
biscout42 e16ba84
formatting
biscout42 0c8a2b0
Merge branch 'main' into kibana-synthetics-http-and-tcp-monitors
biscout42 254d9e1
update private location delete to support both id formats
biscout42 5ccf103
naming ...
biscout42 98038d0
split synthetics monitor resources in tests between http and tcp to p…
biscout42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
--- | ||
subcategory: "Kibana" | ||
layout: "" | ||
page_title: "Elasticstack: elasticstack_kibana_synthetics_monitor Resource" | ||
description: |- | ||
Creates or updates a Kibana synthetics monitor. | ||
--- | ||
|
||
# Resource: elasticstack_kibana_synthetics_monitor | ||
|
||
Creates or updates a Kibana synthetics monitor. | ||
See [API docs](https://www.elastic.co/guide/en/kibana/current/add-monitor-api.html) | ||
|
||
## Supported monitor types | ||
* `http` | ||
* `tcp` | ||
|
||
**NOTE:** Due-to nature of partial update API, reset values to defaults is not supported. | ||
In case you would like to reset an optional monitor value, please set it explicitly or delete and create new monitor. | ||
|
||
|
||
## Example Usage | ||
|
||
```terraform | ||
provider "elasticstack" { | ||
kibana {} | ||
} | ||
|
||
resource "elasticstack_kibana_synthetics_monitor" "my_monitor" { | ||
name = "Example http monitor" | ||
space_id = "default" | ||
schedule = 10 | ||
locations = ["us_west"] | ||
enabled = false | ||
tags = ["tag"] | ||
alert = { | ||
status = { | ||
enabled = true | ||
} | ||
tls = { | ||
enabled = false | ||
} | ||
} | ||
service_name = "example apm service" | ||
timeout = 30 | ||
http = { | ||
url = "http://localhost:8080" | ||
ssl_verification_mode = "full" | ||
ssl_supported_protocols = ["TLSv1.2"] | ||
max_redirects = "10" | ||
mode = "all" | ||
ipv4 = true | ||
ipv6 = true | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) The monitor’s name. | ||
|
||
### Optional | ||
|
||
- `alert` (Attributes) Alert configuration. Default: `{ status: { enabled: true }, tls: { enabled: true } }`. (see [below for nested schema](#nestedatt--alert)) | ||
- `enabled` (Boolean) Whether the monitor is enabled. Default: `true` | ||
- `http` (Attributes) HTTP Monitor specific fields (see [below for nested schema](#nestedatt--http)) | ||
- `locations` (List of String) Where to deploy the monitor. Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations. | ||
- `params` (String) Monitor parameters. Raw JSON object, use `jsonencode` function to represent JSON | ||
- `private_locations` (List of String) These Private Locations refer to locations hosted and managed by you, whereas locations are hosted by Elastic. You can specify a Private Location using the location’s name. | ||
- `retest_on_failure` (Boolean) Enable or disable retesting when a monitor fails. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created, and if configured, an alert sent. Then the monitor will resume running according to the defined schedule. Using retest_on_failure can reduce noise related to transient problems. Default: `true`. | ||
- `schedule` (Number) The monitor’s schedule in minutes. Supported values are 1, 3, 5, 10, 15, 30, 60, 120 and 240. | ||
- `service_name` (String) The APM service name. | ||
- `space_id` (String) The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: *, \, /, ?, ", <, >, |, whitespace, ,, #, :, or -. Default: `default` | ||
- `tags` (List of String) An array of tags. | ||
- `tcp` (Attributes) TCP Monitor specific fields (see [below for nested schema](#nestedatt--tcp)) | ||
- `timeout` (Number) The monitor timeout in seconds, monitor will fail if it doesn’t complete within this time. Default: `16` | ||
|
||
### Read-Only | ||
|
||
- `id` (String) Generated identifier for the monitor | ||
|
||
<a id="nestedatt--alert"></a> | ||
### Nested Schema for `alert` | ||
|
||
Optional: | ||
|
||
- `status` (Attributes) (see [below for nested schema](#nestedatt--alert--status)) | ||
- `tls` (Attributes) (see [below for nested schema](#nestedatt--alert--tls)) | ||
|
||
<a id="nestedatt--alert--status"></a> | ||
### Nested Schema for `alert.status` | ||
|
||
Optional: | ||
|
||
- `enabled` (Boolean) | ||
|
||
|
||
<a id="nestedatt--alert--tls"></a> | ||
### Nested Schema for `alert.tls` | ||
|
||
Optional: | ||
|
||
- `enabled` (Boolean) | ||
|
||
|
||
|
||
<a id="nestedatt--http"></a> | ||
### Nested Schema for `http` | ||
|
||
Required: | ||
|
||
- `url` (String) URL to monitor. | ||
|
||
Optional: | ||
|
||
- `check` (String) The check request settings.. Raw JSON object, use `jsonencode` function to represent JSON | ||
- `ipv4` (Boolean) Whether to ping using the ipv4 protocol. | ||
- `ipv6` (Boolean) Whether to ping using the ipv6 protocol. | ||
- `max_redirects` (Number) The maximum number of redirects to follow. Default: `0` | ||
- `mode` (String) The mode of the monitor. Can be "all" or "any". If you’re using a DNS-load balancer and want to ping every IP address for the specified hostname, you should use all. | ||
- `password` (String) The password for authenticating with the server. The credentials are passed with the request. | ||
- `proxy_header` (String) Additional headers to send to proxies during CONNECT requests.. Raw JSON object, use `jsonencode` function to represent JSON | ||
- `proxy_url` (String) The URL of the proxy to use for this monitor. | ||
- `response` (String) Controls the indexing of the HTTP response body contents to the `http.response.body.contents` field.. Raw JSON object, use `jsonencode` function to represent JSON | ||
- `ssl_supported_protocols` (List of String) List of allowed SSL/TLS versions. | ||
- `ssl_verification_mode` (String) Controls the verification of server certificates. | ||
- `username` (String) The username for authenticating with the server. The credentials are passed with the request. | ||
|
||
|
||
<a id="nestedatt--tcp"></a> | ||
### Nested Schema for `tcp` | ||
|
||
Required: | ||
|
||
- `host` (String) The host to monitor; it can be an IP address or a hostname. The host can include the port using a colon (e.g., "example.com:9200"). | ||
|
||
Optional: | ||
|
||
- `check_receive` (String) The expected answer. | ||
- `check_send` (String) An optional payload string to send to the remote host. | ||
- `proxy_url` (String) The URL of the SOCKS5 proxy to use when connecting to the server. The value must be a URL with a scheme of `socks5://`. If the SOCKS5 proxy server requires client authentication, then a username and password can be embedded in the URL. When using a proxy, hostnames are resolved on the proxy server instead of on the client. You can change this behavior by setting the `proxy_use_local_resolver` option. | ||
- `proxy_use_local_resolver` (Boolean) A Boolean value that determines whether hostnames are resolved locally instead of being resolved on the proxy server. The default value is false, which means that name resolution occurs on the proxy server. | ||
- `ssl_supported_protocols` (List of String) List of allowed SSL/TLS versions. | ||
- `ssl_verification_mode` (String) Controls the verification of server certificates. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
terraform import elasticstack_kibana_synthetics_monitor.my_monitor <space id>/<monitor_id> | ||
``` | ||
|
||
**NOTE:** Not all monitor fields are supported during the import due-to API limitation. | ||
Full field support could be implemented after this [kibana issue](https://github.com/elastic/kibana/issues/189906) is resolved. | ||
|
||
Currently not supported fields during the import: `params`, `retest_on_failure`, `http.proxy_header`, `http.username`, `http.password`, `http.check`, `http.response`, `tcp.check_send`, `tcp.check_receive` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
examples/resources/elasticstack_kibana_synthetics_monitor/import.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
terraform import elasticstack_kibana_synthetics_monitor.my_monitor <space id>/<monitor_id> |
31 changes: 31 additions & 0 deletions
31
examples/resources/elasticstack_kibana_synthetics_monitor/resource.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
provider "elasticstack" { | ||
kibana {} | ||
} | ||
|
||
resource "elasticstack_kibana_synthetics_monitor" "my_monitor" { | ||
name = "Example http monitor" | ||
space_id = "default" | ||
schedule = 10 | ||
locations = ["us_west"] | ||
enabled = false | ||
tags = ["tag"] | ||
alert = { | ||
status = { | ||
enabled = true | ||
} | ||
tls = { | ||
enabled = false | ||
} | ||
} | ||
service_name = "example apm service" | ||
timeout = 30 | ||
http = { | ||
url = "http://localhost:8080" | ||
ssl_verification_mode = "full" | ||
ssl_supported_protocols = ["TLSv1.2"] | ||
max_redirects = "10" | ||
mode = "all" | ||
ipv4 = true | ||
ipv6 = true | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
examples/resources/elasticstack_kibana_synthetics_private_location/import.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
terraform import elasticstack_kibana_synthetics_private_location.my_location <private_location_id> | ||
terraform import elasticstack_kibana_synthetics_private_location.my_location <space id>/<private_location_id> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.