...
A resource has many properties, some that can be set as part of configuring the resource, and some that only exists exist after the resource has been created. This could for instance be an identifier that is generated on creation and used from other resources to easily link related resources together.
A resource can be created, updated, and deleted by the config management system. This allows the management of resources consistently between environments.
...
A variable
is a special kind of value, where the value itself is not defined as part of the configuration , but is provided from an external system. This could be things like keys for Azure blob storage, which is something that needs to be different between environments, but where the underlying purpose of having a "blob storage" is the same.
...
Code Block |
---|
variable my_variable { type = "string" } |
The system will throw you an error if you do not have the variable in use in any resource.
Variables have to be used in the layer they are defined in. If you want to use a variable in multiple layers, you will have to add an identical variable to the other layer it should be used in. This will make the variable only show up once in the variable editor.
You may choose to define a default value. A string field with a default would appear as such:
Code Block |
---|
variable my_variable {
type = "string"
default = 'Some default text'
} |
If you have the same variable key in multiple layers, you do have the option to have the defaults be different (if you define one, you have to define all others). It will appear as such in the variable editor.
...
Locals
Locals a temporary values that are used internally to allow easily reusing certain values without repeating them over and over.
...