generated from pagopa/terraform-infrastructure-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
271 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -5,6 +5,15 @@ resource "ec_organization" "pagopa_ec_org" { | |
}, | ||
"[email protected]" = { | ||
organization_role = "organization-admin" | ||
}, | ||
"[email protected]" = { | ||
organization_role = "organization-admin" | ||
}, | ||
"[email protected]" = { | ||
organization_role = "organization-admin" | ||
}, | ||
"[email protected]" = { | ||
organization_role = "organization-admin" | ||
} | ||
} | ||
|
||
|
17 changes: 16 additions & 1 deletion
17
src/elastic-cloud/05_elstic_resources_app/02_application.tf
This file contains 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,7 +1,22 @@ | ||
resource "elasticstack_kibana_space" "kibana_space" { | ||
for_each = local.spaces | ||
space_id = "${each.value}-${var.env}" | ||
name = "${each.value}-${var.env}" | ||
description = "Space for ${each.value}-${var.env}" | ||
disabled_features = [] | ||
} | ||
|
||
|
||
module "app_resources" { | ||
source = "./tf_module" | ||
for_each = local.configurations | ||
|
||
configuration = each.value | ||
configuration = each.value.conf | ||
default_snapshot_policy_name = var.default_snapshot_policy_name | ||
env = var.env | ||
space_id = elasticstack_kibana_space.kibana_space[each.value.space_name].id | ||
dashboard_folder = each.value.dashboard_folder | ||
} | ||
|
||
|
||
|
This file contains 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,9 +1,17 @@ | ||
locals { | ||
prefix = "pagopa" | ||
config_files = fileset(path.module, "config/*.json" ) | ||
configurations ={ for f in local.config_files : basename(f) => jsondecode(templatefile(f, { | ||
env = var.env | ||
env_separator = "${var.env}-" | ||
wait_for_snapshot = var.lifecycle_policy_wait_for_snapshot | ||
}))} | ||
prefix = "pagopa" | ||
config_folder_name = "config" | ||
config_files = fileset(path.module, "${local.config_folder_name}/*/*.json") | ||
configurations = { | ||
for f in local.config_files : basename(f) => { | ||
conf = jsondecode(templatefile(f, { | ||
env = var.env | ||
env_separator = "${var.env}-" | ||
wait_for_snapshot = var.lifecycle_policy_wait_for_snapshot | ||
})) | ||
space_name = substr(dirname(f), length("${local.config_folder_name}/"), -1) | ||
dashboard_folder = "${dirname(f)}/dashboards" | ||
} | ||
} | ||
spaces = { for f in local.config_files : substr(dirname(f), length("${local.config_folder_name}/"), -1) => substr(dirname(f), length("${local.config_folder_name}/"), -1)} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/elastic-cloud/05_elstic_resources_app/config/README.md
This file contains 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,21 @@ | ||
# kibana space configuration | ||
|
||
|
||
|
||
this folder contains the kibana spaces, indexes and data stream configuration for every application. | ||
|
||
|
||
folder structure: | ||
|
||
```commandline | ||
├── ndp //determines the name of the kibana space | ||
│ └── nodo.json // resources and visualizations associated with the above space | ||
└── printit // another kibana space | ||
├── dashboards // dashboard for this application | ||
│ └── dashboard_massive.ndjson | ||
└── printit.json | ||
``` | ||
|
||
|
||
Define a new json file containing all the required information to allow the creation of a space and all required resource to manage the logs of an application. | ||
The file name must match |
169 changes: 169 additions & 0 deletions
169
src/elastic-cloud/05_elstic_resources_app/config/ndp/nodo.json
This file contains 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,169 @@ | ||
{ | ||
"id": "nodo", | ||
"displayName": "Nodo dei Pagamenti ${env}", | ||
"ingestPipeline": { | ||
"processors": [ | ||
{ | ||
"json": { | ||
"field": "message", | ||
"target_field": "json_message", | ||
"on_failure" : [ | ||
{ | ||
"set" : { | ||
"field" : "error-info.message", | ||
"value" : "Field 'message' is not a json format and not create 'json_message" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"description": "Record error detail", | ||
"field": "error-info.message-detail", | ||
"value": "Processor {{ _ingest.on_failure_processor_type }} with tag {{ _ingest.on_failure_processor_tag }} in pipeline {{ _ingest.on_failure_pipeline }} failed with message {{ _ingest.on_failure_message }}" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"field": "app", | ||
"copy_from": "json_message.app", | ||
"ignore_failure": true, | ||
"on_failure" : [ | ||
{ | ||
"set" : { | ||
"field" : "error-info.app", | ||
"value" : "Field 'json_message.app' not found" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"description": "Record error detail", | ||
"field": "error-info.app-detail", | ||
"value": "Processor {{ _ingest.on_failure_processor_type }} with tag {{ _ingest.on_failure_processor_tag }} in pipeline {{ _ingest.on_failure_pipeline }} failed with message {{ _ingest.on_failure_message }}" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"if": "ctx.app?.reJsonLog != 'true'", | ||
"field": "message", | ||
"copy_from": "json_message.message", | ||
"ignore_failure": true, | ||
"on_failure" : [ | ||
{ | ||
"set" : { | ||
"field" : "error-info.message", | ||
"value" : "Field 'json_message.message' not found" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"description": "Record error detail", | ||
"field": "error-info.message-detail", | ||
"value": "Processor {{ _ingest.on_failure_processor_type }} with tag {{ _ingest.on_failure_processor_tag }} in pipeline {{ _ingest.on_failure_pipeline }} failed with message {{ _ingest.on_failure_message }}" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"json": { | ||
"if": "ctx.app?.reJsonLog == 'true'", | ||
"field": "json_message.message", | ||
"target_field": "re", | ||
"on_failure" : [ | ||
{ | ||
"set" : { | ||
"field" : "error-re-info.message", | ||
"value" : "Field 'json_message.message' is not a json format and not create 're" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"description": "Record error detail", | ||
"field": "error-re-info.message-detail", | ||
"value": "Processor {{ _ingest.on_failure_processor_type }} with tag {{ _ingest.on_failure_processor_tag }} in pipeline {{ _ingest.on_failure_pipeline }} failed with message {{ _ingest.on_failure_message }}" | ||
} | ||
}, | ||
{ | ||
"remove": { | ||
"field": "json_message", | ||
"ignore_missing": true | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"if": "ctx.app?.reJsonLog == 'true'", | ||
"field": "message", | ||
"copy_from": "re.internalMessage", | ||
"ignore_failure": true, | ||
"on_failure" : [ | ||
{ | ||
"set" : { | ||
"field" : "error-re-internalMessage-info.message", | ||
"value" : "Field 're.internalMessage' not found" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"description": "Record error detail", | ||
"field": "error-re-internalMessage-info.message-detail", | ||
"value": "Processor {{ _ingest.on_failure_processor_type }} with tag {{ _ingest.on_failure_processor_tag }} in pipeline {{ _ingest.on_failure_pipeline }} failed with message {{ _ingest.on_failure_message }}" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"drop": { | ||
"if": "ctx.app?.reXmlLog == 'true'" | ||
} | ||
}, | ||
{ | ||
"remove": { | ||
"field": "json_message", | ||
"ignore_missing": true | ||
} | ||
} | ||
] | ||
}, | ||
"ilm": { | ||
"hot": { | ||
"minAge": "0m", | ||
"rollover": { | ||
"maxPrimarySize": "50gb", | ||
"maxAge": "2d" | ||
} | ||
}, | ||
"warm": { | ||
"minAge": "2d", | ||
"setPriority": 50 | ||
}, | ||
"cold": { | ||
"minAge": "4d", | ||
"setPriority": 0 | ||
}, | ||
"delete": { | ||
"minAge": "7d", | ||
"deleteSearchableSnapshot": true, | ||
"waitForSnapshot": ${wait_for_snapshot} | ||
} | ||
}, | ||
"indexTemplate": { | ||
"indexPattern" : "logs-${env_separator}print-payment-*" | ||
}, | ||
"dataStream": [ | ||
"logs-${env_separator}print-payment-notice-service-default", | ||
"logs-${env_separator}print-payment-notice-generator-default", | ||
"logs-${env_separator}print-payment-notice-functions-default" | ||
], | ||
"dataView": { | ||
"indexIdentifier": "${env_separator}print-payment" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/elastic-cloud/05_elstic_resources_app/config/printit/dashboards/dashboard_massive.ndjson
Large diffs are not rendered by default.
Oops, something went wrong.
5 changes: 1 addition & 4 deletions
5
..._elstic_resources_app/config/printit.json → ...resources_app/config/printit/printit.json
This file contains 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
5 changes: 5 additions & 0 deletions
5
src/elastic-cloud/05_elstic_resources_app/tf_module/local_defaults.tf
This file contains 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,5 @@ | ||
locals { | ||
default_ilm = { | ||
|
||
} | ||
} |
This file contains 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 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