ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
35 stars 23 forks source link

Error: error while fetching dbaas cluster xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx: is not a valid PoolMode #681

Open mway-niels opened 2 days ago

mway-niels commented 2 days ago

Description

Upgrading the Terraform provider is not possible if the state contains old managed PostgreSQL clusters.

terraform plan returns the error message Error: error while fetching dbaas cluster xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx: is not a valid PoolMode on old managed PostgreSQL clusters.

Expected behavior

When upgrading the IONOS Terraform provider, new API properties/fields shouldn't cause terraform plan/apply to return an error.

Environment

Terraform version:

v1.9.3

Provider version:

v6.5.6

OS:

macOS 14.6.1

How to Reproduce

As I'm not able to create a managed PostgreSQL using the old IONOS API, I'm not sure how to reproduce this bug with new configurations.

Error and Debug Output

╷
│ Error: error while fetching dbaas cluster xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:  is not a valid PoolMode
│ 
│   with module.base[0].ionoscloud_pg_cluster.database,
│   on base/resources-postgresql.tf line 1, in resource "ionoscloud_pg_cluster" "database":
│    1: resource "ionoscloud_pg_cluster" "database" {
│ 
╵
cristiGuranIonos commented 2 days ago

Can you share the cluster in the tf plan? Between what versions is the upgrade? Thanks!

mway-niels commented 2 days ago

From version 6.3.1 to 6.5.6.

Here's the database resource:

resource "ionoscloud_pg_cluster" "database" {
  display_name         = "${var.resource_base_name}_1"
  location             = ionoscloud_datacenter.dc.location
  postgres_version     = var.postgres_version
  cores                = 6
  ram                  = 20480
  instances            = 2
  storage_type         = "SSD"
  storage_size         = 307200
  synchronization_mode = "ASYNCHRONOUS"
  connections {
    datacenter_id = ionoscloud_datacenter.dc.id
    lan_id        = ionoscloud_lan.lan.id
    cidr          = "XXX.XXX.XXX.XXX/24"
  }
  credentials {
    username = var.database_user
    password = var.database_password
  }
  maintenance_window {
    day_of_the_week = var.maintenance_day
    time            = var.maintenance_time_postgresql
  }
  lifecycle {
    prevent_destroy = true
  }
}
adeatcu-ionos commented 1 day ago

@mway-niels we investigated and the issue is not from our side (Terraform provider), it is from the DBaaS API, we discussed with our colleagues from the DBaaS team and they will come up with a solution for this. If you want to find out more information about this, such as when it will be solved or other details, please send an e-mail to one of the addresses listed here: https://docs.ionos.com/support/general-information/contact-information.

We will close this issue since there is nothing to do on our side.

L.E: I will reopen the issue since we want to make sure that the fix from DBaaS team will actually solve this.

Thank you!