> ## Documentation Index
> Fetch the complete documentation index at: https://sariva.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Confluent Cloud: per-cluster credentials

> Create the manual admin Kafka key, then let Sariva create the runtime observability key for each Confluent Cloud Kafka cluster.

This is a **per-Kafka-cluster** step. Do it after the Confluent Cloud Kafka cluster exists, either because it already existed or because Terraform created it.

ⓘINFO

**This is not a first-install prerequisite.** Before installing Sariva, you only need the Confluent Cloud org-level Cloud API key and metrics key from [Confluent Cloud prerequisites](https://sariva.mintlify.site/prerequisites/confluent-cloud/service-account-keys.md). Per-cluster Kafka credentials are created after each Kafka cluster exists.

## On the VM path

There is no Terraform and no GitHub Actions on the [VM path](https://sariva.mintlify.site/deploy/vm-docker-cc.md), so the GitOps flow on this page does not apply. For each cluster, create a read-only Kafka API key yourself — it needs exactly four describe-only ACLs: `Cluster:DESCRIBE`, `Topic:DESCRIBE`, `Topic:DESCRIBE_CONFIGS`, `Group:DESCRIBE` — save it as a JSON file in `./secrets`, and reference it as `file:///app/secrets/<name>.json`. See [file:// and env:// references](https://sariva.mintlify.site/connecting-clusters/file-env.md).

## The identities involved

| Identity | Scope | Used for |
| - | - | - |
| **OrganizationAdmin Cloud API key** | Confluent Cloud org | Owned by your customer Terraform runner service account (`sa-terraform-runner`, `OrganizationAdmin`) — the same runner that holds the per-cluster admin Kafka key below. GitHub Actions / Terraform uses it to create service accounts, API keys, RBAC bindings, environments, and clusters. Stored per your credential source — GitHub Actions secret or AWS SSM. |
| **Metrics Cloud API key** | Confluent Cloud org | Owned by the metrics service account (`sariva-platform-observability`, `MetricsViewer`). The Sariva platform reads the Metrics API. Stored in the Sariva runtime Secret (EKS) or `.env` (VM). |
| **Per-cluster Kafka admin key** | One Kafka cluster | Customer-created bootstrap key. GitHub Actions / Terraform reads it to create topics, ACLs, and the observability credential. |
| **GitHub Actions OIDC role** | One deployment stage | Runs Terraform, owns S3/DynamoDB state access, reads the admin key, and writes the observability key. |
| **Pod AWS identity** (EKS) | One Sariva install | Sariva runtime reads the observability key only. It does not read the admin key. |

## Admin key vs observability key

Do not conflate these Kafka credentials.

| Credential | Who creates it today | Used by | Privilege level | Secret leaf |
| - | - | - | - | - |
| **Admin Kafka key** | Customer/operator | GitHub Actions / Terraform | Privileged | `kafka-admin` |
| **Observability Kafka key** | Sariva GitOps flow / Terraform | Sariva platform pod | Read-only / describe-only | `observability-reader` |

⚠WARNING

The Sariva platform pod should read only the **observability** credential. The **admin** credential is for GitHub Actions / Terraform and must not be granted to the pod.

## Secret naming convention

Use the generated GitOps matrix path:

```text theme={null}
<stage>/<env>/clusters/<cluster>/<leaf>
```

Examples:

```text theme={null}
dev/dev_env/clusters/dev_cluster/kafka-admin
dev/dev_env/clusters/dev_cluster/observability-reader
```

AWS Secrets Manager appends a random suffix to the ARN. Look up secrets by **name** when operating manually, and use an IAM resource pattern with a trailing wildcard when granting access, for example:

```text theme={null}
arn:aws:secretsmanager:<region>:<account>:secret:dev/*/clusters/*/observability-reader*
```

## Correct order

Use this sequence for a newly provisioned Confluent Cloud Kafka cluster:

1. **Environment layer apply** creates the Confluent Cloud Kafka cluster.
2. **Customer creates the admin Kafka key** and stores it at `<stage>/<env>/clusters/<cluster>/kafka-admin`.
3. **Cluster layer apply** reads the admin key from AWS Secrets Manager or SSM, configures topics/ACLs, and creates the observability credential.
4. **Observability credential output** points to `<stage>/<env>/clusters/<cluster>/observability-reader`.
5. **GitOps workflow watcher** updates Sariva with the `credentials_ref`.
6. Sariva moves the Kafka cluster from `awaiting_credentials` to `resolved`.

## 1. Create the admin Kafka key manually

Today, the customer/operator creates the admin Kafka credential manually after the Kafka cluster exists. A later Sariva phase may automate this through a bootstrap Terraform layer, but do not assume that path today.

Create or select a customer-owned Confluent Cloud service account for Terraform, for example:

```text theme={null}
sa-terraform-runner
```

Grant that service account `CloudClusterAdmin` on the Kafka cluster:

```bash theme={null}
confluent environment use <env-id>

confluent iam rbac role-binding create \
  --principal User:<terraform-runner-service-account-id> \
  --role CloudClusterAdmin \
  --environment <env-id> \
  --cloud-cluster <lkc-id>
```

Create a Kafka API key scoped to the Kafka cluster for that service account:

```bash theme={null}
confluent api-key create \
  --service-account <terraform-runner-service-account-id> \
  --resource <lkc-id>
# capture the key and secret; the secret is shown only once
```

Store the admin Kafka key/secret in your selected customer-owned credential store.

### AWS Secrets Manager admin key

```bash theme={null}
aws secretsmanager create-secret \
  --region <region> \
  --name <stage>/<env>/clusters/<cluster>/kafka-admin \
  --description "Terraform admin Kafka credential for <cluster>" \
  --secret-string '{"api_key":"<admin-kafka-api-key>","api_secret":"<admin-kafka-api-secret>"}'
```

### AWS SSM admin key

```bash theme={null}
aws ssm put-parameter \
  --region <region> \
  --name /<stage>/<env>/clusters/<cluster>/kafka-admin \
  --type SecureString \
  --description "Terraform admin Kafka credential for <cluster>" \
  --value '{"api_key":"<admin-kafka-api-key>","api_secret":"<admin-kafka-api-secret>"}'
```

ⓘINFO

For the AWS-native path, do not store this admin Kafka key as a GitHub repository secret. GitHub Actions reads it from AWS Secrets Manager or SSM through its OIDC role. The Sariva platform pod does not need this admin credential.

## 2. Let Sariva create the observability key

After the admin key exists and GitHub Actions can read it, ask Sariva to create the runtime observability credential. For example:

```text theme={null}
@sariva-platform create observability credential for cluster <cluster>, store in AWS Secrets Manager
```

Sariva opens a GitOps pull request. After approval and apply, Terraform:

* uses the org Cloud API key for Confluent Cloud service-account/API-key/RBAC operations;
* uses the admin Kafka key where Kafka ACL/topic work is required;
* creates a Kafka API key under the single Sariva service account used for Sariva platform access;
* applies the required RBAC or ACL authorization for observability;
* writes the observability credential to `<stage>/<env>/clusters/<cluster>/observability-reader`;
* emits the `credentials_ref` consumed by the workflow watcher.

ⓘINFO

The exact authorization can vary by Confluent Cloud cluster tier. Basic clusters may require Kafka ACLs where resource-scoped RBAC roles are not supported. Standard, Dedicated, and Enterprise clusters can use RBAC where supported. The customer-facing invariant is the same: Sariva creates a least-privilege observability credential and stores only a reference in Sariva.

## 3. Permissions required for AWS-backed credential stores

When AWS Secrets Manager or SSM is used, two AWS identities are involved.

| Identity | Needs | Why |
| - | - | - |
| **GitHub Actions OIDC role** | Read `kafka-admin`; create/update/read `observability-reader`. | Terraform needs the admin key to configure the cluster and writes the observability key after creating it. |
| **Pod AWS identity** | Read `observability-reader` only. | Sariva runtime uses the observability key to monitor the Kafka cluster. |

!DANGER

Do not grant the pod AWS identity access to `<stage>/<env>/clusters/<cluster>/kafka-admin`. If the pod can read the admin key, the runtime has more Kafka privilege than it needs.

Set the GitHub Actions permissions on [AWS S3/DynamoDB state with GitHub Actions](https://sariva.mintlify.site/install-setup/access-and-state/aws-github-actions.md) and the runtime read permissions on [Wire the pod's AWS identity](https://sariva.mintlify.site/install-setup/irsa.md).

## 4. Confirm Sariva sees the credential reference

After the workflow applies, check the Kafka cluster lifecycle from your laptop:

```bash theme={null}
export SARIVA_PLATFORM_API_KEY="sariva_<generated-admin-bearer>"
export SARIVA_PLATFORM_URL="http://127.0.0.1:8000"

sariva cluster list --api-url "$SARIVA_PLATFORM_URL"
```

Expected lifecycle after the observability credential is available:

```text theme={null}
CRED_LIFECYCLE = resolved
```

If the Kafka cluster is still `awaiting_credentials`, attach or update the reference explicitly:

```bash theme={null}
sariva cluster patch \
  --alias <cluster> \
  --credentials-ref <observability-credential-ref> \
  --api-url "$SARIVA_PLATFORM_URL"
```

## Manual read-only fallback

If you are not using the GitOps observability credential module, create a read-only Kafka API key manually, store it in the selected credential store, grant the pod read access to that credential, and patch the Kafka cluster with the credential reference. On the VM path, store it as a JSON file in `./secrets` and use a `file://` reference — see [file:// and env:// references](https://sariva.mintlify.site/connecting-clusters/file-env.md). The general flow is documented in [Overview — connecting a Kafka cluster](https://sariva.mintlify.site/connecting-clusters/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.