IAM

Overview

An Identity on Snap CD can be either a User or a Service Principal. Access for both is controlled by an integrated OIDC Identity Provider.

Identities can be assigned to Groups.

Roles can be assigned either to a Group, or directly to an Identity.

Principals

User

A User represents a human identity authenticated via the integrated OIDC Identity Provider. Users sign in interactively using a browser and are typically associated with an individual person within your organization. Sign-in can be federated to an external login provider. Snap CD supports the following external login providers: Microsoft Entra, Okta, Auth0, Google and GitHub.

You can see the full User specification here.

NOTE: The Terraform provider only provides a User data source; creation must be done via the Dashboard.

Service Principal

A Service Principal is also known as an OIDC “Application” or “Client”, and is identified by “Client Id / Client Secret” credentials. Service Principals can exchange their Client Id / Client Secret for an Access Token, which can be used as a “Bearer” token in the authorization header when making requests to the Server’s Web API.

Runners need to have a Service Principal attached to them. You can also use a Service Principal to authenticate the Snap CD Terraform Provider.

You can see the full Service Principal specification here.

NOTE: The Terraform provider only provides a Service Principal data source; creation must be done via the Dashboard or Web API.

Group

Identities can be assigned to Groups. Note that nesting of Groups is currently not supported.

You can see the full Group specification here.

Role Assignments

Roles are assigned at specific scopes using role assignment resources. Each scope has its own Terraform resource and set of available roles.

Common Fields

All role assignment resources share these fields:

FieldDescription
principal_idID of the User, Service Principal, or Group
principal_discriminatorType of principal: User, ServicePrincipal, or Group
role_nameName of the role to assign (varies by scope)

Organization Roles

Organization roles apply system-wide.

Terraform Resource: snapcd_organization_role_assignment

RoleDescription
OwnerFull control over the entire organization
ContributorCan read and create resources
ReaderRead-only access across the organization
StackCreatorCan create new Stacks
IdentityAccessManagerCan manage role assignments
JobManagerCan manage job execution
SourceChangeNotifierCan trigger source change notifications
RunnerCan execute jobs as a runner

Stack Roles

Stack roles apply to a specific Stack and its child Namespaces and Modules.

Terraform Resource: snapcd_stack_role_assignment

Additional Field: stack_id - ID of the Stack

RoleDescription
OwnerFull control over the Stack and all child resources
ContributorCan read Stack and create child resources
ReaderRead-only access to Stack and child resources
NamespaceCreatorCan create new Namespaces in this Stack
IdentityAccessManagerCan manage role assignments on the Stack
SourceChangeNotifierCan trigger source change notifications
JobManagerCan manage job execution
RunnerCan execute jobs as a runner

Namespace Roles

Namespace roles apply to a specific Namespace and its child Modules.

Terraform Resource: snapcd_namespace_role_assignment

Additional Field: namespace_id - ID of the Namespace

RoleDescription
OwnerFull control over the Namespace and all child Modules
ContributorCan read Namespace and create Modules
ReaderRead-only access to Namespace and child Modules
ModuleCreatorCan create new Modules in this Namespace
IdentityAccessManagerCan manage role assignments on the Namespace
SourceChangeNotifierCan trigger source change notifications
JobManagerCan manage job execution
RunnerCan execute jobs as a runner

Module Roles

Module roles apply to a specific Module.

Terraform Resource: snapcd_module_role_assignment

Additional Field: module_id - ID of the Module

RoleDescription
OwnerFull control over the Module
ContributorCan read and modify the Module
ReaderRead-only access to the Module
IdentityAccessManagerCan manage role assignments on the Module
SourceChangeNotifierCan trigger source change notifications
RunnerCan execute jobs as a runner
JobManagerCan manage job execution

Runner Roles

Runner roles apply to a specific Runner.

Terraform Resource: snapcd_runner_role_assignment

Additional Field: runner_id - ID of the Runner

RoleDescription
OwnerFull control over the Runner
ContributorCan read and modify the Runner
ReaderRead-only access to the Runner
IdentityAccessManagerCan manage role assignments on the Runner

Examples

Assign a Service Principal as Module Owner

resource "snapcd_module_role_assignment" "deployer" {
  module_id               = snapcd_module.my_module.id
  principal_id            = data.snapcd_service_principal.deployer.id
  principal_discriminator = "ServicePrincipal"
  role_name               = "Owner"
}

Assign a User as Stack Reader

resource "snapcd_stack_role_assignment" "viewer" {
  stack_id                = snapcd_stack.production.id
  principal_id            = data.snapcd_user.viewer.id
  principal_discriminator = "User"
  role_name               = "Reader"
}

Assign a Group as Namespace Contributor

resource "snapcd_namespace_role_assignment" "dev_team" {
  namespace_id            = snapcd_namespace.backend.id
  principal_id            = snapcd_group.developers.id
  principal_discriminator = "Group"
  role_name               = "Contributor"
}
Last updated on