scaleway/scaleway-sdk-go

RDB Username max length diffrent of documentation

Closed this issue · 3 comments

Hi!
I tried to create a RDB Instance and set a user_name of 62 chars following the documentation.
I checked the code and found this comment that match the documentation:

// Name: name of the user (Length must be between 1 and 63 characters, First character must be an alphabet character (a-zA-Z), Your Username cannot start with '_rdb', Only a-zA-Z0-9_$- characters are accepted)

But terraform apply return this:

Error: scaleway-sdk-go: invalid argument(s): user_name does not respect constraint, user_name length must be between 1 and 32

Scaleway-sdk-go version: v2.2.0
Go version: go1.17.6
GOOS: darwin
GOARCH: amd64

Hello, could you paste the smallest terraform snippet that reproduces your issue?

Here is it:

database.tf

variable "scw_database" {
  type = map(object ({
    node_type                 = string
    engine                    = string
    is_ha_cluster             = bool
    disable_backup            = bool
    user_name                 = string
    password                  = string
    backup_schedule_frequency = number
    backup_schedule_retention = number
    region                    = string
    tags                      = list(string)
    volume_type               = string
    volume_size_in_gb         = number
    private_network           = object({
      gateway_dhcp  = object({
        subnet = string
      })
      ip_net        = string
    })
  }))
}

resource "scaleway_vpc_private_network" "rdb_private_networks" {
  for_each = var.scw_database

  name = each.key
}

resource "scaleway_rdb_instance" "rdb_databases" {
  for_each = var.scw_database

  name                      = each.key
  node_type                 = each.value.node_type
  engine                    = each.value.engine
  is_ha_cluster             = each.value.is_ha_cluster
  disable_backup            = each.value.disable_backup
  user_name                 = each.value.user_name
  password                  = each.value.password
  backup_schedule_frequency = each.value.backup_schedule_frequency
  backup_schedule_retention = each.value.backup_schedule_retention 
  region                    = each.value.region
  tags                      = each.value.tags
  volume_type               = each.value.volume_type
  volume_size_in_gb         = each.value.volume_size_in_gb
  private_network {
    ip_net = each.value.private_network.ip_net
    pn_id = "${scaleway_vpc_private_network.rdb_private_networks[each.key].id}"
  }
}

rdb.tfvars:

scw_database = {
  "public_database" = {
    node_type                 = "db-gp-xs"
    engine                    = "MySQL-8"
    is_ha_cluster             = true
    disable_backup            = false
    user_name                 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    password                  = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    backup_schedule_frequency = 24
    backup_schedule_retention = 15
    region                    = "fr-par"
    tags                      = ["public"]
    volume_type               = "bssd"
    volume_size_in_gb         = 50
    private_network           = {
      gateway_dhcp  = {
        subnet = "192.168.1.0/24"
      }
      ip_net        = "192.168.1.254/24"
    }
  }
}

Fixed on 1546. This was a documentation issue