Generate 6 digit number that does not contain digit 0

I have this resource that should generate a number that does not contain digit 0:

resource "random_string" "digits_without_zero" {
  for_each = {
    for user in local.new_users : user.key => user.department
  }
  length            = 6
  special           = false
  lower             = false
  upper             = false
  override_special  = "123456789"
}

In most cases, I get a digit that does not contain digit 0 but in some cases I get 6 digit number that has digit 0. I tried with random integer but also no luck.
Do you know a way in which i can generate a number that does not contain digit 0?

have you tried random integer with

min = 1
max = 9

Yes, It does not support length and when defining range “min = 100000 max = 999999” it will include the digit 0.

Hi @Johny,

If you want to only use the given special characters, then you need to also set numeric = false in the configuration. You don’t want characters form the standard numeric digits, you only want characters from override_special.