-
Notifications
You must be signed in to change notification settings - Fork 30
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
Provide an alternative way to retrieve available public ips from a subnet #36
Comments
I ended up with something like this seems fully functional. I'm quite new to phpipam so I don't know if there are some edge cases where it won't work but it fits our internal needs for now. Let's say I need to get 10 free IP addresses : data "phpipam_subnet" "my_subnet" {
subnet_address = "192.168.1.0"
subnet_mask = 24
}
# this new data source retrieves the nth free addresses of a subnet
# and fails if there is not enough available addresses
data "phpipam_nth_free_addresses" "ten_addresses" {
number = 10
subnet_id = data.phpipam_subnet.my_subnet.subnet_id
}
output "some_free_addresses" {
value = data.phpipam_nth_free_addresses.ten_addresses
}
# reuse the ten_addresses source the way you want when spinning VMs
# don't forget to use the `phpipam_address` resource for each IP address !
I ended by adding a I'm cleaning my work then I'll create a pull request ! |
Hi @julien-jean The task with multiple IPs has been a long time ago for me. In my case, previously, I needed to get the last IP address in a loop from different subnets, not from the same subnet. Feel free to create your Pull Request. Maybe new feature will be useful to other users of this terraform provider. |
@julien-jean Will you provide some pull request about this issue or I can close this ? |
Closed because of inactivity |
Hello there !
I've been lurking about the issue about getting the first free available ip address from phpipam (phpipam/phpipam#2960) and I was wondering if there were some alternative solution.
Basically, I'd like to implement a new datasource, let's say
subnet_free_addresses
and would expose the available IP addresses by the following process:Once that data source would be available, we could write our modules like so :
It feels to me like it is a good alternative to the
first_free_address
endpoint usage which does not work in our case. What do you think about it ?If the solution seems convenient to you, I'd like to suggest a pull request that would implement such solution.
Bye !
The text was updated successfully, but these errors were encountered: