Skip to main content

Variables

Variables in ImageFactory allow you to store configuration values that can be referenced within your custom components. This is useful for managing environment-specific settings or secrets.

Basic Example

resource "imagefactory_variable" "app_version" {
name = "APP_VERSION"
value = "1.2.3"
}

resource "imagefactory_custom_component" "install_app" {
name = "install-app"
stage = "BUILD"
cloud_providers = ["AWS"]
os_types = ["LINUX"]

content {
provisioner = "SHELL"
script = <<-EOT
#!/bin/bash
echo "Installing version $APP_VERSION"
# ...
EOT
}
}

Argument Reference

ArgumentTypeRequired/OptionalDescription
nameStringRequiredThe name of the variable. This is how you reference it in scripts.
valueStringRequiredThe value of the variable.

Usage in Components

When you define a variable in ImageFactory, it is automatically made available as an environment variable during the execution of your custom components.

For more details on how variables work, see the Variables page.

Import

terraform import imagefactory_variable.main <VARIABLE_NAME>