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
| Argument | Type | Required/Optional | Description |
|---|---|---|---|
name | String | Required | The name of the variable. This is how you reference it in scripts. |
value | String | Required | The 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>