1 unstable release
Uses new Rust 2024
| 0.1.0 | Dec 16, 2024 |
|---|
#405 in Template engine
13KB
π¦ fl8 β Lightweight Cloud-Agnostic IaC Library
fl8 is a Rust library for infrastructure as code (IaC), designed to be cloud-agnostic, enabling deployment across AWS, other cloud providers, and SaaS platforms. Its goal is to provide a fast, type-safe, and modular framework for defining infrastructure resources and deployments.
π§© Features
- Define cloud infrastructure in Rust with strong typing
- Focused on performance, leveraging Rustβs speed and memory safety
- Support for multiple clouds and SaaS platforms
- Modular resource definitions with optional stacks and constructs
- Easy-to-extend library with examples and tests included
π¦ Installation
Add fl8 as a dependency in your Cargo.toml:
[dependencies]
fl8 = "0.1.0"
π Project Structure
fl8/
ββ .devcontainer/ # VS Code DevContainer configuration
ββ .vscode/ # VS Code settings & tasks
ββ examples/ # Examples
ββ src/ # Rust source code
ββ tests/ # Tests
ββ Cargo.toml # Rust project manifest
ββ rustfmt.toml # Rust formatter configuration
ββ README.md
π» CLI Commands
fl8 provides a lightweight command-line interface for managing your infrastructure. The two primary commands are plan and launch.
πΊοΈ fl8 plan
The plan command previews the changes that will be made by your infrastructure definitions without applying them. It acts as a dry run.
fl8 plan
- Analyzes your resource definitions.
- Shows a summary of resources that will be created, updated, or deleted.
- Useful to review the impact of changes before deployment.
Example output:
Plan: 3 to add, 1 to modify, 0 to destroy
- AWS::S3::Bucket "my-bucket" -> create
- AWS::Lambda::Function "handler" -> create
- Postgres::Database "app-db" -> modify
π fl8 launch
The launch command executes the deployment based on your current stack or construct definitions.
fl8 launch
- Applies the planned changes to your cloud provider.
- Creates, updates, or deletes resources as necessary.
- Automatically tracks the deployment state for future runs.
Example output:
fl8 plan # Preview the changes first
fl8 launch # Apply the changes
Notes:
- Itβs recommended to run fl8 plan before fl8 launch.
- The command respects resource dependencies and deployment order.
π© Optional Flags
You can extend the CLI with optional flags for more control:
--stack <name>: Deploy a specific stack.--construct <name>: Deploy a specific construct.--dry-run: Show the plan without making changes (similar to plan).
Example:
fl8 launch --stack my-stack --dry-run
π’ Getting Started
Requirements
- VS Code with Remote Containers extension
- Podman or Docker
- Rust toolchain (automatically installed in Dev Container)
- AWS CLI
βοΈ Development Setup
- Clone the repository:
git clone https://github.com/kodlot/fl8.git
cd fl8
-
Open VS Code and Reopen in Dev Container.
-
Dev Container will automatically install:
- Rust (stable, 2024 edition)
rustfmtandclippy- Rust Analyzer extension
- AWS CLI
- Start coding! Rust files will auto-format on save, and Clippy can be run via VS Code Tasks.
β Running Tests
cargo test
This command will:
- Compile your crate and its dependencies.
- Run all unit tests defined in
#[cfg(test)]modules. - Show detailed output for passed, failed, and ignored tests.
π‘ Running Examples
cargo run --example example_stack
β¨ Formatting and Linting
- Auto-format on save is enabled (
rustfmt). - To manually format:
cargo fmt
- To run lint checks:
cargo clippy --all-targets --all-features
π Contributing
We welcome contributions! Please open issues or submit pull requests for bug fixes, new features, or improvements. By contributing, you agree that your contributions will be licensed under the Apache 2.0 license.
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -m "Description" - Push to branch:
git push origin feature-name - Open a Pull Request
βοΈ License
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
π€οΈ Roadmap
- Implement first stable IaC deployment engine
- Add project/stack/construct resource organization
- Improve CLI and automation tooling
Dependencies
~2.4β4MB
~67K SLoC