fix for new structure with nested resources inside project
This commit is contained in:
parent
6dcbef56e6
commit
8ec98bf1da
2 changed files with 33 additions and 3 deletions
|
|
@ -18,7 +18,7 @@ resource "stackit_postgresflex_user" "user" {
|
||||||
count = local.user_count
|
count = local.user_count
|
||||||
|
|
||||||
project_id = var.project_id
|
project_id = var.project_id
|
||||||
instance_id = stackit_postgresflex_instance.this.instance_id
|
instance_id = var.instance_id != "" ? var.instance_id : stackit_postgresflex_instance.this.instance_id
|
||||||
username = var.users[count.index].username
|
username = var.users[count.index].username
|
||||||
roles = var.users[count.index].roles
|
roles = var.users[count.index].roles
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,21 @@ variable "project_id" {
|
||||||
|
|
||||||
variable "name" {
|
variable "name" {
|
||||||
type = string
|
type = string
|
||||||
|
|
||||||
|
validation {
|
||||||
|
condition = length(regexall("^[a-z]([-a-z0-9]*[a-z0-9])?$", var.name)) > 0
|
||||||
|
error_message = <<EOT
|
||||||
|
The name must be a valid DNS-1035 label:
|
||||||
|
- only lower-case letters, digits or '-'
|
||||||
|
- must start with a letter
|
||||||
|
- must end with a letter or digit
|
||||||
|
EOT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "instance_id" {
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "ver" {
|
variable "ver" {
|
||||||
|
|
@ -38,19 +53,34 @@ variable "backup_schedule" {
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "users" {
|
variable "users" {
|
||||||
description = "List of users"
|
|
||||||
type = list(object({
|
type = list(object({
|
||||||
username = string
|
username = string
|
||||||
roles = set(string)
|
roles = set(string)
|
||||||
}))
|
}))
|
||||||
default = []
|
default = []
|
||||||
|
validation {
|
||||||
|
condition = alltrue([
|
||||||
|
for user in var.users : user.username != "admin"
|
||||||
|
])
|
||||||
|
error_message = "The username 'admin' is reserved and cannot be used."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "databases" {
|
variable "databases" {
|
||||||
description = "List of databases"
|
|
||||||
type = list(object({
|
type = list(object({
|
||||||
name = string
|
name = string
|
||||||
owner = string
|
owner = string
|
||||||
}))
|
}))
|
||||||
default = []
|
default = []
|
||||||
|
validation {
|
||||||
|
condition = alltrue([
|
||||||
|
for db in var.databases : length(regexall("^[a-z]([-a-z0-9]*[a-z0-9])?$", db.name)) > 0
|
||||||
|
])
|
||||||
|
error_message = <<EOT
|
||||||
|
The name must be a valid DNS-1035 label:
|
||||||
|
- only lower-case letters, digits or '-'
|
||||||
|
- must start with a letter
|
||||||
|
- must end with a letter or digit
|
||||||
|
EOT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue