dtm apply
When applying a config file using dtm
, here’s what happens:
1 For Each Tool Defined in the Config
We compare the Tool, its State, and the Resoruce it has created before (if the state exists).
We generate a plan of changes according to the comparison result:
- If the Tool isn’t in the State, the
Create
interface will be called. - If the Tool is in the State, but the Config is different than the State (meaning users probably updated the config after the last
apply
,) theUpdate
interface will be called. - If the Tool is in the State, and the Config is the same as the State, we try to read the Resource.
- If the Resource doesn’t exist, the
Create
interface will be called. It probably suggests that the Resource got deleted manually after the last successfulapply
. - If the Resource does exist but drifted from the State (meaning somebody modified it), the
Update
interface will be called. - Last but not least, nothing would happen if the Resource is exactly the same as the State.
- If the Resource doesn’t exist, the
2 For Each State That Doesn’t Have a Tool in the Config
We generate a “Delete” change to delete the Resource. Since there isn’t a Tool in the config but there is a State, it means maybe the Resource had been created previously then the user removed the Tool from the Config, which means the user doesn’t want the Resource any more.
3 Flags
Short | Long | Default | Description |
---|---|---|---|
-f | —config-file | “config.yaml” | The path to the config file. |
-d | —plugin-dir | “~/.devstream/plugins” | The path to store plugins. |
-y | —yes | false | Apply directly without confirmation. |