published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
The Kafka Schema resource allows the creation and management of Aiven Kafka Schemas.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Aiven = Pulumi.Aiven;
return await Deployment.RunAsync(() =>
{
var kafka_schema1 = new Aiven.KafkaSchema("kafka-schema1", new()
{
Project = aiven_project.Kafka_schemas_project1.Project,
ServiceName = aiven_kafka.Kafka_service1.Service_name,
SubjectName = "kafka-schema1",
CompatibilityLevel = "FORWARD",
Schema = @" {
""doc"": ""example"",
""fields"": [{
""default"": 5,
""doc"": ""my test number"",
""name"": ""test"",
""namespace"": ""test"",
""type"": ""int""
}],
""name"": ""example"",
""namespace"": ""example"",
""type"": ""record""
}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aiven/sdk/v5/go/aiven"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := aiven.NewKafkaSchema(ctx, "kafka-schema1", &aiven.KafkaSchemaArgs{
Project: pulumi.Any(aiven_project.KafkaSchemasProject1.Project),
ServiceName: pulumi.Any(aiven_kafka.KafkaService1.Service_name),
SubjectName: pulumi.String("kafka-schema1"),
CompatibilityLevel: pulumi.String("FORWARD"),
Schema: pulumi.String(" {\n \"doc\": \"example\",\n \"fields\": [{\n \"default\": 5,\n \"doc\": \"my test number\",\n \"name\": \"test\",\n \"namespace\": \"test\",\n \"type\": \"int\"\n }],\n \"name\": \"example\",\n \"namespace\": \"example\",\n \"type\": \"record\"\n }\n"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aiven.KafkaSchema;
import com.pulumi.aiven.KafkaSchemaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var kafka_schema1 = new KafkaSchema("kafka-schema1", KafkaSchemaArgs.builder()
.project(aiven_project.kafka-schemas-project1().project())
.serviceName(aiven_kafka.kafka-service1().service_name())
.subjectName("kafka-schema1")
.compatibilityLevel("FORWARD")
.schema("""
{
"doc": "example",
"fields": [{
"default": 5,
"doc": "my test number",
"name": "test",
"namespace": "test",
"type": "int"
}],
"name": "example",
"namespace": "example",
"type": "record"
}
""")
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as aiven from "@pulumi/aiven";
const kafka_schema1 = new aiven.KafkaSchema("kafka-schema1", {
project: aiven_project["kafka-schemas-project1"].project,
serviceName: aiven_kafka["kafka-service1"].service_name,
subjectName: "kafka-schema1",
compatibilityLevel: "FORWARD",
schema: ` {
"doc": "example",
"fields": [{
"default": 5,
"doc": "my test number",
"name": "test",
"namespace": "test",
"type": "int"
}],
"name": "example",
"namespace": "example",
"type": "record"
}
`,
});
import pulumi
import pulumi_aiven as aiven
kafka_schema1 = aiven.KafkaSchema("kafka-schema1",
project=aiven_project["kafka-schemas-project1"]["project"],
service_name=aiven_kafka["kafka-service1"]["service_name"],
subject_name="kafka-schema1",
compatibility_level="FORWARD",
schema=""" {
"doc": "example",
"fields": [{
"default": 5,
"doc": "my test number",
"name": "test",
"namespace": "test",
"type": "int"
}],
"name": "example",
"namespace": "example",
"type": "record"
}
""")
resources:
kafka-schema1:
type: aiven:KafkaSchema
properties:
project: ${aiven_project"kafka-schemas-project1"[%!s(MISSING)].project}
serviceName: ${aiven_kafka"kafka-service1"[%!s(MISSING)].service_name}
subjectName: kafka-schema1
compatibilityLevel: FORWARD
schema: |2
{
"doc": "example",
"fields": [{
"default": 5,
"doc": "my test number",
"name": "test",
"namespace": "test",
"type": "int"
}],
"name": "example",
"namespace": "example",
"type": "record"
}
Create KafkaSchema Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new KafkaSchema(name: string, args: KafkaSchemaArgs, opts?: CustomResourceOptions);@overload
def KafkaSchema(resource_name: str,
args: KafkaSchemaArgs,
opts: Optional[ResourceOptions] = None)
@overload
def KafkaSchema(resource_name: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = None,
schema: Optional[str] = None,
service_name: Optional[str] = None,
subject_name: Optional[str] = None,
compatibility_level: Optional[str] = None,
schema_type: Optional[str] = None)func NewKafkaSchema(ctx *Context, name string, args KafkaSchemaArgs, opts ...ResourceOption) (*KafkaSchema, error)public KafkaSchema(string name, KafkaSchemaArgs args, CustomResourceOptions? opts = null)
public KafkaSchema(String name, KafkaSchemaArgs args)
public KafkaSchema(String name, KafkaSchemaArgs args, CustomResourceOptions options)
type: aiven:KafkaSchema
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args KafkaSchemaArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args KafkaSchemaArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args KafkaSchemaArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args KafkaSchemaArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args KafkaSchemaArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var kafkaSchemaResource = new Aiven.KafkaSchema("kafkaSchemaResource", new()
{
Project = "string",
Schema = "string",
ServiceName = "string",
SubjectName = "string",
CompatibilityLevel = "string",
SchemaType = "string",
});
example, err := aiven.NewKafkaSchema(ctx, "kafkaSchemaResource", &aiven.KafkaSchemaArgs{
Project: pulumi.String("string"),
Schema: pulumi.String("string"),
ServiceName: pulumi.String("string"),
SubjectName: pulumi.String("string"),
CompatibilityLevel: pulumi.String("string"),
SchemaType: pulumi.String("string"),
})
var kafkaSchemaResource = new KafkaSchema("kafkaSchemaResource", KafkaSchemaArgs.builder()
.project("string")
.schema("string")
.serviceName("string")
.subjectName("string")
.compatibilityLevel("string")
.schemaType("string")
.build());
kafka_schema_resource = aiven.KafkaSchema("kafkaSchemaResource",
project="string",
schema="string",
service_name="string",
subject_name="string",
compatibility_level="string",
schema_type="string")
const kafkaSchemaResource = new aiven.KafkaSchema("kafkaSchemaResource", {
project: "string",
schema: "string",
serviceName: "string",
subjectName: "string",
compatibilityLevel: "string",
schemaType: "string",
});
type: aiven:KafkaSchema
properties:
compatibilityLevel: string
project: string
schema: string
schemaType: string
serviceName: string
subjectName: string
KafkaSchema Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The KafkaSchema resource accepts the following input properties:
- Project string
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Schema string
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- Service
Name string - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Subject
Name string - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- Compatibility
Level string - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - Schema
Type string - Kafka Schema type JSON or AVRO
- Project string
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Schema string
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- Service
Name string - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Subject
Name string - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- Compatibility
Level string - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - Schema
Type string - Kafka Schema type JSON or AVRO
- project String
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema String
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- service
Name String - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject
Name String - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- compatibility
Level String - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - schema
Type String - Kafka Schema type JSON or AVRO
- project string
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema string
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- service
Name string - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject
Name string - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- compatibility
Level string - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - schema
Type string - Kafka Schema type JSON or AVRO
- project str
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema str
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- service_
name str - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject_
name str - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- compatibility_
level str - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - schema_
type str - Kafka Schema type JSON or AVRO
- project String
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema String
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- service
Name String - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject
Name String - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- compatibility
Level String - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - schema
Type String - Kafka Schema type JSON or AVRO
Outputs
All input properties are implicitly available as output properties. Additionally, the KafkaSchema resource produces the following output properties:
Look up Existing KafkaSchema Resource
Get an existing KafkaSchema resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: KafkaSchemaState, opts?: CustomResourceOptions): KafkaSchema@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
compatibility_level: Optional[str] = None,
project: Optional[str] = None,
schema: Optional[str] = None,
schema_type: Optional[str] = None,
service_name: Optional[str] = None,
subject_name: Optional[str] = None,
version: Optional[int] = None) -> KafkaSchemafunc GetKafkaSchema(ctx *Context, name string, id IDInput, state *KafkaSchemaState, opts ...ResourceOption) (*KafkaSchema, error)public static KafkaSchema Get(string name, Input<string> id, KafkaSchemaState? state, CustomResourceOptions? opts = null)public static KafkaSchema get(String name, Output<String> id, KafkaSchemaState state, CustomResourceOptions options)resources: _: type: aiven:KafkaSchema get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Compatibility
Level string - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - Project string
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Schema string
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- Schema
Type string - Kafka Schema type JSON or AVRO
- Service
Name string - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Subject
Name string - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- Version int
- Kafka Schema configuration version.
- Compatibility
Level string - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - Project string
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Schema string
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- Schema
Type string - Kafka Schema type JSON or AVRO
- Service
Name string - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- Subject
Name string - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- Version int
- Kafka Schema configuration version.
- compatibility
Level String - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - project String
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema String
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- schema
Type String - Kafka Schema type JSON or AVRO
- service
Name String - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject
Name String - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- version Integer
- Kafka Schema configuration version.
- compatibility
Level string - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - project string
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema string
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- schema
Type string - Kafka Schema type JSON or AVRO
- service
Name string - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject
Name string - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- version number
- Kafka Schema configuration version.
- compatibility_
level str - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - project str
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema str
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- schema_
type str - Kafka Schema type JSON or AVRO
- service_
name str - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject_
name str - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- version int
- Kafka Schema configuration version.
- compatibility
Level String - Kafka Schemas compatibility level. The possible values are
BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVEandNONE. - project String
- Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- schema String
- Kafka Schema configuration should be a valid Avro Schema JSON format.
- schema
Type String - Kafka Schema type JSON or AVRO
- service
Name String - Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
- subject
Name String - The Kafka Schema Subject name. This property cannot be changed, doing so forces recreation of the resource.
- version Number
- Kafka Schema configuration version.
Import
$ pulumi import aiven:index/kafkaSchema:KafkaSchema kafka-schema1 project/service_name/subject_name
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Aiven pulumi/pulumi-aiven
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aivenTerraform Provider.
published on Monday, Mar 9, 2026 by Pulumi
