Compare commits

..

No commits in common. "main" and "multiple_dbs_per_psql_instance" have entirely different histories.

14 changed files with 44 additions and 45 deletions

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.61.0"
}
}
}

View file

@ -1,6 +1,5 @@
resource "grafana_contact_point" "this" {
name = var.contact_point_name
disable_provenance = true
googlechat {
url = var.gchat_url

View file

@ -1,7 +1,6 @@
resource "grafana_notification_policy" "this" {
contact_point = var.default_contact_point_uid
group_by = var.group_by
disable_provenance = true
dynamic "policy" {
for_each = var.folder_policies

View file

@ -19,3 +19,30 @@ resource "stackit_mongodbflex_user" "this" {
roles = var.mongodb_user_roles
database = var.mongodb_user_database
}
# // Configure Secret Manager Provider
# provider "vault" {
# address = "https://prod.sm.eu01.stackit.cloud"
# skip_child_token = true
# auth_login_userpass {
# username = var.secret_manager_username
# password = var.secret_manager_password
# }
# }
# // Store MongoDB Credentials in Secret Manager
# resource "vault_kv_secret_v2" "mongodb_cred_save" {
# mount = var.secret_manager_instance_id
# name = var.mongodb_secrets_path
# cas = 1
# delete_all_versions = true
# data_json = jsonencode(
# {
# username = stackit_mongodbflex_user.mongodb_user.username,
# password = stackit_mongodbflex_user.mongodb_user.password,
# host = stackit_mongodbflex_user.mongodb_user.host,
# port = stackit_mongodbflex_user.mongodb_user.port,
# uri = stackit_mongodbflex_user.mongodb_user.uri
# }
# )
# }

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.50.0"
}
}
}

View file

@ -30,9 +30,7 @@ variable "mongodb_instance_flavor" {
variable "mongodb_instance_options" {
description = "options for mongodb"
type = object({
type = string
snapshot_retention_days = number
point_in_time_window_hours = number
type = string
})
}

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.50.0"
}
}
}

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.50.0"
}
grafana = {
source = "grafana/grafana"

View file

@ -3,14 +3,6 @@ output "postgres_instance_id" {
value = stackit_postgresflex_instance.this.instance_id
}
locals {
# Build a map: username => db_name
user_to_db = {
for db in var.postgres_databases :
db.user_name => db.db_name
}
}
# Postgres Credential Output
output "postgres_credentials" {
value = {
@ -20,9 +12,9 @@ output "postgres_credentials" {
username = u.username
password = u.password
port = u.port
db_name = stackit_postgresflex_database.this[local.user_to_db[u.username]].name
db_name = stackit_postgresflex_database.this[u.username].name
uri = u.uri
}
}
sensitive = true
}
}

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.50.0"
}
}
}

View file

@ -55,26 +55,10 @@ variable "postgres_instance_region" {
# Postgres User and DB Configs
variable "postgres_databases" {
description = "list of users and databases"
type = list(object({
db_name = string # db name inside the instance
user_name = string # username and owner for postgres db
user_roles = list(string) # List of database access levels for the user. Supported values are: login, createdb.
description = "list of users and databases"
type = list(object({
db_name = string # db name inside the instance
user_name = string # username and owner for postgres db
user_roles = list(string) # List of database access levels for the user. Supported values are: login, createdb.
}))
# -----------------------------------------------------------------
# Validation: each db_name must be unique
# -----------------------------------------------------------------
validation {
condition = length(distinct([for db in var.postgres_databases : db.db_name])) == length(var.postgres_databases)
error_message = "Each db_name must be unique."
}
# -----------------------------------------------------------------
# Validation: each user_name must be unique
# -----------------------------------------------------------------
validation {
condition = length(distinct([for db in var.postgres_databases : db.user_name])) == length(var.postgres_databases)
error_message = "Each user_name must be unique."
}
}
}

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.50.0"
}
}
}

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.50.0"
}
}

View file

@ -2,7 +2,7 @@ terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "~> 0.68.0"
version = "~> 0.62.0"
}
}
}