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

feat: Add Netbox User Permission Resource #390

Merged
merged 1 commit into from
May 7, 2023

Conversation

tagur87
Copy link
Contributor

@tagur87 tagur87 commented Apr 27, 2023

This feature allows management of netbox user permissions with
terraform. It follows the pattern of testing and design similar to that
of other resources.

A unique feature of this resource is the handling of the constraints
field. Since this field is a JSON blob in the netbox API, we had to
find a nice way to convert a JSON string into a JSON blob. And since
this field can be either a JSON list or a JSON object, we had to handle
this accordingly. By using json.Unmarshal() on the string, and then
doing a type switch, we could detect the correct type, and set that in
the struct for sending it to the API.

Also updated the autogenerated docs in a separate commit.

Ref: #387

@tagur87
Copy link
Contributor Author

tagur87 commented Apr 27, 2023

@fbreckle - could I ask for a review

@tagur87
Copy link
Contributor Author

tagur87 commented May 2, 2023

Good afternoon @fbreckle! Any possibility we could get this reviewed soon and merged? We'd like to start using this feature soon! Thank you for your consideration!

This feature allows management of netbox user permissions with
terraform. It follows the pattern of testing and design similar to that
of other resources.

A unique feature of this resource is the handling of the `constraints`
field. Since this field is a JSON blob in the netbox API, we had to
find a nice way to convert a JSON string into a JSON blob. And since
this field can be either a JSON list or a JSON object, we had to handle
this accordingly. By using `json.Unmarshal()` on the string, and then
doing a type switch, we could detect the correct type, and set that in
the struct for sending it to the API.

Ref: e-breuninger#387
@fbreckle
Copy link
Collaborator

fbreckle commented May 7, 2023

I renamed the resource to netbox_permission

twink0r pushed a commit to twink0r/terraform-provider-netbox that referenced this pull request Sep 15, 2023
This feature allows management of netbox user permissions with
terraform. It follows the pattern of testing and design similar to that
of other resources.

A unique feature of this resource is the handling of the `constraints`
field. Since this field is a JSON blob in the netbox API, we had to
find a nice way to convert a JSON string into a JSON blob. And since
this field can be either a JSON list or a JSON object, we had to handle
this accordingly. By using `json.Unmarshal()` on the string, and then
doing a type switch, we could detect the correct type, and set that in
the struct for sending it to the API.

Ref: e-breuninger#387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants