Update Step* Types to take in config data as opposed to reading from state #8520
Labels
enhancement
good first issue
tech-debt
Issues and pull requests related to addressing technical debt or improving the codebase
Configuration data provided to builders, provisioners, and post-processors is often stored in a state bag
state.Put("config", &p.config)
in order to share data between steps needed to compute the builder/provisioner/post-processor run. While this is a convenient way of sharing data across steps it is an anti-pattern as most steps only ever need a subset of the configuration data, and because getting the config data from statestate.Get("config").(*Config)
requires a bit type casting.In an effort to help mitigate potential issues with sharing configuration data between steps we would like to update Step types for builders/provisioners/post-processors so that they have fields for the config data they need, as opposed to relying on
config
being saved in a shared state bag.This issue proposes the following changes to any builder/provisioner/post-processor that is currently relying on
state.Get("config").(*Config)
for obtaining read-only config data.state.get("config").(*Config)
from the step's Run function; replacing the data with the new data stored in the Step type.state.Put("config", &b.config)
when all step types have been updated.Example
Becomes
Please note to help with reviewing these changes it is advised to open one pull-request per updated step type.
The text was updated successfully, but these errors were encountered: