Skip to content
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

Modify RDB private instance configuration transform it in public instance #2057

Closed
Gwenael22 opened this issue Jul 19, 2023 · 2 comments · Fixed by #2068
Closed

Modify RDB private instance configuration transform it in public instance #2057

Gwenael22 opened this issue Jul 19, 2023 · 2 comments · Fixed by #2068
Assignees
Labels
bug rdb Managed MySQL and PostgreSQL issues, bugs and feature requests

Comments

@Gwenael22
Copy link

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.5.3
terraform-provider-scaleway 2.24.0

Affected Resource(s)

  • scaleway_rdb_instance

Terraform Configuration Files

first instanciate a RDB without ip_net field

private_network {
    pn_id = data.terraform_remote_state.network.outputs.private_network_id
 }

then, add ip_net configuration and apply the modification

private_network {
    pn_id = data.terraform_remote_state.network.outputs.private_network_id
    ip_net = "172.16.19.8/22"
 }

The bug is also present if if you modify the CIDR in ip_net section on a private instance created with an ip_net value

private_network {
    pn_id = data.terraform_remote_state.network.outputs.private_network_id
    ip_net = "172.16.19.8/32"
 }

Debug Output

Panic Output

Expected Behavior

The RDB is modified with the requested private IP endpoint (ex: 172.16.19.8:5432)

Actual Behavior

The RDB is modified with a public IP endpoint (ex: 195.154.196.110:24007)

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@sebastienbaillet
Copy link

I have a similar (and, I think, related) problem:

If you create a public db (without private_network block), and after that, you change it to make it private by adding a private_network block, the DB keeps its public ip address in addition to obtaining its private ip.

@Monitob Monitob self-assigned this Jul 21, 2023
@Monitob Monitob added rdb Managed MySQL and PostgreSQL issues, bugs and feature requests bug labels Jul 21, 2023
@Monitob
Copy link
Contributor

Monitob commented Jul 25, 2023

Thank you for the report, It's gonna be fixed on the next release. You'll be enable to remove an ip handled by the IPAM service to a private subnet. e.g:

resource scaleway_vpc_private_network pn01 {
  name = "my_private_network"
}

locals {
  ip_address  = cidrhost(scaleway_vpc_private_network.pn01.ipv4_subnet.0.subnet, 4)
  cidr_prefix = split("/", scaleway_vpc_private_network.pn01.ipv4_subnet.0.subnet)[1]
}

resource scaleway_rdb_instance main {
  name = "test-rdb"
  node_type = "db-dev-s"
  engine = "PostgreSQL-11"
  is_ha_cluster = false
  disable_backup = true
  user_name = "my_initial_user"
  password = "thiZ_is_v&ry_s3cret"
  tags = [ "terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn" ]
  volume_type = "bssd"
  volume_size_in_gb = 10
  private_network {
	ip_net = format("%s/%s", local.ip_address, local.cidr_prefix)
	pn_id  = scaleway_vpc_private_network.pn01.id
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rdb Managed MySQL and PostgreSQL issues, bugs and feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants