lord-kyron/terraform-provider-phpipam

phpipam_subnet can't set "is_folder"

Opened this issue · 7 comments

Trying the following code

resource "phpipam_subnet" "folders" {
  subnet_address = "192.168.10.0"
  subnet_mask    = "24"
  description        = "Test"
  section_id     = 54
  is_folder      = true
}

Produces the following error, despite the documentation saying it's supported

Error: "is_folder": this field cannot be set

subnet_address and subnet_mask also don't make sense in this resource (as a folder), but are required for some reason.

I am confirm that issue exists.
But solution is not trivial because PHPIPAM use different API endpoints to get folders and subnets list.
For example, to get subnets:

curl -X GET http://phpipam.local/api/apiclient/subnets/[id]/

But, to get folders need:

curl -X GET http://phpipam.local/api/apiclient/folders/[id]/

As I see, current phpipam terraform provider code don't have logic to handle this. Need code refactoring to implement folders support.

@pavel-z1 - do you think you can do this? Or it is too much work? I am asking to know if can implement it in some upcoming version or mark it as obsolete and continue with other stuff.

@lord-kyron it will take a lot of time.
Would appreciate anyone willing to help with this feature.

@pavel-z1 - I'm not developer, so I couldn't help but will try to find someone willing to help.

@thefirstofthe300 and @rhysxevans- it seems that you are working with GO. Can you please, try to help here? @pavel-z1 needs help for fixing this and I am not actually GO developer.

@pavel-z1 - do you still think this will be a lot of work? Or you will be able to fix that?

Hi @lord-kyron
It is not simple here.

The problem not with creation of folder. The problem with phpipam subnet GET methods which does not return subnets with folder=1.
For example, curl -X GET "http://10.10.0.1/api/terraform/subnets/all" will return all subnets, except subnets with folder=1.

To implement folders, must be added phpipam folder controlled in the SDK and here.
Help is still needed here