-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from t0mmili/feature/6-update-tools-and-refacto…
…r-terraform feature/6-update-tools-and-refactor-terraform
- Loading branch information
Showing
16 changed files
with
75 additions
and
33 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
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
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
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,10 @@ | ||
check "grafana_health_check" { | ||
data "http" "grafana" { | ||
url = var.grafana_url | ||
} | ||
|
||
assert { | ||
condition = data.http.grafana.status_code == 200 | ||
error_message = "${data.http.grafana.url} returned an unhealthy status code" | ||
} | ||
} |
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,16 +1,17 @@ | ||
provider "grafana" { | ||
url = var.grafana_url | ||
auth = var.grafana_auth | ||
auth = var.grafana_auth | ||
retries = 3 | ||
url = var.grafana_url | ||
} | ||
|
||
data "grafana_folders" "all" {} | ||
data "grafana_folders" "this" {} | ||
|
||
data "grafana_dashboards" "from_folder_ids" { | ||
folder_ids = concat(data.grafana_folders.all.folders[*].id, [0]) | ||
data "grafana_dashboards" "this" { | ||
folder_ids = concat(data.grafana_folders.this.folders[*].id, [0]) | ||
} | ||
|
||
data "grafana_dashboard" "from_dashboard_uids" { | ||
count = length(data.grafana_dashboards.from_folder_ids.dashboards[*].uid) | ||
data "grafana_dashboard" "this" { | ||
count = length(data.grafana_dashboards.this.dashboards[*].uid) | ||
|
||
uid = element(data.grafana_dashboards.from_folder_ids.dashboards[*].uid, count.index) | ||
uid = element(data.grafana_dashboards.this.dashboards[*].uid, count.index) | ||
} |
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,12 +1,12 @@ | ||
output "grafana_folders_titles" { | ||
description = "List of Grafana folders" | ||
value = concat(data.grafana_folders.all.folders[*].title, ["General"]) | ||
value = concat(data.grafana_folders.this.folders[*].title, ["General"]) | ||
} | ||
|
||
output "grafana_dashboards" { | ||
description = "Complete dashboards models with corresponding titles" | ||
value = { | ||
title = data.grafana_dashboards.from_folder_ids.dashboards[*].title | ||
config = data.grafana_dashboard.from_dashboard_uids[*].config_json | ||
title = data.grafana_dashboards.this.dashboards[*].title | ||
config = data.grafana_dashboard.this[*].config_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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
variable "grafana_auth" { | ||
description = "Grafana authentication. Can be api key or basic auth." | ||
type = string | ||
sensitive = true | ||
default = null | ||
} | ||
|
||
variable "grafana_url" { | ||
description = "Grafana instance url" | ||
type = string | ||
default = null | ||
} |
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,4 +1,6 @@ | ||
terraform { | ||
required_version = ">= 1.5" | ||
|
||
required_providers { | ||
grafana = { | ||
source = "grafana/grafana" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
check "grafana_health_check" { | ||
data "http" "grafana" { | ||
url = var.grafana_url | ||
} | ||
|
||
assert { | ||
condition = data.http.grafana.status_code == 200 | ||
error_message = "${data.http.grafana.url} returned an unhealthy status code" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
output "grafana_dashboards" { | ||
description = "Imported dashboards information" | ||
value = { | ||
dashboard_id = grafana_dashboard.from_json[*].dashboard_id | ||
url = grafana_dashboard.from_json[*].url | ||
version = grafana_dashboard.from_json[*].version | ||
dashboard_id = grafana_dashboard.this[*].dashboard_id | ||
url = grafana_dashboard.this[*].url | ||
version = grafana_dashboard.this[*].version | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
terraform { | ||
required_version = ">= 1.5" | ||
|
||
required_providers { | ||
grafana = { | ||
source = "grafana/grafana" | ||
|