# CloudIdentity

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> A CloudIdentity tells Ringleader how to sign in to your cloud and what shape a namespace's cloud workstations take.


A **CloudIdentity** tells Ringleader how to sign in to your cloud to create the cloud
workstations of its namespace. It answers two separate questions: how Ringleader
authenticates to your cloud, and what shape the workstations it governs take.

```text
apiVersion: core.ringleader.dev/v1
kind: CloudIdentity
```

It is **admin-managed**: only a namespace admin can author or change one.

[Cloud identities](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/) explains how Ringleader selects an
identity and what each part of one does. This page lists its fields and its status.

## Credential paths

Set `spec.cloudAccountRef` to select a CloudAccount for per-organization federation.
Ringleader presents a short-lived signed assertion to your cloud. If the account or
the setup in your cloud is missing, the workstation cannot start.

<div class="callout callout-note">
  <p class="callout-title"><code>spec.credentialRef</code> is retired</p>
  <div class="callout-body">
    <p>A CloudIdentity once supported a <strong>keyed</strong> path: <code>spec.credentialRef</code> named a
<code>Secret</code> holding a long-lived cloud credential, a service-account JSON key on
Google Cloud or an application client secret on Azure.</p>
<p><strong>Both are gone. Ringleader now stores no cloud credential at rest on any path.</strong>
Per-organization federation replaced them: Ringleader signs a short-lived assertion
and your own cloud checks it.</p>
<p>If your file still has <code>spec.credentialRef</code>, <code>rl apply</code> rejects it and names
<code>spec.cloudAccountRef</code> as its replacement:</p>
<div class="code-wrap code-output" data-lang="text">
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">apply cloudidentity/azure: validation failed: spec.credentialRef: is no longer a
</span></span><span class="line"><span class="cl">CloudIdentity field: ringleader stores no cloud credential at rest (the GCP
</span></span><span class="line"><span class="cl">service-account key and the Azure keyed client secret are both retired). Use
</span></span><span class="line"><span class="cl">spec.cloudAccountRef to name a CloudAccount. The per-org OIDC federation mints a
</span></span><span class="line"><span class="cl">short-lived assertion exchanged at your own cloud&#39;s trust, with no stored secret.</span></span></code></pre></div>
</div>
<p>Replace it with a <a href="https://docs-stg.ringleader.dev/reference/resources/cloudaccount/">CloudAccount</a> and a
<code>cloudAccountRef</code>; see <a href="https://docs-stg.ringleader.dev/cloud-accounts/keyless-access/">Keyless cloud access</a>.</p>

  </div>
</div>


### Per-organization federation

