How to pass variables to a theme template file from EntityAPIController::buildContent() I may be going about this incorrectly, if so please point me in the right direction.

I currently have a custom entity type and I'm adding the display fields via a controller class that extends EntityAPIController. I want to attach some content from elsewhere (non-entities) to the display of this custom entity.

I have an implementation of hook_theme:

function module_theme($existing, $type, $theme, $path) {
  return [
    'module_plugin_instance' =&gt; [
    'template' =&gt; 'module-plugin-instance',
    'path' =&gt; $path . '/templates',
      'variables' =&gt; [
        'instance_id' =&gt; NULL,
      ],
    ],
  ];
}


Then, in EntityTypeController::buildContent() I have:

$buildContent['module_plugin_instance_' . $instance_id] = [
  '#theme' =&gt; 'module_plugin_instance'
];


Where I'm failing is I can't figure out how to pass variables to the theme template here.  The dummy html I'm putting in the template renders fine, just no variables.  I've tried several different things, but I can't seem to get $instance_id to my template - what am I doing wrong?
You can provide theme variables through properties, e.g.:

$buildContent['module_plugin_instance_' . $instance_id] = [
  '#theme' =&gt; 'module_plugin_instance',
  '#instance_id' =&gt; 'foo',
];