segmentio / terraform-provider-segment

Terraform provider for Segment, using the Public API
https://registry.terraform.io/providers/segmentio/segment/latest
MIT License
25 stars 3 forks source link

Add capability to manage "Libraries" to the provider #66

Open dscanlan-sg opened 9 months ago

dscanlan-sg commented 9 months ago

Is your feature request related to a problem? Please describe.

We are currently setting up Segment in Terraform and would like to be able to utilise "Libraries" but currently can only use LIVE tracking plans not PROPERTY_LIBRARY or RULE_LIBRARY which is supported by the Public API. This means we will end up with repeated groups of events or attributes which will have to be maintained within the code.

Describe the solution you'd like

Ability to manage the resource type segment_tracking_plan with types PROPERTY_LIBRARY or RULE_LIBRARY which can then be linked to the LIVE tracking plan's.

Describe alternatives you've considered

Additional context

The PROPERTY_LIBRARY is probably more of a priority at this stage and the RULE_LIBRARY likely something we would want in the future.

Public API reference to types noted above: https://docs.segmentapis.com/tag/Tracking-Plans#operation/createTrackingPlan

deanhuynh commented 9 months ago

Could you explain a bit more about what is preventing you from using those Tracking Plan types? I am able to use those on my end. Are you perhaps getting an error like this which is in the connection (Sources cannot be connected to non LIVE Tracking Plans) and not the Tracking Plan resource?

│ Error: Unable to create connection between Source and Tracking Plan
│ 
│   with segment_source_tracking_plan_connection.test,
│   on main.tf line 269, in resource "segment_source_tracking_plan_connection" "test":
│  269: resource "segment_source_tracking_plan_connection" "test" {
│ 
│ 403 Forbidden
│ {
│   "errors": [
│     {
│       "type": "forbidden",
│       "message": "Authz: User does not have permissions to perform this action. Tracking plan is not type Live."
│     }
│   ]
│ }
sco-at-scg commented 9 months ago

One of Tracking Plan's type is RULE_LIBRARY.

{
  "name": "Some Library",
  "description": "Some Library Desc"
  "type": "RULE_LIBRARY",
  "syncFromLibraries": [],
  "excludedRulesFromLibraries": []
}

Questions:

deanhuynh commented 9 months ago

@sco-at-scg

Do we have capabilities to create libraries?

Yes you can create libraries in the provider now, are you running into issues?

As the mandatory field for segment_tracking_plan are name and rules, it it possible to use RULE_LIBRARY with the current provider?

No, we do not support importing libraries at this point, but is on our future roadmap.

dscanlan-sg commented 8 months ago

Hi @deanhuynh - so just to confirm the current terraform tracking plan capabilities allow us to:

What we do not have the capability to do is connect/synchronize a library of events/attributes with a tracking plan - is this correct?

Is there another way we should be using libraries or is this just a capability gap with the API/terraform provider? It seems that if we create one it is just orphaned and cannot be connected to anything. Just want to check I am not missing something here. Thanks

ranand commented 8 months ago

What we do not have the capability to do is connect/synchronize a library of events/attributes with a tracking plan - is this correct?

Yes this is correct

It is a missing functionality at this point. We will consider prioritizing this early next year. Thanks!

dscanlan-sg commented 8 months ago

@ranand - great - thanks for confirming and will work around this for now. Are we OK to keep this feature request open for the additional capability as it is something we are looking to utilise?