Skip to content

Commit

Permalink
docs(readme): update with new command
Browse files Browse the repository at this point in the history
  • Loading branch information
justinrubek committed Feb 17, 2023
1 parent c0a4047 commit 1b8b2a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Any `.nix` files included will be built into JSON using terranix and included in

# getting started

## quickstart

You may use one of the templates to get started:

Initialize in the current directory:
Expand All @@ -18,14 +20,17 @@ Or, create a new one

`nix flake new --template github:justinrubek/thoenix#flake-module ./terraform-project`

- The `flake-module` template exposes a [flake-parts](https://github.com/hercules-ci/flake-parts) module that can be used to expose your configuration as flake outputs.
- The `lib` example allows for more manual control over the final output values.


## other info

The `flake-module` template exposes a [flake-parts](https://github.com/hercules-ci/flake-parts) module that can be used to expose your configuration as flake outputs.
The `lib` example allows for more manual control over the final output values.
The flake's `cli` package includes a `terraform` subcommand which builds the terranix configuration and invoke `terraform`.

Each template comes with a helper script, `tnix`, which can be used to run terraform commands from within individual configurations.
The arguments `tnix` is called with are passed to the terraform cli with the exception of the first one which specifies which configuration to use.
To initialize terraform after using the template you would run `tnix core init` from the default devShell.
The value `core` refers to the name of the terraform configuration to use-- the subdirectory of the terraform configuration directory given to thoenix.
- The first argument is the configuration's name, which corresponds a subdirectory in the repo's `terraform/configurations` directory. Terraform will be invoked within that directory.
- All other arguments are passed through to terraform. You may need to escape some, i.e. `thoenix terraform apps init -- -upgrade`
- This assumes that the configuration name is a flake output package: `.#terraformConfiguration/{name}`

# why use this

Expand Down
3 changes: 0 additions & 3 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use clap::Parser;
use tracing::info;

mod commands;
mod error;
Expand Down Expand Up @@ -29,9 +28,7 @@ async fn main() -> AppResult<()> {
Commands::Terraform(terraform) => {
let mut terraform = terraform.spawn_command().await?;
let status = terraform.wait().await?;
info!(?status);

// If the process exited with a non-zero exit code, return an error
if !status.success() {
let code = status.code().expect("no exit code");
return Err(error::AppError::TerraformError(code));
Expand Down

0 comments on commit 1b8b2a7

Please sign in to comment.