@startuml
participant "Language SDK" order 10
box "Engine"
participant "Resource Monitor" order 15
participant "Step Generator" order 20
participant "Step Executor" order 25
end box
participant "Resource Provider" order 30

"Language SDK" -> "Resource Monitor" ++ : RegisterResourceRequest(type, name, inputs, options)
"Resource Monitor" -> "Step Generator" ++ : RegisterResourceEvent(type, name, inputs, options)
"Step Generator" -> "Step Executor" --++ : ImportStep(inputs, options)
note left
	This is fire-and-forget on the part of the step generator.
	The step will run in parallel with steps for other resources.
end note
"Step Executor" -> "Resource Provider" ++ : ReadRequest(type, id)
"Step Executor" <- "Resource Provider" -- : ReadResponse(current inputs, current state)
"Step Executor" -> "Resource Provider" ++ : CheckRequest(type, inputs, current inputs)
"Step Executor" <- "Resource Provider" -- : CheckResponse(inputs', failures)
"Step Executor" -> "Resource Provider" ++ : DiffRequest(type, inputs', current state, options)
"Step Executor" <- "Resource Provider" -- : DiffResponse(diffs)
"Resource Monitor" <- "Step Executor" -- : done(current state)
"Language SDK" <- "Resource Monitor" -- : RegisterResourceResponse(urn, ID, current state)
@enduml
