Floatingip associate v2

Hello all.

I am trying to replace openstack_compute_floatingip_associate_v2 which is now deprecated with openstack_networking_floatingip_associate_v2.

Terraform Version v1.7.5
Terraform provider 1.54.1

I have 3 vms declared in a for each loop.
I understand that I have to use the port associated with the vm in order to attach the floatingip.

I am using a data bloack to list all the ports but this only lists existing ports. It does not list any ports that have been created in this terraform session.
I have to run terraform for a second time to get the newly created ports.

How can I associate the floatingip with the vm without having to run the terraform apply twice?
Here is the basic code:
resource “openstack_compute_instance_v2” “vm” {
for_each = { for vm in var.VirtualMachines: vm.vm_name => vm }
name = each.value.vm_name
image_name = each.value.image_name
flavor_name = each.value.flavor_name
key_pair = var.keypair_name
security_groups = [var.security_groups[0]]

network {
name = var.networks[0]
fixed_ip_v4 = each.value.fixed_ip_v4
}
}
data “openstack_networking_port_ids_v2” “port_id_vpn” {
#fixed_ip = “50.50.1.250”
}

output “vpn_port_ids” {
value = values(data.openstack_networking_port_ids_v2.port_id_vpn)[*]

This is the output of vpn_port_ids.
vpn_port_ids = [
# (4 unchanged elements hidden)
null,
+ “50.50.1.250”,
+ “2751173200”,
+ [
+ “828fb76f-ed69-4793-9430-8c3d91af1f62”,
],

How do I reference this.

This is what I have for my floatingip

#allocate floating ip’s
resource “openstack_networking_floatingip_v2” “floatip_1” {
pool = “idemia”
description ="allocate 1 or more floating ip’s "
port_id = “828fb76f-ed69-4793-9430-8c3d91af1f62”
fixed_ip = “50.50.1.250”
#port_id = values(“data.openstack_networking_port_ids_v2.port_id_vpn”)
}

So essenntially i want to comment out the hard coded port_id and replace it with just the port_id from vpn_port_ids