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,) the Update 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 successful apply. - 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.

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.