Closed MrKoopaKiller closed 2 years ago
@pavel-z1 - is it possible to fix this one easily?
Hi @MrKoopaKiller I've updated phpipam-sdk and this provider to allow search CIDR in the specific section during subnet creation.
Check this feature in your environment
Thanks @pavel-z1! I'll test the changes soon!
@lord-kyron Do you think is it possible to create a new tag including the latest commits?
@MrKoopaKiller I will prepare new tag and new release build tomorrow!
Ping @lord-kyron 🙏
@MrKoopaKiller published with the latest release!
Affected resource
phpipam_subnet
resourceIssue:
The phpIPAM allow us to disable the strict mode per section and also allow us to create more than one subnet using the same cidr in diferente sections. That being said, if we try to create 2 subnets with the same CIDR but in different sections, it should work, but in fact, it's not working and terraform throws an error:
Seems the main reason is by this function that tries to retry if the subnet was correctly create querying by CIDR:
https://github.com/lord-kyron/terraform-provider-phpipam/blob/1dd3754c3e2e91fb343f6289774620b3f0f6c1a3/vendor/github.com/lord-kyron/phpipam-sdk-go/controllers/subnets/subnets.go#L120-L123
But since we have more than 1 result, it throws the error:
https://github.com/lord-kyron/terraform-provider-phpipam/blob/1dd3754c3e2e91fb343f6289774620b3f0f6c1a3/plugin/providers/phpipam/resource_phpipam_subnet.go#L62-L64
Use case: Just to give a quick explanation why I'm using this in that way. I have multiples AWS accounts, and I'm putting all the vpc and subnets from all this accounts and all regions in the phpIPAM. AWS regions has the default vpc, using the same CIDR and it causes the error. If for some reason the subnets weren't correctly architect and an overlap occurs, is it possible to face the same error even if the strict mode is disabled in the phpIPAM.
Expected Behavior Be able to create subnets using the same CIDR.