|
| 1 | +--- |
| 2 | +subcategory: "Kibana" |
| 3 | +layout: "" |
| 4 | +page_title: "Elasticstack: elasticstack_kibana_synthetics_monitor Resource" |
| 5 | +description: |- |
| 6 | + Creates or updates a Kibana synthetics monitor. |
| 7 | +--- |
| 8 | + |
| 9 | +# Resource: elasticstack_kibana_synthetics_monitor |
| 10 | + |
| 11 | +Creates or updates a Kibana synthetics monitor. |
| 12 | +See [API docs](https://www.elastic.co/guide/en/kibana/current/add-monitor-api.html) |
| 13 | + |
| 14 | +## Supported monitor types |
| 15 | + * `http` |
| 16 | + * `tcp` |
| 17 | + |
| 18 | +**NOTE:** Due-to nature of partial update API, reset values to defaults is not supported. |
| 19 | +In case you would like to reset an optional monitor value, please set it explicitly or delete and create new monitor. |
| 20 | + |
| 21 | + |
| 22 | +## Example Usage |
| 23 | + |
| 24 | +```terraform |
| 25 | +provider "elasticstack" { |
| 26 | + kibana {} |
| 27 | +} |
| 28 | +
|
| 29 | +resource "elasticstack_kibana_synthetics_monitor" "my_monitor" { |
| 30 | + name = "Example http monitor" |
| 31 | + space_id = "default" |
| 32 | + schedule = 10 |
| 33 | + locations = ["us_west"] |
| 34 | + enabled = false |
| 35 | + tags = ["tag"] |
| 36 | + alert = { |
| 37 | + status = { |
| 38 | + enabled = true |
| 39 | + } |
| 40 | + tls = { |
| 41 | + enabled = false |
| 42 | + } |
| 43 | + } |
| 44 | + service_name = "example apm service" |
| 45 | + timeout = 30 |
| 46 | + http = { |
| 47 | + url = "http://localhost:8080" |
| 48 | + ssl_verification_mode = "full" |
| 49 | + ssl_supported_protocols = ["TLSv1.2"] |
| 50 | + max_redirects = "10" |
| 51 | + mode = "all" |
| 52 | + ipv4 = true |
| 53 | + ipv6 = true |
| 54 | + } |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +<!-- schema generated by tfplugindocs --> |
| 59 | +## Schema |
| 60 | + |
| 61 | +### Required |
| 62 | + |
| 63 | +- `name` (String) The monitor’s name. |
| 64 | + |
| 65 | +### Optional |
| 66 | + |
| 67 | +- `alert` (Attributes) Alert configuration. Default: `{ status: { enabled: true }, tls: { enabled: true } }`. (see [below for nested schema](#nestedatt--alert)) |
| 68 | +- `enabled` (Boolean) Whether the monitor is enabled. Default: `true` |
| 69 | +- `http` (Attributes) HTTP Monitor specific fields (see [below for nested schema](#nestedatt--http)) |
| 70 | +- `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. |
| 71 | +- `params` (String) Monitor parameters. Raw JSON object, use `jsonencode` function to represent JSON |
| 72 | +- `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. |
| 73 | +- `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`. |
| 74 | +- `schedule` (Number) The monitor’s schedule in minutes. Supported values are 1, 3, 5, 10, 15, 30, 60, 120 and 240. |
| 75 | +- `service_name` (String) The APM service name. |
| 76 | +- `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` |
| 77 | +- `tags` (List of String) An array of tags. |
| 78 | +- `tcp` (Attributes) TCP Monitor specific fields (see [below for nested schema](#nestedatt--tcp)) |
| 79 | +- `timeout` (Number) The monitor timeout in seconds, monitor will fail if it doesn’t complete within this time. Default: `16` |
| 80 | + |
| 81 | +### Read-Only |
| 82 | + |
| 83 | +- `id` (String) Generated identifier for the monitor |
| 84 | + |
| 85 | +<a id="nestedatt--alert"></a> |
| 86 | +### Nested Schema for `alert` |
| 87 | + |
| 88 | +Optional: |
| 89 | + |
| 90 | +- `status` (Attributes) (see [below for nested schema](#nestedatt--alert--status)) |
| 91 | +- `tls` (Attributes) (see [below for nested schema](#nestedatt--alert--tls)) |
| 92 | + |
| 93 | +<a id="nestedatt--alert--status"></a> |
| 94 | +### Nested Schema for `alert.status` |
| 95 | + |
| 96 | +Optional: |
| 97 | + |
| 98 | +- `enabled` (Boolean) |
| 99 | + |
| 100 | + |
| 101 | +<a id="nestedatt--alert--tls"></a> |
| 102 | +### Nested Schema for `alert.tls` |
| 103 | + |
| 104 | +Optional: |
| 105 | + |
| 106 | +- `enabled` (Boolean) |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +<a id="nestedatt--http"></a> |
| 111 | +### Nested Schema for `http` |
| 112 | + |
| 113 | +Required: |
| 114 | + |
| 115 | +- `url` (String) URL to monitor. |
| 116 | + |
| 117 | +Optional: |
| 118 | + |
| 119 | +- `check` (String) The check request settings.. Raw JSON object, use `jsonencode` function to represent JSON |
| 120 | +- `ipv4` (Boolean) Whether to ping using the ipv4 protocol. |
| 121 | +- `ipv6` (Boolean) Whether to ping using the ipv6 protocol. |
| 122 | +- `max_redirects` (Number) The maximum number of redirects to follow. Default: `0` |
| 123 | +- `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. |
| 124 | +- `password` (String) The password for authenticating with the server. The credentials are passed with the request. |
| 125 | +- `proxy_header` (String) Additional headers to send to proxies during CONNECT requests.. Raw JSON object, use `jsonencode` function to represent JSON |
| 126 | +- `proxy_url` (String) The URL of the proxy to use for this monitor. |
| 127 | +- `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 |
| 128 | +- `ssl_supported_protocols` (List of String) List of allowed SSL/TLS versions. |
| 129 | +- `ssl_verification_mode` (String) Controls the verification of server certificates. |
| 130 | +- `username` (String) The username for authenticating with the server. The credentials are passed with the request. |
| 131 | + |
| 132 | + |
| 133 | +<a id="nestedatt--tcp"></a> |
| 134 | +### Nested Schema for `tcp` |
| 135 | + |
| 136 | +Required: |
| 137 | + |
| 138 | +- `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"). |
| 139 | + |
| 140 | +Optional: |
| 141 | + |
| 142 | +- `check_receive` (String) The expected answer. |
| 143 | +- `check_send` (String) An optional payload string to send to the remote host. |
| 144 | +- `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. |
| 145 | +- `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. |
| 146 | +- `ssl_supported_protocols` (List of String) List of allowed SSL/TLS versions. |
| 147 | +- `ssl_verification_mode` (String) Controls the verification of server certificates. |
| 148 | + |
| 149 | +## Import |
| 150 | + |
| 151 | +Import is supported using the following syntax: |
| 152 | + |
| 153 | +```shell |
| 154 | +terraform import elasticstack_kibana_synthetics_monitor.my_monitor <space id>/<monitor_id> |
| 155 | +``` |
| 156 | + |
| 157 | +**NOTE:** Not all monitor fields are supported during the import due-to API limitation. |
| 158 | +Full field support could be implemented after this [kibana issue](https://github.com/elastic/kibana/issues/189906) is resolved. |
| 159 | + |
| 160 | +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` |
0 commit comments