scaleway / terraform-provider-scaleway

Terraform Scaleway provider

Home Page:https://www.terraform.io/docs/providers/scaleway/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rdb_instance.private_network.enable_ipam does not work as expected

rwunderer opened this issue Β· comments

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.8.3
on linux_amd64

Affected Resource(s)

  • scaleway_rdb_instance

Terraform Configuration Files

resource "scaleway_vpc" "demo_vpc" {
  name = "demo_vpc"
}

resource "scaleway_vpc_private_network" "subnet_0" {
  name   = "subnet_0"
  vpc_id = scaleway_vpc.demo_vpc.id

  ipv4_subnet {
    subnet = "192.168.0.0/24"
  }
}

resource "scaleway_rdb_instance" "demo" {
  name           = "rdb_migrate_pn_bug_demo"
  node_type      = "DB-DEV-S"
  engine         = "MySQL-8"
  disable_backup = true
  is_ha_cluster  = false
  user_name      = "demo"
  password       = "Azety123!"
  private_network {
    pn_id       = scaleway_vpc_private_network.subnet_0.id
    enable_ipam = true
  }
}

data "scaleway_ipam_ip" "demo" {
  resource {
    name = scaleway_rdb_instance.demo.name
    type = "rdb_instance"
  }

  type = "ipv4"
}

output "ipam_address" {
  value = data.scaleway_ipam_ip.demo.address
}

Debug Output

Panic Output

Expected Behavior

MySQL instance is created with ipam enabled and data.scaleway_ipam_ip.demo shows information about the instance endpoint.

Actual Behavior

data.scaleway_ipam_ip.demo breaks:

data.scaleway_ipam_ip.demo: Reading...
β•·
β”‚ Error: no ip found with given filters
β”‚ 
β”‚   with data.scaleway_ipam_ip.demo,
β”‚   on main.tf line 28, in data "scaleway_ipam_ip" "demo":
β”‚   28: data "scaleway_ipam_ip" "demo" {
β”‚

Also, enable_ipam has not been set as can be seen when trying to run terraform apply again:

scaleway_vpc.demo_vpc: Refreshing state... [id=fr-par/3441224b-c637-4f03-8b8f-286fd40ebd3d]
scaleway_vpc_private_network.subnet_0: Refreshing state... [id=fr-par/907c17d6-57e9-400d-b024-dfb45d3c5d2f]
scaleway_rdb_instance.demo: Refreshing state... [id=fr-par/5eb0844d-2712-4918-a4dd-7ae9caac4900]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # data.scaleway_ipam_ip.demo will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "scaleway_ipam_ip" "demo" {
      + address         = (known after apply)
      + address_cidr    = (known after apply)
      + id              = (known after apply)
      + organization_id = (known after apply)
      + project_id      = (known after apply)
      + region          = (known after apply)
      + type            = "ipv4"
      + zonal           = (known after apply)

      + resource {
          + name = "rdb_migrate_pn_bug_demo"
          + type = "rdb_instance"
        }
    }

  # scaleway_rdb_instance.demo will be updated in-place
  ~ resource "scaleway_rdb_instance" "demo" {
        id                        = "fr-par/5eb0844d-2712-4918-a4dd-7ae9caac4900"
        name                      = "rdb_migrate_pn_bug_demo"
        tags                      = []
        # (20 unchanged attributes hidden)

      ~ private_network {
          ~ enable_ipam = false -> true
            name        = null
            # (7 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Changes to Outputs:
  + ipam_address = (known after apply)

Steps to Reproduce

  1. terraform apply

Hello @rwunderer, I tried to reproduce the issue described, but on my configuration everything works as expected.

After running terraform apply, the IPAM address was successfully assigned, and I did not encounter any errors. Here is the output:

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Outputs:

ipam_address = "192.168.0.2"

I think you should update the version of the Terraform Scaleway provider.