This is the path to prefer for new cloud accounts. [Keyless cloud access](https://docs-stg.ringleader.dev/cloud-accounts/keyless-access/) explains how Ringleader signs in with no stored key.

Set `spec.cloudAccountRef` to name a cluster-scoped
[CloudAccount](https://docs-stg.ringleader.dev/reference/resources/cloudaccount/), which only an organization
administrator can write and which holds which cloud identity to use. The CloudIdentity
points at it by name:

```yaml
apiVersion: core.ringleader.dev/v1
kind: CloudIdentity
metadata:
  name: gcp
  namespace: dev
spec:
  provider: gcp
  selector:
    matchLabels:
      cloud: gcp
  # Which cloud identity to sign in as lives on the CloudAccount.
  # The workstation's shape (project, zone, machineType) stays here.
  cloudAccountRef: acme-gcp
  defaultProviderConfig:
    gcp:
      project: acme-dev
      zone: us-east4-c
      machineType: c4-standard-4
```

Azure is the same shape: the account carries the Entra application and the
tenant, the identity carries the placement:

```yaml
apiVersion: core.ringleader.dev/v1
kind: CloudIdentity
metadata:
  name: azure
  namespace: dev
spec:
  provider: azure
  selector:
    matchLabels:
      cloud: azure
  cloudAccountRef: acme-azure
  defaultProviderConfig:
    azure:
      subscriptionId: 8d6e5f6e-5090-4221-9eae-cc956b238590
      resourceGroup: acme-workstations
      location: eastus
      subnetId: /subscriptions/…/virtualNetworks/acme-vnet/subnets/workstations
      publicIp: true
```

AWS is the same shape: the account carries the IAM role to assume, the identity
carries the placement:

```yaml
apiVersion: core.ringleader.dev/v1
kind: CloudIdentity
metadata:
  name: aws
  namespace: dev
spec:
  provider: aws
  selector:
    matchLabels:
      cloud: aws
  cloudAccountRef: acme-aws
  defaultProviderConfig:
    aws:
      region: us-east-1
      instanceType: m6i.xlarge
      subnetId: subnet-0abc123
      securityGroupIds: [sg-0abc123]
      assignPublicIp: true
```

The account must belong to the **same organization** as this CloudIdentity's namespace. If the
account lists `allowedNamespaces`, the list must include the namespace. Otherwise Ringleader
refuses the CloudIdentity when you apply it.
[Namespaces that may use an account](https://docs-stg.ringleader.dev/reference/resources/cloudaccount/#namespaces-that-may-use-an-account)
says how the list works, and
[Keyless cloud access](https://docs-stg.ringleader.dev/cloud-accounts/keyless-access/) says what to create in
your cloud.

## Spec fields

| Field | Type | Description |
|-------|------|-------------|
| `provider` | `string` | **Required.** The backend the credentials target (`gcp`, `azure`, `aws`). |
| `priority` | `int` | Precedence when several match (default `0`); higher wins. |
| `selector.matchLabels` | `map` | Which workstations this identity builds. Empty matches all. |
| `requireUse` | `bool` | Use this identity only for workstations whose owner holds the `use` right on it. Default `false`. See [Restricted cloud identities](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/restricted-identities/). |
| `cloudAccountRef` | `string` | The cluster-scoped [CloudAccount](https://docs-stg.ringleader.dev/reference/resources/cloudaccount/) that specifies which cloud identity this uses. Selects **per-organization federation**. |
| `serviceAccount.accountId` | `string` | Declares a **runtime identity** that the workstations run *as* (see [Cloud runtime identities](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/runtime-identities/)). On GCP it is the service account ID. On Azure it is the name of the user-assigned managed identity. On AWS it names both the IAM role and its instance profile. The name is 1 to 64 characters, each a letter, a digit or one of `_+=,.@-`. An AWS runtime identity also needs `spec.aws.workstationIdentityPath` on the [CloudAccount](https://docs-stg.ringleader.dev/reference/resources/cloudaccount/), and a workstation that uses it fails to build without one. |
| `serviceAccount.displayName` | `string` | A human label for the runtime identity. On GCP it is the service account's `displayName`. On Azure it is advisory. On AWS it is the IAM role's description, at most 1,000 characters, set only when Ringleader creates the role. |
| `serviceAccount.roles` | `array` | The role grants for the runtime identity, as an exact set of `{role, resource}` pairs. On GCP, `role` is `roles/…` or a custom role ID, granted at **project** scope. On Azure, `role` is a built-in role name, a GUID or a role definition ID. Its `resource` is an ARM scope ID, and an empty one means the identity's resource group. On AWS, `role` is the ARN of a managed policy in the `aws` partition. It is either one AWS manages (`arn:aws:iam::aws:policy/…`) or one in your account (`arn:aws:iam::<account ID>:policy/…`). Leave `resource` out on AWS: Ringleader refuses an AWS entry that sets it. |
| `serviceAccount.autoCreate` | `bool` | Does Ringleader create the runtime identity? Default `true`. Set `false` when your own infrastructure-as-code pre-creates it: Ringleader then only **adopts** it, and an absent one fails the workstation loudly rather than being conjured without the grants it exists to carry. |
| `serviceAccount.autoDelete` | `bool` | Does Ringleader delete the runtime identity when the last workstation using it goes away? Default `true`. Set `false` so tearing down a workstation cannot destroy an identity your own tooling declares, and with it any grants attached elsewhere. It is independent of `autoCreate`, so auto-create plus never-delete is a legitimate combination. |
| `defaultProviderConfig` | `object` | Per-provider `providerConfig` defaults (workstation overrides these). |
| `overrideProviderConfig` | `object` | Per-provider `providerConfig` forced by policy (wins over the workstation). |
| `subnet` | `string` | Places every workstation this CloudIdentity selects in this subnet. It also claims the subnet for this namespace, so no other namespace in the organization can place a workstation in it. See [Subnet claims](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/subnet-claims/). |
| `providerConfigKeys.allow` | `[]string` | Keys of this identity's own provider that a namespace member may set on the workstations it selects, beyond the ones a member may always set. See [Placement delegation](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/placement-delegation/). |
| `providerConfigKeys.deny` | `[]string` | Keys of this identity's own provider that nobody may set on the workstations it selects, a holder of the `cloudconfig` right included. It wins over `allow`. |

Everything a CloudIdentity declares is validated **when you apply it**, not when a
workstation later tries to boot. This object is a template for other people's
workstations, so a typo in it would otherwise surface as an opaque cloud error on someone
else's workstation.

## Status fields

| Field | Type | Description |
|-------|------|-------------|
| `valid` | `bool` | Whether the identity is well-formed and usable. |
| `message` | `string` | On success, the provider; on failure, why the identity is not usable (plus advisory warnings). |
| `lastVerified` | `string` | RFC3339 timestamp of the last verification (re-checked on a periodic cadence, and immediately after you edit the spec). |

## Next steps
- [CloudServiceAccount](https://docs-stg.ringleader.dev/reference/resources/cloudserviceaccount/): the record Ringleader keeps of each runtime identity this one declares.
- [CloudAccount](https://docs-stg.ringleader.dev/reference/resources/cloudaccount/): the org-owned
  choice of which cloud identity to use, referenced by a federated identity.
- [Keyless cloud access](https://docs-stg.ringleader.dev/cloud-accounts/keyless-access/):
  how Ringleader signs in to your cloud without a key.
- [Provider images and keys](https://docs-stg.ringleader.dev/reference/providers/images-keys/): what each provider's `providerConfig`
  accepts.
- [Identity selection and workstation defaults](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/selection-defaults/):
  which identity builds a workstation, and how defaults and overrides shape it.
- [Cost allocation labels](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/cost-allocation-labels/):
  the labels and tags an identity puts on a workstation.

