f5devcentral / terraform-provider-bigip-old

This Repo is Deprecated please refer to https://github.com/terraform-providers/terraform-provider-bigip Provider is Published !
Mozilla Public License 2.0
32 stars 15 forks source link

Add LTM iRule data-group entry resource? #95

Closed bpoland closed 6 years ago

bpoland commented 6 years ago

Hi there,

Just wondering if there are plans to add an iRule data group entry resource (e.g bigip_ltm_datagroup_record or something)? This could be used to add/remove records from a data group. And it might be nice to have a resource to create data groups as well (e.g. bigip_ltm_datagroup).

Right now I am using a provisioner which SSHes to the big-ip and runs tmsh but it would be great to have native support for this. Here's an example of the tmsh call I use:

tmsh modify ltm data-group internal /Partition/data_group_name records add { dgl_entry_name { data dgl_entry_value }}

tmsh modify ltm data-group internal /Partition/data_group_name records delete { dgl_entry_name }

Thanks!

dannyk81 commented 6 years ago

@bpoland interestingly, I can see the data-group resource in the documentation: https://github.com/f5devcentral/terraform-provider-bigip/blob/master/website/docs/r/bigip_ltm_datagroup.html.markdown

But can't find the actual implementation 🤷‍♂️

@scshitole was this in fact implemented?

bpoland commented 6 years ago

Thanks, didn't see that. But yes we would need it to be implemented :)

Also, it looks like you specify the records inline -- for my usage I think I would need to have a separate bigip_ltm_datagroup_record resource used to add/remove records from the data group list. Similar to what you did for the pool members a few weeks ago.

scshitole commented 6 years ago

@bpoland @dannyk81 I had it implemented earlier there was some issue so taken out.

dannyk81 commented 6 years ago

@bpoland Yeah, that would make more sense 👍

By the way, I'm curious - are you using the pool_attachment resource? it works well in our tests, was just wondering if anyone else tried it.

bpoland commented 6 years ago

I haven't had a chance to switch over to it yet, was kind of waiting for an official release of the provider. Does anyone know when that might happen?

dannyk81 commented 6 years ago

@scshitole could you share the implementation? I would like to help get this done as we also need to manage some data group records for some dynamic iRules we are writing.

dannyk81 commented 6 years ago

So, I've been looking into this today and have few insights:

1) Data-group records are not sub-collections, so in order to add/modify/remove any of them via the REST API you have to replace them all.

2) Given the above constraint, we can't delegate the records management to a separate resource and in fact this should be handled in-line within the datagroup resource itself. (/cc @bpoland - not sure what's your use case here, but looks like there's no way around this)

@scshitole it would help to avoid hitting the same issue, if you could share your experience from attempting to implement this?

bpoland commented 6 years ago

That's too bad. I wonder why tmsh lets you add and remove individual records, but the REST API doesn't...

I guess I will have to continue using a provisioner then. Thanks for looking into it @dannyk81

scshitole commented 6 years ago

@bpoland @dannyk81 to create Data group here is the Method and payload

image

I think we should be able to modify as well see below image

dannyk81 commented 6 years ago

Thanks @scshitole, I've made some progress and already have the create and destroy parts working including tests.

@bpoland I was mainly basing my analysis on this (https://devcentral.f5.com/questions/add-value-in-data-group-via-rest-api) as well as the fact that I couldn't find an API for just modifying/adding/removing a single record from a data group.

@scshitole am I missing something?