Skip to main content

Module import

Module import 

Source
Expand description

magma-plugin::import — the typed ImportResourceState gRPC client call.

This is the missing keystone of magma’s adopt-a-pre-existing-resource capability. Given a dialed provider channel, a resource type_name, and a provider-specific id, it drives the provider’s ImportResourceState RPC and decodes each returned DynamicValue state into typed magma_types::ImportedInstance values.

It follows the exact RPC-call pattern the lifecycle integration tests use for PlanResourceChange / ApplyResourceChange: ProviderClient::new(channel) then client.method(req).await. The DynamicValue decode uses the same json-field path PlanResourceChange uses on the wire (magma has no msgpack decoder; a state that arrives only as msgpack surfaces a typed error rather than a silent wrong answer).

Functions§

import_resource_state
Drive the provider’s ImportResourceState RPC for (type_name, id) over a dialed gRPC channel, returning the typed imported resources.