AivenKafka
Service-level Aiven Kafka topics, users, and ACLs component.
Remarks
This component supports creation and external references for Kafka topics, users, and ACLs. It emits resolved references by key. Configuration comes from either a typed definition or separate JSON files; the modes cannot be mixed. Typed handles preserve plan-time relationships and are resolved before resource registration; use { literal: '...' } for wildcard or external ACL subjects. Map keys determine child logical identity, while provider-level topicName and username remain independent. Created topics are always registered with Pulumi protect: true because Aiven topic replacement or deletion can destroy Kafka data.
Naming:
- Root: type
${namespace}:aiven:AivenKafka; capabilityaiven-kafka; logical-only raw identityargs.identity;${env}-${projectHash}-aiven-kafka-${sanitised args.identity}. Punctuation-only values fail shared logical-identity validation. - Direct
aiven:index/kafkaTopic:KafkaTopic,aiven:index/kafkaUser:KafkaUser, andaiven:index/kafkaAcl:KafkaAclchildren each use[args.identity, args.topics.<key> | args.users.<key> | args.acls.<key>], yielding${env}-${projectHash}-${sanitised args.identity}-${sanitised key}. Keys are raw identity discriminators and are preflighted per qualified provider type. - Provider names are Aiven-native semantic values, not AWS six-style names.
KafkaTopic.topicNameforwardsargs.topics.<key>.create.topicName, andKafkaUser.usernameforwardsargs.users.<key>.create.username, unchanged.KafkaAcl.permissionforwardsargs.acls.<key>.create.permission; itstopicandusernamecome from the existing literal-or-key-selector resolution and are trimmed before forwarding. Aiven Kafka topic names have a known 1–249-character constraint, intentionally left to provider validation; the component enforces only plain non-empty strings.args.service.projectandargs.service.serviceNameselect the native service scope after the existing trim-and-scope validation. Intentional.
Example
const topics = defineAivenKafkaTopics({
orders: { create: { topicName: 'company.orders.v1', partitions: 6, replication: 3 } },
});
const users = defineAivenKafkaUsers({ producer: { create: { username: 'svc-orders-producer' } } });
const definition = defineAivenKafkaDefinition({
topics,
users,
acls: { write: { create: { permission: 'write', topic: topics.orders, username: users.producer } } },
});
const kafka = new AivenKafka({
identity: 'orders',
service: { project: 'platform', serviceName: 'kafka-main' },
definition,
});
export const ordersTopicId = kafka.topicIdsByKey.orders;Constructors
new AivenKafka(
args: AivenKafkaArgs,
options?: ComponentResourceOptions,
): AivenKafka
Parameters
args(AivenKafkaArgs)options(ComponentResourceOptions, optional)
Returns
AivenKafka
Hierarchy
ComponentResourceAivenKafka
Properties
aclIdsByKey: Record<string, pulumi.Output<string>>
Resolved ACL ids keyed by canonical key.
aclsByKey: Record<string, pulumi.Output<AivenKafkaAclReferenceOutput>>
Resolved ACL references keyed by input key.
createdAcls: Record<string, aiven.KafkaAcl>
Create ACL resources keyed by input key.
createdTopics: Record<string, aiven.KafkaTopic>
Create topic resources keyed by input key.
createdUsers: Record<string, aiven.KafkaUser>
Create user resources keyed by input key.
project: Output<string>
Resolved project name for this component scope.
serviceName: Output<string>
Resolved service name for this component scope.
topicIdsByKey: Record<string, pulumi.Output<string>>
Resolved topic ids keyed by canonical key.
topicsByKey: Record<string, pulumi.Output<AivenKafkaTopicReferenceOutput>>
Resolved topic references keyed by input key.
urn: Output<string>
Inherited from urn
The stable logical URN used to distinctly address a resource, both before and after deployments.
userIdsByKey: Record<string, pulumi.Output<string>>
Resolved user ids keyed by canonical key.
usersByKey: Record<string, pulumi.Output<AivenKafkaUserReferenceOutput>>
Resolved user references keyed by input key.
Methods
getData(): Promise<any>
Inherited from getData
Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.
Returns
Promise<any>
getProvider(moduleMember: string): ProviderResource | undefined
Inherited from getProvider
Returns the provider for the given module member, if one exists.
Parameters
moduleMember(string)
Returns
ProviderResource | undefined
initialize(
args: Inputs,
opts?: ComponentResourceOptions,
name?: string,
type?: string,
): Promise<any>
Inherited from initialize
Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.
Parameters
args(Inputs)opts(ComponentResourceOptions, optional)name(string, optional)type(string, optional)
Returns
Promise<any>
registerOutputs(
outputs?: Inputs | Promise<Inputs> | Output<Inputs>,
): void
Inherited from registerOutputs
Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.
Parameters
outputs(Inputs | Promise<Inputs> | Output<Inputs>, optional)
Returns
void
Static Methods
isInstance(obj: any): obj is ComponentResource<any>
Inherited from isInstance
Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
Parameters
obj(any)
Returns
obj is ComponentResource<any>