| Crates.io | tf-bindgen-core |
| lib.rs | tf-bindgen-core |
| version | 0.1.0 |
| created_at | 2023-04-16 12:54:02.823311+00 |
| updated_at | 2023-04-16 12:54:02.823311+00 |
| description | Traits and structures used by tf-bindgen's generated code. |
| homepage | |
| repository | https://github.com/robert-oleynik/tf-bindgen |
| max_upload_size | |
| id | 840542 |
| size | 11,342 |
tf-bindgen can be used to generate Rust bindings for Terraform providers and
to deploy your infrastructure.
This library will replicate most features of CDK for Terraform but written in Rust.
Required tools:
cargoterraformtf-bindgen?tf-bindgen is a code generator which will generate Rust code to configure infrastructure using Terraform. The following example shows how to use tf-bindgen to configure a Kubernetes pod running nginx:
fn init() -> Stack {
let stack = Stack::new("nginx");
/// Configure Resources using a builder
let metadata = KubernetesNamespaceMetadata::builder()
.name("nginx")
.build();
let namespace = KubernetesNamespace::create(&stack, "nginx-namespace")
.metadata(metadata)
.build();
/// Configure Resources using the resource! macro
resource! {
&stack, resource "kubernetes_pod" "nginx" {
metadata {
namespace = &namespace.metadata[0].name
name = "nginx"
}
spec {
container {
name = "nginx"
image = "nginx"
port {
container_port = 80
}
}
}
}
};
stack
}
See Documentation for a full introduction into tf-bindgen.
Some Providers like tf-kubernetes will generate large bindings, resulting in long compile durations. If you have this issue, please see the Improving Compile Duration section.
v0.1:
tf_bindgen::codegen::resourcev0.2:
format! for Value typesAs mentioned above, this library will replicate features provided by CDK for Terraform. It is not a one to one replacement for Rust and will be different in some aspects of the implementation:
cdktf (library and CLI application) are not needed to use this librarytf-bindgen constructs are not compatible with CDK constructs.This project is licensed under the BSD-3-Clause license.