Skip to content

Commit

Permalink
add example of passing args to set dependendcy mod vars, update versi…
Browse files Browse the repository at this point in the history
…on dependency docs for steampipe and plugins for changes in .20
  • Loading branch information
johnsmyth committed May 16, 2023
1 parent a8cf9cb commit d0ba0d2
Showing 1 changed file with 37 additions and 28 deletions.
65 changes: 37 additions & 28 deletions docs/reference/mod-resources/mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Every mod must contain a `mod.sp` file with a single `mod` block.

The `mod` block contains metadata for the mod (including metadata used in the hub site and social media), as well as dependency data. A mod author may edit the mod block directly, but Steampipe will **also** edit the file, adding, removing and modifying dependencies in the file when users add and remove mods via the [`steampipe mod` commands](/docs/reference/cli/mod). For this reason, it is recommended that the `mod.sp` *only* contain a `mod` block; do not add other mod resources (`query`, `control`, `dashboard`, etc) to this file.

The block name (`aws_cis` in the example) is the mod name. <!-- This name is used as the name of the mod if it is not aliased when imported via a `require` block. --> Mod names use lower_snake_case. They may contain lowercase chars, numbers or underscores, and must start with a letter.
The block name (`aws_cis` in the example) is the mod name. Mod names use lower_snake_case. They may contain lowercase chars, numbers or underscores, and must start with a letter.


## Example Usage
Expand All @@ -30,14 +30,16 @@ mod "aws_cis" {
}
require {
steampipe = "0.10.0"
steampipe {
min_version = "0.20.0"
}
plugin "aws"{
version = "0.86"
plugin "aws" {
min_version = "0.86.0"
}
plugin "gcp"{
version = "0.29"
plugin "gcp" {
min_version = "0.29.0"
}
mod "github.com/turbot/steampipe-mod-aws-compliance" {
Expand Down Expand Up @@ -81,15 +83,17 @@ A mod may contain a `require` block to specify version dependencies for the Stea
A mod may specify a dependency on the Steampipe CLI. Steampipe will evaluate the dependency when the mod is loaded, and will error if the constraint is not met, but it will not install or upgrade the CLI. A `steampipe` constraint specifies a *minimum version*, and does not support semver syntax:
```hcl
require {
steampipe = "0.10.0"
steampipe {
min_version = "0.20.0"
}
}
```

A mod may specify a dependency on one or more plugins. Steampipe will evaluate the dependency when the mod is loaded, and will error if the constraint is not met, but it will not install or upgrade the plugin. A `plugin` constraint specifies a *minimum version*, and does not support semver syntax:
```hcl
require {
plugin "aws"{
version = "0.24"
plugin "aws" {
min_version = "0.24.0"
}
}
```
Expand All @@ -110,27 +114,32 @@ require {
}
```

<!--
You may optionally specify an `alias`, which is useful when have a name collision (as when requiring multiple versions of a given mod):
```
require {
You may pass `args` to set variables defined in the dependency mods. You can pass hard-coded values (literals), however it is more common to define variables in your mod that encapsulate the variables and optionality of your dependencies:

mod "github.com/turbot/steampipe-mod-aws-compliance" {
version = "2.0"
alias = "aws_compliance2"
}

```hcl
variable "common_dimensions" {
type = list(string)
description = "A list of common dimensions to add to each control."
default = [ "account_id", "region" ]
}
```
-->
<!--
```
require {
# use a local mod for testing...
mod "github.com/kaidaguerre/steampipe-mod-aws-compliance" {
version = "file://~/src/steampipe-mod-aws-compliance"
alias = "foo"
variable "tag_dimensions" {
type = list(string)
description = "A list of tags to add as dimensions to each control."
default = []
}
mod "aws_well_architected" {
require {
mod "github.com/turbot/steampipe-mod-aws-compliance" {
version = "^0.63.0"
args = {
common_dimensions = var.common_dimensions,
tag_dimensions = var.tag_dimensions
}
}
}
}
```
-->
```

0 comments on commit d0ba0d2

Please sign in to comment.