Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
852 changes: 436 additions & 416 deletions Cargo.lock

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description = "Plugin framework for Terraform and ToFu"
edition = "2021"
include = ["**/*.rs", "Cargo.toml", "LICENSE", "README.md", "proto/*.proto"]
license = "Apache-2.0"
readme = "README.md"
name = "tf-provider"
readme = "README.md"
repository = "https://github.com/aneoconsulting/tf-provider"
version = "0.2.2"

Expand All @@ -15,28 +15,29 @@ strip = "debuginfo"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1"
anyhow = "1.0"
async-stream = "0.3"
async-trait = "0.1"
base64 = "0.22"
futures = "0.3"
prost = "0.13"
rcgen = "0.13"
prost = "0.14"
rcgen = "0.14"
rmp-serde = "1.1"
serde = { version = "1.0", features = ["derive"] }
serde_bytes = "0.11"
serde_json = "1.0"
time = "0.3"
tokio = "1.0"
tokio = "1.48"
tokio-stream = { version = "0.1", features = ["net", "sync"] }
tokio-util = "0.7"
tonic = { version = "0.12", features = ["tls", "transport"] }
tower-http = { version = "0.5", features = ["trace"] }
tonic = { version = "0.14", features = ["tls-ring", "transport"] }
tonic-prost = { version = "0.14", features = [] }
tower-http = { version = "0.6", features = ["trace"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["fmt", "json", "std"] }

[build-dependencies]
tonic-build = "0.12"
tonic-prost-build = "0.14"

[dev-dependencies]
rand = "0.8"
rand = "0.9"
5 changes: 3 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
tonic_prost_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.message_attribute(".", "#[allow(dead_code)]")
.build_client(false)
.compile(
.compile_protos(
&["proto/plugin.proto", "proto/tfplugin6.5.proto"],
&["proto"],
)?;
Expand Down
6 changes: 3 additions & 3 deletions examples/terraform-provider-null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use std::borrow::Cow;

use anyhow::Result;
use async_trait::async_trait;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use rand::distr::Alphanumeric;
use rand::{rng, Rng};
use serde::{Deserialize, Serialize};

use tf_provider::schema::{
Expand Down Expand Up @@ -135,7 +135,7 @@ impl Resource for NullResource {
private_state: Self::PrivateState<'a>,
_provider_meta_state: Self::ProviderMetaState<'a>,
) -> Option<(Self::State<'a>, Self::PrivateState<'a>)> {
let id = thread_rng()
let id = rng()
.sample_iter(&Alphanumeric)
.take(30)
.map(char::from)
Expand Down
2 changes: 1 addition & 1 deletion src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ macro_rules! deserialize {
};
}

impl<'de, 'a> de::Deserializer<'de> for &'a mut Decoder<'de> {
impl<'de> de::Deserializer<'de> for &mut Decoder<'de> {
type Error = DecoderError;

deserialize!(deserialize_bool);
Expand Down
4 changes: 2 additions & 2 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ impl GrpcIo {
let (tx, _) = broadcast::channel(capacity);
Self { tx }
}
pub fn stdout(&self) -> GrpcIoStream {
pub fn stdout(&self) -> GrpcIoStream<'_> {
GrpcIoStream {
tx: &self.tx,
channel: 1,
}
}
pub fn stderr(&self) -> GrpcIoStream {
pub fn stderr(&self) -> GrpcIoStream<'_> {
GrpcIoStream {
tx: &self.tx,
channel: 2,
Expand Down
10 changes: 5 additions & 5 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl Serialize for AttributeType {
S: serde::Serializer,
{
struct AttributesAsType<'a>(&'a HashMap<String, Attribute>);
impl<'a> Serialize for AttributesAsType<'a> {
impl Serialize for AttributesAsType<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand Down Expand Up @@ -317,11 +317,11 @@ impl Serialize for AttributeType {

impl Display for AttributeType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
return f.write_str(
f.write_str(
serde_json::to_string(self)
.or(Err(std::fmt::Error))?
.as_str(),
);
)
}
}

Expand Down Expand Up @@ -428,11 +428,11 @@ impl Serialize for Type {

impl Display for Type {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
return f.write_str(
f.write_str(
serde_json::to_string(self)
.or(Err(std::fmt::Error))?
.as_str(),
);
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ impl From<String> for Value<Cow<'_, str>> {
}
}

impl<'a> Deref for Value<Cow<'a, str>> {
impl Deref for Value<Cow<'_, str>> {
type Target = str;

fn deref(&self) -> &Self::Target {
Expand Down
Loading