diff --git a/main.tf b/main.tf index ca6ea16..c80e1ef 100644 --- a/main.tf +++ b/main.tf @@ -20,13 +20,13 @@ resource "snowflake_grant_database_role" "parent_database_role" { count = module.this.enabled && var.parent_database_role != null ? 1 : 0 database_role_name = local.database_role_name - parent_database_role_name = var.parent_database_role + parent_database_role_name = "${one(snowflake_database_role.this[*].database)}.${var.parent_database_role}" } resource "snowflake_grant_database_role" "granted_database_roles" { for_each = toset(module.this.enabled ? var.granted_database_roles : []) - database_role_name = each.value + database_role_name = each.value != null ? "${one(snowflake_database_role.this[*].database)}.${each.value}" : null parent_database_role_name = local.database_role_name }