feat(platform): add sysdig_builtin_role data source#718
Merged
tembleking merged 3 commits intomasterfrom Mar 6, 2026
Merged
Conversation
Add a read-only data source to retrieve the permissions of default
(OOTB) roles such as View Only, Standard User, Advanced User, and
Team Manager via the `GET /platform/v1/default-roles/{name}` API.
Verify that well-known monitor and secure permissions (alerts.read, dashboards.read, token.view, scanning.read, secure.policy.read, policies.read) are present in the Advanced User default role response.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a sysdig_default_role data source to the Sysdig Terraform provider, allowing users to retrieve the permissions of built-in (out-of-the-box) default roles (View Only, Standard User, Advanced User, Team Manager) via the GET /platform/v1/default-roles/{name} API endpoint.
Changes:
- New
DefaultRoleInterfaceclient interface andGetDefaultRoleimplementation usingurl.PathEscapefor safe URL encoding of the role name - New
dataSourceSysdigDefaultRoleTerraform data source with schema and read function - Supporting types, documentation, and provider registration
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
sysdig/internal/client/v2/default_role.go |
New client file with GetDefaultRole function and DefaultRoleInterface |
sysdig/internal/client/v2/model.go |
New DefaultRole struct added alongside existing custom role models |
sysdig/internal/client/v2/sysdig.go |
DefaultRoleInterface embedded into SysdigCommon interface |
sysdig/data_source_sysdig_default_role.go |
New Terraform data source implementation |
sysdig/data_source_sysdig_default_role_test.go |
Acceptance test for the new data source |
sysdig/provider.go |
Registration of sysdig_default_role data source in the provider |
website/docs/d/default_role.md |
Documentation for the new data source |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rename from sysdig_default_role to sysdig_builtin_role to avoid ambiguity with "default" in Terraform context. The API path (/platform/v1/default-roles) remains unchanged.
sysdig_default_role data sourcesysdig_builtin_role data source
airadier
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a read-only data source to retrieve the permissions of built-in (OOTB) roles (View Only, Standard User, Advanced User, Team Manager) via the
GET /platform/v1/default-roles/{name}endpoint.This allows users to reference built-in role permissions in their Terraform configs, e.g. to compose custom roles based on a built-in role's permission set.