badarsebard / terraform-provider-xsoar

Apache License 2.0
9 stars 3 forks source link

First attempt config API based #7

Open fancybear-dev opened 2 years ago

fancybear-dev commented 2 years ago

Hi,

This is my first attempt in solving the issue described in #6. This works in terms of functionality, but is certainly not ready for merging with main. The reason I created this, was to also get your (@badarsebard) view on things!


Right now, this code only works - if you provide every config key:value pair that is expected in the data blob in the json to create/update the integration. If you don't do this, you'll have an error like this;

image


Furthermore, I have not yet fixed the code for key:value pairs that are credentials. Right now, XSOAR will always detect changes - as the response for credentials is empty from the API. Noted this in the issue as well.


During the updating of the integration, when changes are detected, something still goes wrong - not sure what it is. It does work and does not generate any real issues - but the output is confusing and because of some misconfig somewhere.

image


The code reuse is getting out of hand. You noted this as well in #3. For the added code in this repo, I want to create a separate dedicated function once this works OK.

fancybear-dev commented 2 years ago

Added option to interact with the classifier in an integration. The documented way does not work, as the classifier is not defined in the config section of the json blob for integration creation.

fancybear-dev commented 2 years ago

What's funny - "funny" - is that the API accepts the ID as well as the name of the classifier in the exact same field. I'd recommend just using the ID, as that is less error prone.

Example, both work (ID corresponds with the name); image