Skip to content

feat(platform): add sysdig_builtin_role data source#718

Merged
tembleking merged 3 commits intomasterfrom
feat/default-role-data-source
Mar 6, 2026
Merged

feat(platform): add sysdig_builtin_role data source#718
tembleking merged 3 commits intomasterfrom
feat/default-role-data-source

Conversation

@tembleking
Copy link
Copy Markdown
Member

@tembleking tembleking commented Mar 6, 2026

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.

data "sysdig_builtin_role" "advanced_user" {
  name = "Advanced User"
}

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.
@tembleking tembleking requested a review from a team as a code owner March 6, 2026 09:19
Copilot AI review requested due to automatic review settings March 6, 2026 09:19
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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DefaultRoleInterface client interface and GetDefaultRole implementation using url.PathEscape for safe URL encoding of the role name
  • New dataSourceSysdigDefaultRole Terraform 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.

Comment thread sysdig/internal/client/v2/model.go
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.
@tembleking tembleking changed the title feat(platform): add sysdig_default_role data source feat(platform): add sysdig_builtin_role data source Mar 6, 2026
@tembleking tembleking enabled auto-merge March 6, 2026 10:03
@tembleking tembleking added this pull request to the merge queue Mar 6, 2026
Merged via the queue into master with commit 6e9002b Mar 6, 2026
315 of 354 checks passed
@tembleking tembleking deleted the feat/default-role-data-source branch March 6, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants