CREATE SECRET
View as MarkdownA secret securely stores sensitive credentials (like passwords and SSL keys) in Materialize’s secret management system. Optionally, a secret can also be used to store credentials that are generally not sensitive (like usernames and SSL certificates), so that all your credentials are managed uniformly.
Syntax
CREATE SECRET [IF NOT EXISTS] <name> AS <value>;
| Syntax element | Description |
|---|---|
IF NOT EXISTS
|
If specified, do not generate an error if a secret of the same name already exists. |
<name>
|
The identifier for the secret. |
<value>
|
The value for the secret. The value expression may not reference any
relations, and must be implicitly castable to bytea.
|
Examples
CREATE SECRET kafka_ca_cert AS decode('c2VjcmV0Cg==', 'base64');
Privileges
The privileges required to execute this statement are:
CREATEprivileges on the containing schema.
WARNING!
USAGE on a secret lets a role read the secret’s value. Materialize does not
return secret contents in query results, but a role with USAGE can reference
the secret in a connection or source that sends it to an endpoint the role
controls. Grant USAGE on a secret only to roles you would trust with the
secret itself.