Output output

The output resource allows you to define output variables which can be used to return values from modules or with the jumppad output and env commands.

Note: output resources are module scoped, jumppad output will only show the value of output resources scoped at the top level.

Properties

  • Name
    value
    Type
    (interface: )
    Required
    required
    Readonly
    Description

    Value to set to the output, if this value contains an interpolated property from another resource, the output will be created after the referenced resource.

Meta Properties

In addition to the main properties, all resources have meta properties, such as the id of the resource. To see the list of these properties please see the Meta Properties section in the documentation /docs/resources/meta.

Examples

Simple Example

The following example shows how to use an output resource to configure the environment variable KUBECONFIG.

output "KUBECONFIG" {
  value = resource.k8s_cluster.k3s.kubeconfig
}

Lists of Values

The following output sets a list of numbers

output "list" {
  value = [1,2,3] 
}

This can be consumed using the following interpolation.

Note: Indexes for lists are 0 based.

output "list_value" {
  value = output.list.2 // 3
}

Maps of Values

The following output sets a map of values

output "map" {
  value = {
    list = [1,2,3]
    string = "hello world"
    submap = {
      foo = "bar"
    }
  }
}

This can be consumed using the following interpolation.

output "map_value_1" {
  value = output.map.list.2 // 3
}

output "map_value_2" {
  value = output.map.string // hello world
}

output "map_value_3" {
  value = output.map.submap.foo // bar
}