pub struct ProviderSchema {
pub provider_config: CtyType,
pub resources: BTreeMap<String, CtyType>,
pub data_sources: BTreeMap<String, CtyType>,
pub resource_versions: BTreeMap<String, i64>,
}Expand description
A provider’s schema reduced to the implied cty types the apply codec needs: the provider-config type + each managed resource’s type.
Fields§
§provider_config: CtyType§resources: BTreeMap<String, CtyType>§data_sources: BTreeMap<String, CtyType>Data-source implied types (data.<type>), needed to encode a
ReadDataSource config + decode its result. Without these the apply
engine cannot evaluate ${data.*} references (the rio-drive leak).
resource_versions: BTreeMap<String, i64>Each managed resource type’s CURRENT schema version, as declared by
the provider’s GetProviderSchema/GetSchema response (the
Schema.version field sibling to the Schema.block that
crate::schema::block_implied_type turns into resources’
implied types). The terraform plugin protocol requires
UpgradeResourceState to run whenever a stored StateInstance’s
schema_version is older than this — otherwise its raw attribute
JSON (persisted under the OLD schema) gets decoded straight against
the NEW implied type, which a schema change can silently
misinterpret or fail to marshal. See
ProviderConn::upgrade_resource_state + ProviderSchema::resource_version.
Implementations§
Source§impl ProviderSchema
impl ProviderSchema
pub fn resource(&self, type_name: &str) -> Option<&CtyType>
pub fn data_source(&self, type_name: &str) -> Option<&CtyType>
Sourcepub fn resource_version(&self, type_name: &str) -> i64
pub fn resource_version(&self, type_name: &str) -> i64
The provider’s CURRENT schema version for type_name. 0 both for
a genuinely version-0 schema AND for a type the provider never
declared — matching Terraform’s own convention that an
un-versioned schema is version 0, so an unknown type never looks
artificially “newer” than a stored instance and never triggers a
spurious upgrade.
Sourcepub fn resource_version_u64(&self, type_name: &str) -> u64
pub fn resource_version_u64(&self, type_name: &str) -> u64
Self::resource_version clamped into magma_types::StateInstance’s
u64 schema_version field. Real provider schema versions are
always small non-negative integers in practice; this only differs
from the wire i64 for a malformed negative version (never
observed from a real provider), which clamps to 0 rather than
wrapping to a huge u64.
Trait Implementations§
Source§impl Clone for ProviderSchema
impl Clone for ProviderSchema
Source§fn clone(&self) -> ProviderSchema
fn clone(&self) -> ProviderSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more