Skip to content

Commit d427670

Browse files
authored
Fix example in readme to reflect code
Fixes #2
1 parent 70a3502 commit d427670

File tree

1 file changed

+47
-18
lines changed

1 file changed

+47
-18
lines changed

README.md

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ See [the docs for more information](https://www.terraform.io/docs/plugins/basics
1818

1919
## Usage
2020

21-
```
21+
```tf
2222
provider "elasticsearch" {
2323
url = "https://search-foo-bar-pqrhr4w3u4dzervg41frow4mmy.us-east-1.es.amazonaws.com" # Don't include port at the end for aws
2424
aws_access_key = ""
@@ -28,26 +28,55 @@ provider "elasticsearch" {
2828
2929
resource "elasticsearch_index_template" "test" {
3030
name = "terraform-test"
31-
template = "tf-*"
32-
order = 1
33-
34-
settings {
35-
index.number_of_shards = 5
36-
}
37-
38-
mapping {
39-
type = "reports"
40-
41-
date_property {
42-
name = "created_at"
43-
format = "EEE MMM dd HH:mm:ss Z YYYY"
44-
}
45-
46-
keyword_property {
47-
name = "subject"
31+
body = <<EOF
32+
{
33+
"template": "logstash-*",
34+
"version": 50001,
35+
"settings": {
36+
"index.refresh_interval": "5s"
37+
},
38+
"mappings": {
39+
"_default_": {
40+
"_all": {"enabled": true, "norms": false},
41+
"dynamic_templates": [ {
42+
"message_field": {
43+
"path_match": "message",
44+
"match_mapping_type": "string",
45+
"mapping": {
46+
"type": "text",
47+
"norms": false
48+
}
49+
}
50+
}, {
51+
"string_fields": {
52+
"match": "*",
53+
"match_mapping_type": "string",
54+
"mapping": {
55+
"type": "text", "norms": false,
56+
"fields": {
57+
"keyword": { "type": "keyword" }
58+
}
59+
}
60+
}
61+
} ],
62+
"properties": {
63+
"@timestamp": { "type": "date", "include_in_all": false },
64+
"@version": { "type": "keyword", "include_in_all": false },
65+
"geoip" : {
66+
"dynamic": true,
67+
"properties": {
68+
"ip": { "type": "ip" },
69+
"location": { "type": "geo_point" },
70+
"latitude": { "type": "half_float" },
71+
"longitude": { "type": "half_float" }
72+
}
73+
}
74+
}
4875
}
4976
}
5077
}
78+
EOF
79+
}
5180
5281
# A saved search, visualization or dashboard
5382
resource "elasticsearch_kibana_object" "test_dashboard" {

0 commit comments

Comments
 (0)