@terraforge/core 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/index.mjs +23 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,13 +18,15 @@ npm i @terraforge/core @terraforge/terraform @terraforge/aws
|
|
|
18
18
|
## Example
|
|
19
19
|
|
|
20
20
|
First, you need to create a workspace instance and pass in the cloud providers that you will use.
|
|
21
|
-
We also need to give it a lock
|
|
21
|
+
We also need to give it a lock backend & state backend.
|
|
22
22
|
|
|
23
23
|
- A cloud provider is used to create resources on a specific cloud provider. We have built-in cloud providers for AWS resources, but you could simply add your own as well.
|
|
24
24
|
|
|
25
|
-
- The state
|
|
25
|
+
- The state backend is used for storing the latest deployment state.
|
|
26
26
|
|
|
27
|
-
- The lock
|
|
27
|
+
- The lock backend is used for acquiring a lock when you deploy your app. This will guarantee that multiple people can never deploy the same application at the same time.
|
|
28
|
+
|
|
29
|
+
- The activity log backend is used for storing the activity log when every you deploy / delete your app.
|
|
28
30
|
|
|
29
31
|
In this example, we will use a local file lock & state provider.
|
|
30
32
|
|
package/dist/index.mjs
CHANGED
|
@@ -984,25 +984,31 @@ const deployApp = async (app, opt) => {
|
|
|
984
984
|
let newResourceState;
|
|
985
985
|
const ignoreReplace = forcedUpdateDependents.has(meta$1.urn);
|
|
986
986
|
if (!ignoreReplace && requiresReplacement(nodeState.input, input, meta$1.config?.replaceOnChanges ?? [])) if (meta$1.config?.createBeforeReplace) {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
987
|
+
meta$1.resolve(input);
|
|
988
|
+
try {
|
|
989
|
+
for (const [dependentUrn, dependentNode] of nodeByUrn.entries()) {
|
|
990
|
+
if (!isResource(dependentNode)) continue;
|
|
991
|
+
const dependentMeta = getMeta(dependentNode);
|
|
992
|
+
if (!dependentMeta.dependencies.has(meta$1.urn)) continue;
|
|
993
|
+
const dependentStackState = stackStates.get(dependentMeta.stack.urn);
|
|
994
|
+
const dependentState = dependentStackState?.nodes[dependentUrn];
|
|
995
|
+
if (!dependentStackState || !dependentState) continue;
|
|
996
|
+
const dependencyPaths = findDependencyPaths(dependentMeta.input, meta$1.urn);
|
|
997
|
+
if (dependencyPaths.length === 0) continue;
|
|
998
|
+
const dependentProvider = findProvider(opt.providers, dependentMeta.provider);
|
|
999
|
+
if (dependentProvider.planResourceChange) {
|
|
1000
|
+
const dependentProposedInput = await resolveInputs(dependentMeta.input);
|
|
1001
|
+
if ((await dependentProvider.planResourceChange({
|
|
1002
|
+
type: dependentMeta.type,
|
|
1003
|
+
priorState: dependentState.output,
|
|
1004
|
+
proposedState: dependentProposedInput
|
|
1005
|
+
})).requiresReplacement) {
|
|
1006
|
+
if (!allowsDependentReplace(dependentMeta.config?.replaceOnChanges, dependencyPaths)) throw ResourceError.wrap(dependentMeta.urn, dependentMeta.type, "update", /* @__PURE__ */ new Error(`Replacing ${meta$1.urn} requires ${dependentMeta.urn} to set replaceOnChanges for its dependency fields.`));
|
|
1007
|
+
}
|
|
1004
1008
|
}
|
|
1005
1009
|
}
|
|
1010
|
+
} finally {
|
|
1011
|
+
meta$1.resolve(nodeState.output);
|
|
1006
1012
|
}
|
|
1007
1013
|
const priorState = { ...nodeState };
|
|
1008
1014
|
newResourceState = await createResource(node, appState.idempotentToken, input, opt);
|