variable

Variables are module-level objects that essentially act as parameters for the module. When running Powerpipe, you can pass values on the command line, from a .ppvars file, or from environment variables, and you will be prompted for any variables that have no values.

You can reference variable values as var.<NAME>

Example Usage

variable "instance_state" {
type = string
default = "stopped"
}
query "instances_in_state" {
sql = "select instance_id, instance_state from aws_ec2_instance where instance_state = $1;"
param "find_state" {
default = var.instance_state
}
}

Argument Reference

ArgumentTypeOptional?Description
defaultAnyOptionalA default value. If no value is passed, the user is not prompted and the default is used.
descriptionStringOptionalA description of the variable. This text is included when tne user is prompted for a variable's value.
typeStringOptionalThe variable type. This may be a simple type or a collection.

Variable Types

Variables may be simple types:

  • string
  • number
  • bool

Variables may also be collection types:

  • list(<TYPE>)
  • set(<TYPE>)
  • map(<TYPE>)
  • object({<ATTR NAME> = <TYPE>, ... })
  • tuple([<TYPE>, ...])

The keyword any may be used to indicate that any type is acceptable.