clarify apply hook usage

This commit is contained in:
CJ Horton 2023-05-11 19:02:49 -07:00
parent bc084858b1
commit e5a6806206

View File

@ -39,10 +39,12 @@ func (c *Context) Apply(plan *plans.Plan, config *configs.Config) (*states.State
}
for _, rc := range plan.Changes.Resources {
// import is a no-op change, but we'd like to show some helpful output that mirrors
// the way we show other changes.
// Import is a no-op change during an apply (all the real action happens during the plan) but we'd
// like to show some helpful output that mirrors the way we show other changes.
if rc.Importing != nil {
for _, h := range c.hooks {
// In future, we may need to call PostApplyImport separately elsewhere in the apply
// operation. For now, though, we'll call Pre and Post hooks together.
h.PreApplyImport(rc.Addr, *rc.Importing)
h.PostApplyImport(rc.Addr, *rc.Importing)
}