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

phpipam_subnet can't set "is_folder" #20

Open
ghost opened this issue Jul 31, 2020 · 7 comments
Open

phpipam_subnet can't set "is_folder" #20

ghost opened this issue Jul 31, 2020 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@ghost
Copy link

ghost commented Jul 31, 2020

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.

@pavel-z1
Copy link
Collaborator

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.

@lord-kyron
Copy link
Owner

@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.

@pavel-z1 pavel-z1 added the help wanted Extra attention is needed label Oct 19, 2020
@pavel-z1
Copy link
Collaborator

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

@lord-kyron
Copy link
Owner

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

@lord-kyron
Copy link
Owner

lord-kyron commented May 11, 2021

@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.

@lord-kyron
Copy link
Owner

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

@pavel-z1
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants