-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathmatomo.jenkins.io.tf
44 lines (42 loc) · 1.67 KB
/
matomo.jenkins.io.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## Matomo Resources
# Database - ref. https://matomo.org/faq/how-to-install/faq_23484/
resource "mysql_database" "matomo" {
name = "matomo"
}
resource "random_password" "matomo_mysql_password" {
length = 81
lower = true
min_lower = 1
min_numeric = 1
min_special = 1
min_upper = 1
numeric = true
override_special = "_"
special = true
upper = true
}
resource "mysql_user" "matomo" {
user = "matomo"
host = "*" # Default "localhost" forbids access from clusters
plaintext_password = random_password.matomo_mysql_password.result
}
resource "mysql_grant" "matomo" {
user = mysql_user.matomo.user
host = mysql_user.matomo.host
database = mysql_database.matomo.name
privileges = ["SELECT", "INSERT", "UPDATE", "DELETE", "CREATE", "INDEX", "DROP", "ALTER", "CREATE TEMPORARY TABLES", "LOCK TABLES"]
}
# This (sensitive) output is meant to be encrypted into the production secret system, to be provided as a secret to the matomo application
output "matomo_dbconfig" {
# Value of the port is fixed to 3306 (https://learn.microsoft.com/en-us/azure/mysql/flexible-server/concepts-networking and https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mysql_flexible_server#attributes-reference)
sensitive = true
description = "YAML (secret) values for the Helm chart bitnami/matomo"
value = <<-EOT
externalDatabase:
host: ${azurerm_mysql_flexible_server.public_db_mysql.fqdn}
port: 3306
database: ${mysql_database.matomo.name}
user: ${mysql_user.matomo.user}
password: ${random_password.matomo_mysql_password.result}
EOT
}