Skip to content

WIT

world.wit
package component:pulumi-wasm@0.0.0-NIGHTLY-1c8ffe5;

world pulumi-wasm {
    export output-interface;
    export register-interface;
    export stack-interface;
    export component:pulumi-wasm-external/pulumi-settings@0.0.0-STABLE-DEV;

    import component:pulumi-wasm-external/log@0.0.0-STABLE-DEV;
    import component:pulumi-wasm-external/external-world@0.0.0-STABLE-DEV;
}

world client {
    import output-interface;
    import stack-interface;
    export component:pulumi-wasm-external/pulumi-main@0.0.0-STABLE-DEV; // Used by macro
}

world logger {
    import component:pulumi-wasm-external/log@0.0.0-STABLE-DEV;
}

world runner {
    export component:pulumi-wasm-external/pulumi-main@0.0.0-STABLE-DEV;
    export component:pulumi-wasm-external/pulumi-settings@0.0.0-STABLE-DEV;
    import component:pulumi-wasm-external/external-world@0.0.0-STABLE-DEV;
    import component:pulumi-wasm-external/log@0.0.0-STABLE-DEV;
}

interface output-interface {

    resource output {
        constructor(value: string);
        map: func(function-name: string) -> output;
    }
    combine: func(outputs: list<borrow<output>>) -> output;
}

interface stack-interface {
    use output-interface.{output};

    record function-invocation-request {
        id: output,
        function-id: string,
        value: string,
    }
    record function-invocation-result {
        id: borrow<output>,
        value: string,
    }
    add-export: func(name: string, value: borrow<output>);
    finish: func(functions: list<function-invocation-result>) -> list<function-invocation-request>;
}


interface register-interface {
    use output-interface.{output};

    record object-field {
        name: string,
        value: borrow<output>
    }

    record result-field {
        name: string
    }

    record register-resource-result-field {
        name: string,
        output: output
    }

    record register-resource-request {
        %type: string,
        name: string,
        object: list<object-field>,
        results: list<result-field>
    }

    record register-resource-result {
        fields: list<register-resource-result-field>
    }

    register: func(request: register-resource-request) -> register-resource-result;

    record resource-invoke-result-field {
        name: string,
        output: output
    }

    record resource-invoke-request {
        token: string,
        object: list<object-field>,
        results: list<result-field>
    }

    record resource-invoke-result {
        fields: list<resource-invoke-result-field>
    }

    invoke: func(request: resource-invoke-request) -> resource-invoke-result;
}
pulumi-wasm-external.wit
package component:pulumi-wasm-external@0.0.0-STABLE-DEV;

interface external-world {
    is-in-preview: func() -> bool;
    get-root-resource: func() -> string;
    register-resource-outputs: func(request: list<u8>) -> list<u8>;

    record resource-invoke-request {
        output-id: string,
        body: list<u8>
    }

    record register-resource-request {
        output-id: string,
        body: list<u8>
    }

    record registered-resource {
        output-id: string,
        body: list<u8>
    }

    resource-invoke: func(request: resource-invoke-request);
    register-resource: func(request: register-resource-request);
    wait-for-resource-operations: func() -> list<registered-resource>;
}

interface log {

    enum level {
        TRACE,
        DEBUG,
        INFO,
        WARN,
        ERROR
    }

    record content {
        level: level,
        target: string,
        args: string,
        module-path: option<string>,
        file: option<string>,
        line: option<u32>,
        key-values: list<tuple<string, string>>
    }

    log: func(content: content);
}

interface pulumi-settings {
    set-in-preview: func(in-preview: bool);
}

interface pulumi-main {
    main: func();
}

Interfaces

Output

Allow working with Outputs (so maybe not yet set values managed by Pulumi). Interface allows creating and mapping underlying values. It also allows to combine list of outputs into output of list

Stack

(Name to be changed). Currently, this interface allows adding output as export (Pulumi docs). And invoking finish function - explained in Output.

Pulumi main

Entrypoint to program that will be invoked by pulumi-wasm-runner. In Rust case it is created by pulumi_wasm macro.

Log

Allows logging from within provider (used mostly for main pulumi-wasm component)

Register

Interface that allows registering of Pulumi resources. Used only by providers.

External world

Interface used as a substitute until WASM gets proper GRPC client support. It is used by main pulumi-wasm component binary and is implemented by pulumi-wasm-runner.

Worlds

client world

World used by client languages. Imports output and stack interfaces and exports pulumi-main interface.

pulumi-wasm world

World used by main pulumi-wasm component. A

logger world

World that only contains log interface.