TfMoved class final

One moved { from = ... to = ... } block: the state object at from now belongs to the resource at to, so a rename does not become a destroy-and-create.

Register these on a Stack with addMoved; synth emits the collected entries under the top-level moved key. Addresses are written the way Terraform writes them: google_pubsub_topic.orders, google_pubsub_topic.orders[0], google_pubsub_topic.orders["eu"], module.events.google_pubsub_topic.orders.

// `count = 2` unrolled into two resources, state preserved.
add(GooglePubsubTopic('orders_0', name: .literal('orders-0')));
add(GooglePubsubTopic('orders_1', name: .literal('orders-1')));
addMoved('google_pubsub_topic.orders[0]', 'google_pubsub_topic.orders_0');
addMoved('google_pubsub_topic.orders[1]', 'google_pubsub_topic.orders_1');

to must name a resource registered on the same Stack (or an address inside a module. call); from is any address, since the object it names exists only in state. Synth checks both.

Annotations
  • @immutable

Constructors

TfMoved({required String from, required String to})
const

Properties

from → String
The address the state object had.
final
hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
to → String
The address it has now.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override
toTfJson() → Map<String, String>
The block body as Terraform JSON writes it.

Operators

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