Skip to content

Cannot create scaleway_rdb_privilege resource #2982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gmile opened this issue Mar 14, 2025 · 1 comment
Open

Cannot create scaleway_rdb_privilege resource #2982

gmile opened this issue Mar 14, 2025 · 1 comment
Assignees
Labels
rdb Managed MySQL and PostgreSQL issues, bugs and feature requests

Comments

@gmile
Copy link

gmile commented Mar 14, 2025

Terraform Version

$ terraform version
Terraform v1.11.1
on darwin_arm64

Affected Resource(s)

  • scaleway_rdb_privilege

Terraform Configuration Files

Create database and user:

resource "random_pet" "db_master_name" {
  length = 2
  prefix = var.environment
}

resource "random_password" "db_master_password" {
  length = 32
}

resource "scaleway_rdb_database" "api" {
  instance_id = scaleway_rdb_instance.instance_v2.id
  name        = var.environment
}

resource "scaleway_rdb_user" "api" {
  instance_id = scaleway_rdb_instance.instance_v2.id
  name        = "${var.environment}-user"
  password    = random_password.db_password.result
}

resource "scaleway_rdb_instance" "instance_v2" {
  name           = random_pet.db_master_name.id
  node_type      = "db-dev-m"
  engine         = "PostgreSQL-16"
  user_name      = "master_user"
  password       = random_password.db_master_password.result
  volume_type    = "bssd"
}

# resource "scaleway_rdb_privilege" "api" {
#  instance_id   = scaleway_rdb_instance.instance_v2.id
#  user_name     = scaleway_rdb_user.api.name
#  database_name = scaleway_rdb_database.api.name
#  permission    = "all"
# }

Expected Behavior

A privilege is created.

Actual Behavior

A privilege is not created. Instead, and error is printed:

scaleway_rdb_privilege.api: Creating...
╷
│ Error: scaleway-sdk-go: invalid argument(s): database_name does not respect constraint, This database is not managed by RDB service, you can not change permission with the API. Use CLI instead
│
│   with scaleway_rdb_privilege.api,
│   on ../sources/database.tf line 71, in resource "scaleway_rdb_privilege" "api":
│   71: resource "scaleway_rdb_privilege" "api" {
│
╵

Steps to Reproduce

  1. create all resources (instance, database, user) except scaleway_rdb_privilege,
  2. once all resources (instance, database, user) are created, uncomment scaleway_rdb_privilege and attempt to create it

References

Important Factoids

In a real-world scenario the DB instance & users were imported into terraform (e.g. not created from scratch in terraform).

@gmile gmile changed the title Cannot add scaleway_rdb_privilege Cannot create scaleway_rdb_privilege resource Mar 14, 2025
@gmile
Copy link
Author

gmile commented Mar 14, 2025

The users originally were provisioned using psql - could that be related, or straight up the reason I am getting the error? If so, then would I be able to import such users into scaleway_rdb_user resource 🤔

@Laure-di Laure-di added the rdb Managed MySQL and PostgreSQL issues, bugs and feature requests label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rdb Managed MySQL and PostgreSQL issues, bugs and feature requests
Projects
None yet
Development

No branches or pull requests

3 participants