#[non_exhaustive]pub struct Component {
pub id: ComponentId,
pub path: Arc<Path>,
pub kind: ComponentKind,
pub files: Vec<SourceFile>,
pub variables: Vec<Variable>,
pub locals: Vec<Local>,
pub providers: Vec<ProviderBlock>,
pub resources: Vec<Resource>,
pub modules: Vec<ModuleCall>,
pub outputs: Vec<Output>,
pub terragrunt: Option<TerragruntConfig>,
pub state_backend: Option<StateBackend>,
}Expand description
An apply-able component (Terraform “root module”).
Field order matches 10-data-model.md § 2.1. Build via
[ComponentBuilder].
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.id: ComponentIdStable-within-a-run id.
path: Arc<Path>Path of the component dir, relative to crate::ir::Workspace::root.
kind: ComponentKindWhether this is an apply-able root or a reusable module body.
files: Vec<SourceFile>Source files belonging to this component (*.tf, *.tfvars,
terragrunt.hcl, …).
variables: Vec<Variable>variable "..." {} blocks declared in the component.
locals: Vec<Local>locals { ... } entries (flattened across multiple locals blocks).
providers: Vec<ProviderBlock>provider "..." {} declarations.
resources: Vec<Resource>resource and data blocks, post-evaluation. Module-expanded
resources from child modules are appended here at the graph phase.
modules: Vec<ModuleCall>module "name" { ... } call sites. Per
10-data-model.md § 2.1, the field is
named modules even though Workspace::modules
also exists — they are different types (ModuleCall here vs Module
there) and the local name matches the HCL keyword.
outputs: Vec<Output>output "..." {} blocks.
terragrunt: Option<TerragruntConfig>Terragrunt-driven configuration, if any.
state_backend: Option<StateBackend>Resolved state backend from terraform { backend ... } or
generate "backend".
Implementations§
Source§impl Component
impl Component
Sourcepub fn builder() -> ComponentBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> ComponentBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building Component.
On the builder, call .id(...), .path(...), .kind(...), .files(...)(optional), .variables(...)(optional), .locals(...)(optional), .providers(...)(optional), .resources(...)(optional), .modules(...)(optional), .outputs(...)(optional), .terragrunt(...)(optional), .state_backend(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of Component.