feat: Add flagsmith_feature and flagsmith_segment data sources - #244
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true📝 WalkthroughWalkthroughAdded Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The PR adds the requested data sources; the only noted issue is a minor changelog formatting problem that does not affect runtime behavior. It is otherwise merge-ready after normal review, with a small documentation fix recommended. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2896a73 to
8f080f2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d9d1f3fa-4664-4cdd-9033-840e3ff91674
📒 Files selected for processing (11)
CHANGELOG.mddocs/data-sources/feature.mddocs/data-sources/segment.mdexamples/data-sources/flagsmith_feature/data-source.tfexamples/data-sources/flagsmith_segment/data-source.tfflagsmith/data_source_feature.goflagsmith/data_source_feature_test.goflagsmith/data_source_schema_test.goflagsmith/data_source_segment.goflagsmith/data_source_segment_test.goflagsmith/provider.go
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
8f080f2 to
c4a3508
Compare
Adds data sources so that features and segments created outside of Terraform can be referenced, which is what issue #153 asks for. Without them a pipeline that manages only environment specific flagsmith_feature_state overrides has no way to get at the feature it needs to override. Both are keyed on `uuid`, matching the existing flagsmith_project and flagsmith_organisation data sources. UUIDs are also stable across renames, and GetFeature and GetSegment already exist in the API client, so this needs no client changes. Looking entities up by name would be friendlier, but the API's name filters are case insensitive "contains" matches, which means client side filtering, and segment names are not unique within a project. If that turns out to be wanted, adding `project_uuid` plus a name behind ExactlyOneOf later is additive and breaks no existing configuration. Both reuse the existing FeatureResourceData and SegmentResourceData structs, as the three existing data sources do. That avoids forking the recursive segment rules converter, but it means req.Config.Get needs the schema attributes and the tfsdk tags to stay in step, and a mismatch only shows up at runtime. The new reflection based tests in data_source_schema_test.go turn that into a build failure instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
c4a3508 to
63fdc61
Compare
Closes #153.
Adds data sources so features and segments created outside of Terraform can be referenced. Without them, a pipeline that manages only environment-specific
flagsmith_feature_stateoverrides has no way to get at the feature it needs to override — the use case in the issue.🤖 Generated with Claude Code