almaforge_role Data Source
Read an AlmaForge Role resource by name.
This data source reads existing cluster resources. It does not create, change, or delete them. Authenticate using the Terraform setup guide. Your identity needs permission to read the selected resources.
Use the RBAC guide to interpret allow/deny rules, labels, and principals. Reading a role does not assign it to the current user.
See the configuration reference for the resource manifest and field context.
Set name to the existing object's metadata.name. The result is available in metadata and spec. A missing object produces an error.
Example Usage
Save this configuration in a new directory. Replace the example name with the existing object you want to read. Review the plan before applying it. Applying this data-only configuration saves the outputs without changing cluster resources.
terraform initterraform plan -out=plan.tfplanterraform apply plan.tfplanterraform outputterraform {
required_providers {
almaforge = {
source = "get.almaforge.com/almaforge/almaforge"
}
}
}
provider "almaforge" {}
data "almaforge_role" "existing" {
name = "developers"
}
output "name" {
value = data.almaforge_role.existing.metadata.name
}
To manage changes instead of only reading, use the resource. Read resources versus data sources before choosing ownership.
Schema
Required
name(String) Name of the resource to read.
Read-Only
metadata(Attributes) (see below for nested schema)spec(Attributes) Spec contains the resource configuration. (see below for nested schema)
Nested Schema for metadata
Read-Only:
labels(Map of String) Labels attached to the resource.name(String) Resource name. Changing this name replaces the resource.resource_version(String) Server revision used to detect concurrent changes.
Nested Schema for spec
Read-Only:
allow(Attributes) Allow is the set of conditions evaluated to grant access. (see below for nested schema)deny(Attributes) Deny is the set of conditions evaluated to deny access. Deny takes priority over allow. (see below for nested schema)options(Attributes) Options is for OpenSSH options like agent forwarding. (see below for nested schema)
Nested Schema for spec.allow
Read-Only:
app_labels(Map of List of String) AppLabels is a map of labels used as part of the RBAC system.app_labels_expression(String) AppLabelsExpression is a predicate expression used to allow/deny access to AppTargets.database_labels(Map of List of String) DatabaseLabels are used in RBAC system to allow/deny access to databases.database_labels_expression(String) DatabaseLabelsExpression is a predicate expression used to allow/deny access to DatabaseTargets.database_names(List of String) DatabaseNames is a list of database names this role is allowed to connect to.database_roles(List of String) DatabaseRoles is a list of database roles for automatic user creation.database_service_labels(Map of List of String) DatabaseServiceLabels are used in RBAC system to allow/deny access to Database Services.database_service_labels_expression(String) DatabaseServiceLabelsExpression is a predicate expression used to allow/deny access to Database Services.database_users(List of String) DatabaseUsers is a list of database users this role is allowed to connect as.host_groups(List of String) HostGroups is a list of groups for created users to be added to.host_sudoers(List of String) HostSudoers is a list of entries to include in a user's sudoer file.impersonate(Attributes) Impersonate specifies what users and roles this role is allowed to impersonate by issuing certificates or other possible means. (see below for nested schema)kubernetes_groups(List of String) KubernetesGroups is a list of kubernetes groups.kubernetes_labels(Map of List of String) KubernetesLabels is a map of kubernetes cluster labels used for RBAC.kubernetes_labels_expression(String) KubernetesLabelsExpression is a predicate expression used to allow/deny access to kubernetes clusters.kubernetes_resources(List of Object) KubernetesResourceMatchers is the set of Kubernetes resources this role grants access to. (see below for nested schema)kubernetes_users(List of String) KubernetesUsers is an optional list of kubernetes users to impersonate.request(Attributes) Request holds allow/deny conditions for access requests. (see below for nested schema)review_requests(Attributes) ReviewRequests defines conditions for submitting access reviews. (see below for nested schema)rules(List of Object) Rules is a list of rules and their access levels. (see below for nested schema)server_labels(Map of List of String) ServerLabels is a map of server labels used to dynamically grant access to servers.server_labels_expression(String) ServerLabelsExpression is a predicate expression used to allow/deny access to SSH nodes.server_logins(List of String) ServerLogins is a list of *nix system logins.
Nested Schema for spec.allow.impersonate
Read-Only:
roles(List of String) Roles is a list of resources this role is allowed to impersonate.users(List of String) Users is a list of resources this role is allowed to impersonate.where(String) Where specifies an optional advanced matcher.
Nested Schema for spec.allow.kubernetes_resources
Read-Only:
kind(String)name(String)namespace(String)verbs(List of String)
Nested Schema for spec.allow.request
Read-Only:
annotations(Map of List of String) Annotations is a collection of annotations to be programmatically appended to pending access requests at the time of their creation.claims_to_roles(List of Object) ClaimsToRoles specifies a mapping from claims (traits) to roles. (see below for nested schema)max_duration(String) MaxDuration is the maximum amount of time the access will be granted for. If this is zero, the default duration is used.roles(List of String) Roles is the name of roles which will match the request rule.search_as_roles(List of String) SearchAsRoles is a list of extra roles which should apply to a user while they are searching for resources as part of a Resource Access Request.suggested_reviewers(List of String) SuggestedReviewers is a list of reviewer suggestions.thresholds(List of Object) Thresholds is a list of thresholds, one of which must be met in order for reviews to trigger a state-transition. (see below for nested schema)
Nested Schema for spec.allow.request.claims_to_roles
Read-Only:
claim(String)roles(List of String)value(String)
Nested Schema for spec.allow.request.thresholds
Read-Only:
approve(Number)deny(Number)filter(String)name(String)
Nested Schema for spec.allow.review_requests
Read-Only:
claims_to_roles(List of Object) ClaimsToRoles specifies a mapping from claims (traits) to roles. (see below for nested schema)preview_as_roles(List of String) PreviewAsRoles is a list of extra roles which should apply to a reviewer while they are viewing a Resource Access Request.roles(List of String) Roles is the name of roles which may be reviewed.where(String) Where is an optional predicate which further limits which requests are reviewable.
Nested Schema for spec.allow.review_requests.claims_to_roles
Read-Only:
claim(String)roles(List of String)value(String)
Nested Schema for spec.allow.rules
Read-Only:
actions(List of String)resources(List of String)verbs(List of String)where(String)
Nested Schema for spec.deny
Read-Only:
app_labels(Map of List of String) AppLabels is a map of labels used as part of the RBAC system.app_labels_expression(String) AppLabelsExpression is a predicate expression used to allow/deny access to AppTargets.database_labels(Map of List of String) DatabaseLabels are used in RBAC system to allow/deny access to databases.database_labels_expression(String) DatabaseLabelsExpression is a predicate expression used to allow/deny access to DatabaseTargets.database_names(List of String) DatabaseNames is a list of database names this role is allowed to connect to.database_roles(List of String) DatabaseRoles is a list of database roles for automatic user creation.database_service_labels(Map of List of String) DatabaseServiceLabels are used in RBAC system to allow/deny access to Database Services.database_service_labels_expression(String) DatabaseServiceLabelsExpression is a predicate expression used to allow/deny access to Database Services.database_users(List of String) DatabaseUsers is a list of database users this role is allowed to connect as.host_groups(List of String) HostGroups is a list of groups for created users to be added to.host_sudoers(List of String) HostSudoers is a list of entries to include in a user's sudoer file.impersonate(Attributes) Impersonate specifies what users and roles this role is allowed to impersonate by issuing certificates or other possible means. (see below for nested schema)kubernetes_groups(List of String) KubernetesGroups is a list of kubernetes groups.kubernetes_labels(Map of List of String) KubernetesLabels is a map of kubernetes cluster labels used for RBAC.kubernetes_labels_expression(String) KubernetesLabelsExpression is a predicate expression used to allow/deny access to kubernetes clusters.kubernetes_resources(List of Object) KubernetesResourceMatchers is the set of Kubernetes resources this role grants access to. (see below for nested schema)kubernetes_users(List of String) KubernetesUsers is an optional list of kubernetes users to impersonate.request(Attributes) Request holds allow/deny conditions for access requests. (see below for nested schema)review_requests(Attributes) ReviewRequests defines conditions for submitting access reviews. (see below for nested schema)rules(List of Object) Rules is a list of rules and their access levels. (see below for nested schema)server_labels(Map of List of String) ServerLabels is a map of server labels used to dynamically grant access to servers.server_labels_expression(String) ServerLabelsExpression is a predicate expression used to allow/deny access to SSH nodes.server_logins(List of String) ServerLogins is a list of *nix system logins.
Nested Schema for spec.deny.impersonate
Read-Only:
roles(List of String) Roles is a list of resources this role is allowed to impersonate.users(List of String) Users is a list of resources this role is allowed to impersonate.where(String) Where specifies an optional advanced matcher.
Nested Schema for spec.deny.kubernetes_resources
Read-Only:
kind(String)name(String)namespace(String)verbs(List of String)
Nested Schema for spec.deny.request
Read-Only:
annotations(Map of List of String) Annotations is a collection of annotations to be programmatically appended to pending access requests at the time of their creation.claims_to_roles(List of Object) ClaimsToRoles specifies a mapping from claims (traits) to roles. (see below for nested schema)max_duration(String) MaxDuration is the maximum amount of time the access will be granted for. If this is zero, the default duration is used.roles(List of String) Roles is the name of roles which will match the request rule.search_as_roles(List of String) SearchAsRoles is a list of extra roles which should apply to a user while they are searching for resources as part of a Resource Access Request.suggested_reviewers(List of String) SuggestedReviewers is a list of reviewer suggestions.thresholds(List of Object) Thresholds is a list of thresholds, one of which must be met in order for reviews to trigger a state-transition. (see below for nested schema)
Nested Schema for spec.deny.request.claims_to_roles
Read-Only:
claim(String)roles(List of String)value(String)
Nested Schema for spec.deny.request.thresholds
Read-Only:
approve(Number)deny(Number)filter(String)name(String)
Nested Schema for spec.deny.review_requests
Read-Only:
claims_to_roles(List of Object) ClaimsToRoles specifies a mapping from claims (traits) to roles. (see below for nested schema)preview_as_roles(List of String) PreviewAsRoles is a list of extra roles which should apply to a reviewer while they are viewing a Resource Access Request.roles(List of String) Roles is the name of roles which may be reviewed.where(String) Where is an optional predicate which further limits which requests are reviewable.
Nested Schema for spec.deny.review_requests.claims_to_roles
Read-Only:
claim(String)roles(List of String)value(String)
Nested Schema for spec.deny.rules
Read-Only:
actions(List of String)resources(List of String)verbs(List of String)where(String)
Nested Schema for spec.options
Read-Only:
cert_extensions(List of Object) CertExtensions specifies the key/values to add to the certificate. (see below for nested schema)cert_format(String) CertificateFormat defines the format of the user certificate to allow compatibility with older versions of OpenSSH.client_idle_timeout(String) ClientIdleTimeout sets disconnect clients on idle timeout behavior. If set to 0 means do not disconnect.create_db_user(Boolean) CreateDatabaseUser enables automatic database user creation.create_db_user_mode(String) CreateDatabaseUserMode allows users to be automatically created on a database when not set to off.create_host_user(Boolean) CreateHostUser allows users to be automatically created on a host.create_host_user_mode(String) CreateHostUserMode allows users to be automatically created on a host when not set to off.disconnect_expired_cert(Boolean) DisconnectExpiredCert sets disconnect clients on expired certificates.forward_agent(Boolean) ForwardAgent is SSH agent forwarding.lock(String) Lock specifies the locking mode (strict|bestEffort) to be applied with the role.max_connections(Number) MaxConnections defines the maximum number of concurrent connections a user may hold.max_kubernetes_connections(Number) MaxKubernetesConnections defines the maximum number of concurrent Kubernetes sessions a user may hold.max_session_ttl(String) MaxSessionTTL defines how long an SSH session can last.max_sessions(Number) MaxSessions defines the maximum number of concurrent sessions per connection.permit_x11_forwarding(Boolean) PermitX11Forwarding authorizes use of X11 forwarding.pin_source_ip(Boolean) PinSourceIP forces the same client IP for certificate generation and usage.port_forwarding(Boolean) PortForwarding grants the "permit-port-forwarding" extension in the certificate. Not granted unless set.record_session(Attributes) RecordSession contains the SSH session recording policy. (see below for nested schema)request_access(String) RequestAccess defines the access request strategy (optional|note|always) where optional is the default.request_prompt(String) RequestPrompt is an optional message telling users what they ought to request.ssh_file_copy(Boolean) SSHFileCopy indicates whether remote file operations via SCP or SFTP are allowed over an SSH session.
Nested Schema for spec.options.cert_extensions
Read-Only:
name(String)value(String)
Nested Schema for spec.options.record_session
Read-Only:
default(String) Default indicates the default recording mode for services.ssh(String) SSH indicates the session recording mode used on SSH sessions.