Hi there.
I’m trying to get my head around different ways of specifying dependencies:
- addDependency(…)
- dependencies.push(…)
- dependsOn(…)
- dependables array
Like so:
someLaterStack.addDependency(someEarlierStack);
someLaterStack.dependencies.push(someEarlierStack);
someLaterStack.dependsOn(someEarlierStack);
and using dependables array like below
export class myResourceGroup extends Construct {
readonly myStorageAccount: StorageAccount;
readonly keyVault: KeyVault;
readonly dependables: ITerraformDependable;
constructor(…) {
this.myStorageAccount = new StorageAccount(…);
this.dependables = [this.myStorageAccount];
this.keyVault = new KeyVault(…);
this.dependables.push(this.keyVault);
}
}
I’m a bit new to the cdktf.
Question 1: what happens if I do not specify these dependencies, what would happen.
Question 2: And in the last case, how does cdktf know to use the dependables array as the dependency chain…
Question 3: I’ve noticed that sometimes we can get an error at synth if the dependables array is not populated… wherein myResourceGroup.keyVault would not be available if I did not push keyVault to dependables array. Why is that ?