magma_protocol/lib.rs
1//! magma-protocol — tfplugin5.proto + tfplugin6.proto Rust bindings.
2//!
3//! The protocol surface every Terraform / OpenTofu provider speaks. Generated
4//! at build time by `tonic-build` from the vendored .proto files in `proto/`.
5//! No hand-written gRPC anywhere else in magma per `theory/MAGMA.md` §IX
6//! anti-patterns.
7//!
8//! Until proto files are vendored (M0), this crate exposes placeholder
9//! modules so dependent crates compile. Once the build script generates
10//! the real bindings, uncomment the `include_proto!` invocations below.
11
12/// Marker for which provider-plugin protocol version a `Plugin` speaks.
13/// Real gRPC client stubs live under `tfplugin5::*` and `tfplugin6::*`
14/// once the build script generates them.
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
16pub enum PluginProtocol {
17 /// tfplugin5 — deprecated but still produced by older providers.
18 V5,
19 /// tfplugin6 — current. Required for sensitive-mark propagation,
20 /// nested attribute types, optional-required-computed expression.
21 V6,
22}
23
24impl PluginProtocol {
25 #[must_use]
26 pub const fn version_str(self) -> &'static str {
27 match self {
28 Self::V5 => "5",
29 Self::V6 => "6",
30 }
31 }
32}
33
34// Generated at build time from `proto/tfplugin{5,6}.proto`. The .proto
35// files are vendored from OpenTofu's `internal/tfplugin{5,6}/` and
36// published under MPL-2.0 explicitly for plugin authors to copy.
37
38/// tfplugin5 v5.10 — deprecated but still produced by older providers.
39/// Generated by tonic-build from `proto/tfplugin5.proto`.
40#[allow(clippy::all)]
41#[allow(missing_docs)]
42pub mod tfplugin5 {
43 tonic::include_proto!("tfplugin5");
44}
45
46/// tfplugin6 — current; required for sensitive-mark propagation,
47/// nested attribute types, optional-required-computed expression.
48/// Generated by tonic-build from `proto/tfplugin6.proto`.
49#[allow(clippy::all)]
50#[allow(missing_docs)]
51pub mod tfplugin6 {
52 tonic::include_proto!("tfplugin6");
53}