#[non_exhaustive]pub struct Resource {Show 13 fields
pub address: Address,
pub kind: ResourceKind,
pub type_: Arc<str>,
pub name: Arc<str>,
pub provider_ref: Option<ProviderRef>,
pub count_expr: Option<Expression>,
pub for_each_expr: Option<Expression>,
pub depends_on: Vec<Address>,
pub attributes: AttributeMap,
pub account_id: Option<AccountId>,
pub account_name: Option<Arc<str>>,
pub region: Option<Region>,
pub span: Span,
}Expand description
A resource or data block, post-evaluator. Phase 1 only defines the
shape; population happens in Phase 3 (loader → IR) and onwards.
Field order matches 10-data-model.md § 2.2. Build with the generated
[ResourceBuilder] (typed-builder) — Resource { … } is rejected
outside this crate by #[non_exhaustive].
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.address: AddressFull TF address (e.g. module.pacer_db.aws_db_instance.this).
kind: ResourceKindresource vs data.
type_: Arc<str>Block label 1 (e.g. aws_db_instance).
name: Arc<str>Block label 2 (e.g. this).
provider_ref: Option<ProviderRef>Per-resource provider selection (provider = aws.<alias> attribute).
count_expr: Option<Expression>count = ... expression.
for_each_expr: Option<Expression>for_each = ... expression.
depends_on: Vec<Address>Explicit + inferred dependencies (graph phase fills inferred).
attributes: AttributeMapTop-level attributes of the body. Nested blocks land here as
crate::ir::Value::Map structures inside an
Expression::Literal once the loader has lowered them.
account_id: Option<AccountId>Resolved AWS account id (12 digits). Filled by the provider resolver
(Phase 7) per 16-provider-resolver.md § 4. None until resolution
runs or when no profile mapping could be inferred (the column then
emits "" per spec 10 § 3).
account_name: Option<Arc<str>>Human-friendly account name, from the profile-map entry the resolver
matched. None when unresolved or absent.
region: Option<Region>Resolved AWS region. Filled by the provider resolver (Phase 7) per
[16-provider-resolver.md § 4]. None until resolution runs.
span: SpanSource position of the opening resource/data keyword.
Implementations§
Source§impl Resource
impl Resource
Sourcepub fn builder() -> ResourceBuilder<((), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> ResourceBuilder<((), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building Resource.
On the builder, call .address(...), .kind(...), .type_(...), .name(...), .provider_ref(...)(optional), .count_expr(...)(optional), .for_each_expr(...)(optional), .depends_on(...)(optional), .attributes(...)(optional), .account_id(...)(optional), .account_name(...)(optional), .region(...)(optional), .span(...) to set the values of the fields.
Finally, call .build() to create the instance of Resource.