Fix state.sls_id

This resolves three issues:

1. outputter not properly specified for this function
2. multiple state declarations under the same ID declaration are not
   reflected in the output
3. traceback occurs when ID is not found in the specified mods
Merge pull request #17039 from terminalmage/issue17017

Fix state.sls_id