ModuleCall class base

A module "<localName>" { ... } call as a Dart value.

The call is a reference to a Terraform module that lives outside the Stack — a local directory, a registry entry, a git URL. TerraDart does not look inside it: source is copied verbatim, inputs are the module's variables, and its outputs are read back as TfRefs.

final sa = addModule(ModuleCall(
  'sa_bff',
  source: '../modules/service_account',
  inputs: {'account_id': .literal('app-bff-sa')},
));
add(GoogleProjectIamMember(
  'bff_invoker',
  project: .literal('my-project'),
  role: .literal('roles/run.invoker'),
  member: .arg(sa.output<String>('member')),
));

terradart-migrate generates a typed subclass per local module directory, with a named parameter per variable block and a getter per output: ServiceAccountModule('sa_bff', source: '...', accountId: ...) and sa.member.

base rather than final for exactly that: a subclass may narrow the constructor, but the fields synth reads stay this class's.

Implemented types

Constructors

ModuleCall(String localName, {required String source, String? version, Map<String, TfArg?> inputs = const {}, Map<String, StackProvider> providers = const {}, List<TfAddressed>? dependsOn, TfArg<num>? count, TfArg<Object?>? forEach})

Properties

count → TfArg<num>?
Optional count = <n>. The call's instances are then addressed module.<localName>[0], which no output of this object spells — read an instance with TfArg.expression.
final
dependsOn → List<TfAddressed>?
Optional depends_on = [...], like a resource's.
final
forEach → TfArg<Object?>?
Optional for_each = <collection>. Same addressing caveat as count.
final
hashCode → int
The hash code for this object.
no setterinherited
inputs → Map<String, TfArg?>
The module's input variables, keyed by their Terraform name. A null value is dropped, like an unset resource argument.
final
localName → String
The call's name within the Stack: module "<localName>".
final
providers → Map<String, StackProvider>
providers = { <child name> = <this Stack's provider> }: the child module's provider name ('google', 'google.eu') mapped to a provider configuration the Stack registers.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
source → String
source = "<source>", verbatim — a local path (relative to the directory the Stack synthesizes into), a registry address, a git URL.
final
tfAddress → String
Terraform address of this block, e.g. google_pubsub_topic.orders or data.google_project.current.
no setteroverride
version → String?
version = "<version>" for a registry module, or null.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
output<T>(String name) → TfRef<T>
${module.<localName>.<name>}: one of the module's outputs.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

reservedInputNames → const Set<String>
The names Terraform reserves on a module block, so an input of the same name would silently become a meta-argument. A module cannot declare a variable with any of them either, so nothing legitimate is turned away. provider (singular) is not among them — it is a resource meta-argument, and an ordinary input on a module call.