@quadnix/octo 0.0.30 → 0.2.0
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/LICENSE +661 -0
- package/README.md +117 -8
- package/dist/app.type.d.ts +277 -19
- package/dist/app.type.js +80 -9
- package/dist/app.type.js.map +1 -1
- package/dist/decorators/action.decorator.d.ts +10 -6
- package/dist/decorators/action.decorator.js +19 -6
- package/dist/decorators/action.decorator.js.map +1 -1
- package/dist/decorators/anchor.decorator.d.ts +12 -5
- package/dist/decorators/anchor.decorator.js +12 -5
- package/dist/decorators/anchor.decorator.js.map +1 -1
- package/dist/decorators/enable-hook.decorator.d.ts +1 -1
- package/dist/decorators/enable-hook.decorator.js +1 -1
- package/dist/decorators/factory.decorator.d.ts +18 -34
- package/dist/decorators/factory.decorator.js +18 -34
- package/dist/decorators/factory.decorator.js.map +1 -1
- package/dist/decorators/model.decorator.d.ts +4 -6
- package/dist/decorators/model.decorator.js +2 -7
- package/dist/decorators/model.decorator.js.map +1 -1
- package/dist/decorators/module.decorator.d.ts +16 -10
- package/dist/decorators/module.decorator.js +16 -10
- package/dist/decorators/module.decorator.js.map +1 -1
- package/dist/decorators/on-event.decorator.d.ts +7 -2
- package/dist/decorators/on-event.decorator.js +5 -0
- package/dist/decorators/on-event.decorator.js.map +1 -1
- package/dist/decorators/resource.decorator.d.ts +50 -1
- package/dist/decorators/resource.decorator.js +38 -1
- package/dist/decorators/resource.decorator.js.map +1 -1
- package/dist/decorators/validate.decorator.d.ts +15 -1
- package/dist/decorators/validate.decorator.js +15 -1
- package/dist/decorators/validate.decorator.js.map +1 -1
- package/dist/errors/container.error.d.ts +18 -0
- package/dist/errors/container.error.js +18 -0
- package/dist/errors/container.error.js.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/module.error.d.ts +6 -0
- package/dist/errors/module.error.js +6 -0
- package/dist/errors/module.error.js.map +1 -1
- package/dist/errors/node.error.d.ts +56 -0
- package/dist/errors/node.error.js +56 -0
- package/dist/errors/node.error.js.map +1 -1
- package/dist/errors/schema.error.d.ts +14 -1
- package/dist/errors/schema.error.js +11 -1
- package/dist/errors/schema.error.js.map +1 -1
- package/dist/errors/terraform.error.d.ts +20 -0
- package/dist/errors/terraform.error.js +24 -0
- package/dist/errors/terraform.error.js.map +1 -0
- package/dist/errors/transaction.error.d.ts +93 -2
- package/dist/errors/transaction.error.js +83 -0
- package/dist/errors/transaction.error.js.map +1 -1
- package/dist/events/action.event.d.ts +8 -4
- package/dist/events/action.event.js +2 -4
- package/dist/events/action.event.js.map +1 -1
- package/dist/events/command.event.d.ts +43 -0
- package/dist/events/command.event.js +33 -0
- package/dist/events/command.event.js.map +1 -0
- package/dist/events/event.model.d.ts +26 -8
- package/dist/events/event.model.js +15 -7
- package/dist/events/event.model.js.map +1 -1
- package/dist/events/hook/commit.hook.event.d.ts +1 -7
- package/dist/events/hook/commit.hook.event.js +0 -6
- package/dist/events/hook/commit.hook.event.js.map +1 -1
- package/dist/events/hook/hook.event.d.ts +1 -3
- package/dist/events/hook/hook.event.js +0 -2
- package/dist/events/hook/hook.event.js.map +1 -1
- package/dist/events/hook/model.hook.event.d.ts +1 -7
- package/dist/events/hook/model.hook.event.js +0 -6
- package/dist/events/hook/model.hook.event.js.map +1 -1
- package/dist/events/hook/resource.hook.event.d.ts +1 -7
- package/dist/events/hook/resource.hook.event.js +0 -6
- package/dist/events/hook/resource.hook.event.js.map +1 -1
- package/dist/events/index.d.ts +5 -0
- package/dist/events/index.js +5 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/mode-result.event.d.ts +57 -0
- package/dist/events/mode-result.event.js +24 -0
- package/dist/events/mode-result.event.js.map +1 -0
- package/dist/events/mode.event.d.ts +61 -0
- package/dist/events/mode.event.js +32 -0
- package/dist/events/mode.event.js.map +1 -0
- package/dist/events/module.event.d.ts +7 -5
- package/dist/events/module.event.js +3 -4
- package/dist/events/module.event.js.map +1 -1
- package/dist/events/registration.event.d.ts +19 -15
- package/dist/events/registration.event.js +18 -14
- package/dist/events/registration.event.js.map +1 -1
- package/dist/events/serialization.event.d.ts +16 -13
- package/dist/events/serialization.event.js +15 -12
- package/dist/events/serialization.event.js.map +1 -1
- package/dist/events/state.event.d.ts +102 -0
- package/dist/events/state.event.js +69 -0
- package/dist/events/state.event.js.map +1 -0
- package/dist/events/terraform.event.d.ts +78 -0
- package/dist/events/terraform.event.js +55 -0
- package/dist/events/terraform.event.js.map +1 -0
- package/dist/events/transaction.event.d.ts +3 -40
- package/dist/events/transaction.event.js +1 -29
- package/dist/events/transaction.event.js.map +1 -1
- package/dist/functions/container/container.d.ts +54 -13
- package/dist/functions/container/container.js +64 -19
- package/dist/functions/container/container.js.map +1 -1
- package/dist/functions/container/test-container.d.ts +43 -29
- package/dist/functions/container/test-container.js +71 -43
- package/dist/functions/container/test-container.js.map +1 -1
- package/dist/functions/dependency/dependency.d.ts +84 -23
- package/dist/functions/dependency/dependency.js +84 -14
- package/dist/functions/dependency/dependency.js.map +1 -1
- package/dist/functions/diff/aggregate-resource-actions.d.ts +19 -0
- package/dist/functions/diff/aggregate-resource-actions.js +41 -0
- package/dist/functions/diff/aggregate-resource-actions.js.map +1 -0
- package/dist/functions/diff/diff-metadata.d.ts +21 -3
- package/dist/functions/diff/diff-metadata.js +18 -0
- package/dist/functions/diff/diff-metadata.js.map +1 -1
- package/dist/functions/diff/diff.d.ts +68 -7
- package/dist/functions/diff/diff.js +44 -3
- package/dist/functions/diff/diff.js.map +1 -1
- package/dist/functions/hook/commit.hook.d.ts +16 -1
- package/dist/functions/hook/commit.hook.js +21 -6
- package/dist/functions/hook/commit.hook.js.map +1 -1
- package/dist/functions/hook/model-action.hook.d.ts +16 -1
- package/dist/functions/hook/model-action.hook.js +21 -6
- package/dist/functions/hook/model-action.hook.js.map +1 -1
- package/dist/functions/hook/resource-action.hook.d.ts +16 -1
- package/dist/functions/hook/resource-action.hook.js +21 -6
- package/dist/functions/hook/resource-action.hook.js.map +1 -1
- package/dist/functions/node/node-action.abstract.d.ts +23 -2
- package/dist/functions/node/node-action.abstract.js +22 -8
- package/dist/functions/node/node-action.abstract.js.map +1 -1
- package/dist/functions/node/node.abstract.d.ts +56 -5
- package/dist/functions/node/node.abstract.js +106 -22
- package/dist/functions/node/node.abstract.js.map +1 -1
- package/dist/functions/node/node.interface.d.ts +3 -1
- package/dist/functions/schema/schema.d.ts +7 -0
- package/dist/functions/schema/schema.js +10 -1
- package/dist/functions/schema/schema.js.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.type.d.ts +5 -0
- package/dist/index.type.js +2 -0
- package/dist/index.type.js.map +1 -0
- package/dist/main.d.ts +245 -14
- package/dist/main.js +377 -72
- package/dist/main.js.map +1 -1
- package/dist/models/account/account.model.d.ts +43 -7
- package/dist/models/account/account.model.js +56 -8
- package/dist/models/account/account.model.js.map +1 -1
- package/dist/models/account/account.schema.d.ts +13 -1
- package/dist/models/account/account.schema.js +12 -0
- package/dist/models/account/account.schema.js.map +1 -1
- package/dist/models/app/app.model.d.ts +13 -8
- package/dist/models/app/app.model.js +17 -32
- package/dist/models/app/app.model.js.map +1 -1
- package/dist/models/app/app.schema.d.ts +6 -0
- package/dist/models/app/app.schema.js +6 -0
- package/dist/models/app/app.schema.js.map +1 -1
- package/dist/models/deployment/deployment.model.d.ts +13 -1
- package/dist/models/deployment/deployment.model.js +16 -4
- package/dist/models/deployment/deployment.model.js.map +1 -1
- package/dist/models/deployment/deployment.schema.d.ts +6 -0
- package/dist/models/deployment/deployment.schema.js +6 -0
- package/dist/models/deployment/deployment.schema.js.map +1 -1
- package/dist/models/environment/environment.model.d.ts +15 -3
- package/dist/models/environment/environment.model.js +22 -10
- package/dist/models/environment/environment.model.js.map +1 -1
- package/dist/models/environment/environment.schema.d.ts +2 -0
- package/dist/models/environment/environment.schema.js +2 -0
- package/dist/models/environment/environment.schema.js.map +1 -1
- package/dist/models/execution/execution.model.d.ts +21 -3
- package/dist/models/execution/execution.model.js +47 -29
- package/dist/models/execution/execution.model.js.map +1 -1
- package/dist/models/execution/execution.schema.d.ts +11 -0
- package/dist/models/execution/execution.schema.js +11 -0
- package/dist/models/execution/execution.schema.js.map +1 -1
- package/dist/models/filesystem/filesystem.model.d.ts +27 -1
- package/dist/models/filesystem/filesystem.model.js +30 -4
- package/dist/models/filesystem/filesystem.model.js.map +1 -1
- package/dist/models/filesystem/filesystem.schema.d.ts +5 -0
- package/dist/models/filesystem/filesystem.schema.js +5 -0
- package/dist/models/filesystem/filesystem.schema.js.map +1 -1
- package/dist/models/image/image.model.d.ts +19 -5
- package/dist/models/image/image.model.js +25 -11
- package/dist/models/image/image.model.js.map +1 -1
- package/dist/models/image/image.schema.d.ts +8 -0
- package/dist/models/image/image.schema.js +8 -0
- package/dist/models/image/image.schema.js.map +1 -1
- package/dist/models/model-action.interface.d.ts +17 -4
- package/dist/models/model.abstract.d.ts +96 -1
- package/dist/models/model.abstract.js +107 -8
- package/dist/models/model.abstract.js.map +1 -1
- package/dist/models/model.interface.d.ts +3 -0
- package/dist/models/pipeline/pipeline.model.d.ts +14 -2
- package/dist/models/pipeline/pipeline.model.js +19 -7
- package/dist/models/pipeline/pipeline.model.js.map +1 -1
- package/dist/models/pipeline/pipeline.schema.d.ts +8 -0
- package/dist/models/pipeline/pipeline.schema.js +8 -0
- package/dist/models/pipeline/pipeline.schema.js.map +1 -1
- package/dist/models/region/region.model.d.ts +16 -1
- package/dist/models/region/region.model.js +19 -4
- package/dist/models/region/region.model.js.map +1 -1
- package/dist/models/region/region.schema.d.ts +6 -0
- package/dist/models/region/region.schema.js +6 -0
- package/dist/models/region/region.schema.js.map +1 -1
- package/dist/models/server/server.model.d.ts +15 -3
- package/dist/models/server/server.model.js +18 -6
- package/dist/models/server/server.model.js.map +1 -1
- package/dist/models/server/server.schema.d.ts +3 -1
- package/dist/models/server/server.schema.js +3 -1
- package/dist/models/server/server.schema.js.map +1 -1
- package/dist/models/service/service.model.d.ts +37 -6
- package/dist/models/service/service.model.js +65 -11
- package/dist/models/service/service.model.js.map +1 -1
- package/dist/models/service/service.schema.d.ts +48 -1
- package/dist/models/service/service.schema.js +56 -1
- package/dist/models/service/service.schema.js.map +1 -1
- package/dist/models/subnet/subnet.model.d.ts +27 -3
- package/dist/models/subnet/subnet.model.js +40 -16
- package/dist/models/subnet/subnet.model.js.map +1 -1
- package/dist/models/subnet/subnet.schema.d.ts +9 -0
- package/dist/models/subnet/subnet.schema.js +9 -0
- package/dist/models/subnet/subnet.schema.js.map +1 -1
- package/dist/modes/apply-transaction.d.ts +23 -0
- package/dist/modes/apply-transaction.js +25 -0
- package/dist/modes/apply-transaction.js.map +1 -0
- package/dist/modes/commit.mode.d.ts +54 -0
- package/dist/modes/commit.mode.js +235 -0
- package/dist/modes/commit.mode.js.map +1 -0
- package/dist/modes/generate.mode.d.ts +30 -0
- package/dist/modes/generate.mode.js +50 -0
- package/dist/modes/generate.mode.js.map +1 -0
- package/dist/modes/run-action.mode.d.ts +30 -0
- package/dist/modes/run-action.mode.js +140 -0
- package/dist/modes/run-action.mode.js.map +1 -0
- package/dist/modes/validate.mode.d.ts +186 -0
- package/dist/modes/validate.mode.js +558 -0
- package/dist/modes/validate.mode.js.map +1 -0
- package/dist/modules/module.abstract.d.ts +51 -0
- package/dist/modules/module.abstract.js +36 -0
- package/dist/modules/module.abstract.js.map +1 -1
- package/dist/modules/module.container.d.ts +43 -1
- package/dist/modules/module.container.js +77 -5
- package/dist/modules/module.container.js.map +1 -1
- package/dist/modules/test-module.container.d.ts +139 -25
- package/dist/modules/test-module.container.js +383 -199
- package/dist/modules/test-module.container.js.map +1 -1
- package/dist/overlays/anchor.abstract.d.ts +32 -1
- package/dist/overlays/anchor.abstract.js +42 -11
- package/dist/overlays/anchor.abstract.js.map +1 -1
- package/dist/overlays/anchor.schema.d.ts +21 -0
- package/dist/overlays/anchor.schema.js +21 -0
- package/dist/overlays/anchor.schema.js.map +1 -1
- package/dist/overlays/overlay-data.repository.d.ts +18 -0
- package/dist/overlays/overlay-data.repository.js +18 -0
- package/dist/overlays/overlay-data.repository.js.map +1 -1
- package/dist/overlays/overlay.abstract.d.ts +56 -1
- package/dist/overlays/overlay.abstract.js +79 -20
- package/dist/overlays/overlay.abstract.js.map +1 -1
- package/dist/overlays/overlay.schema.d.ts +20 -0
- package/dist/overlays/overlay.schema.js +20 -0
- package/dist/overlays/overlay.schema.js.map +1 -1
- package/dist/resources/resource-action.interface.d.ts +29 -3
- package/dist/resources/resource-data.repository.d.ts +63 -1
- package/dist/resources/resource-data.repository.js +94 -4
- package/dist/resources/resource-data.repository.js.map +1 -1
- package/dist/resources/resource.abstract.d.ts +163 -6
- package/dist/resources/resource.abstract.js +223 -59
- package/dist/resources/resource.abstract.js.map +1 -1
- package/dist/resources/resource.interface.d.ts +0 -2
- package/dist/resources/resource.schema.d.ts +39 -1
- package/dist/resources/resource.schema.js +38 -0
- package/dist/resources/resource.schema.js.map +1 -1
- package/dist/resources/terraform-resource.abstract.d.ts +44 -0
- package/dist/resources/terraform-resource.abstract.js +45 -0
- package/dist/resources/terraform-resource.abstract.js.map +1 -0
- package/dist/services/event/event.service.d.ts +32 -5
- package/dist/services/event/event.service.js +58 -16
- package/dist/services/event/event.service.js.map +1 -1
- package/dist/services/input/input.service.d.ts +82 -5
- package/dist/services/input/input.service.js +143 -12
- package/dist/services/input/input.service.js.map +1 -1
- package/dist/services/schema-translation/schema-translation.service.d.ts +9 -0
- package/dist/services/schema-translation/schema-translation.service.js +9 -0
- package/dist/services/schema-translation/schema-translation.service.js.map +1 -1
- package/dist/services/serialization/model/model-serialization.service.d.ts +25 -3
- package/dist/services/serialization/model/model-serialization.service.js +113 -62
- package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
- package/dist/services/serialization/resource/resource-serialization.service.d.ts +36 -6
- package/dist/services/serialization/resource/resource-serialization.service.js +77 -28
- package/dist/services/serialization/resource/resource-serialization.service.js.map +1 -1
- package/dist/services/state-management/local.state-provider.d.ts +67 -4
- package/dist/services/state-management/local.state-provider.js +168 -41
- package/dist/services/state-management/local.state-provider.js.map +1 -1
- package/dist/services/state-management/remote.state-provider.d.ts +216 -0
- package/dist/services/state-management/remote.state-provider.js +645 -0
- package/dist/services/state-management/remote.state-provider.js.map +1 -0
- package/dist/services/state-management/state-management.service.d.ts +195 -17
- package/dist/services/state-management/state-management.service.js +259 -10
- package/dist/services/state-management/state-management.service.js.map +1 -1
- package/dist/services/state-management/state-provider.interface.d.ts +98 -3
- package/dist/services/state-management/state-provider.interface.js +14 -1
- package/dist/services/state-management/state-provider.interface.js.map +1 -1
- package/dist/services/state-management/terraform-state.service.d.ts +99 -0
- package/dist/services/state-management/terraform-state.service.js +197 -0
- package/dist/services/state-management/terraform-state.service.js.map +1 -0
- package/dist/services/state-management/test.state-provider.d.ts +42 -4
- package/dist/services/state-management/test.state-provider.js +77 -25
- package/dist/services/state-management/test.state-provider.js.map +1 -1
- package/dist/services/terraform/terraform.service.d.ts +480 -0
- package/dist/services/terraform/terraform.service.js +1082 -0
- package/dist/services/terraform/terraform.service.js.map +1 -0
- package/dist/services/terraform/terraform.type.d.ts +387 -0
- package/dist/services/terraform/terraform.type.js +579 -0
- package/dist/services/terraform/terraform.type.js.map +1 -0
- package/dist/services/transaction/transaction.service.d.ts +110 -10
- package/dist/services/transaction/transaction.service.js +570 -251
- package/dist/services/transaction/transaction.service.js.map +1 -1
- package/dist/services/validation/validation.service.d.ts +15 -3
- package/dist/services/validation/validation.service.js +12 -0
- package/dist/services/validation/validation.service.js.map +1 -1
- package/dist/utilities/array/array.utility.d.ts +3 -0
- package/dist/utilities/array/array.utility.js +3 -0
- package/dist/utilities/array/array.utility.js.map +1 -1
- package/dist/{functions → utilities}/diff/diff.utility.d.ts +19 -3
- package/dist/{functions → utilities}/diff/diff.utility.js +57 -41
- package/dist/utilities/diff/diff.utility.js.map +1 -0
- package/dist/utilities/file/file.utility.d.ts +16 -2
- package/dist/utilities/file/file.utility.js +23 -61
- package/dist/utilities/file/file.utility.js.map +1 -1
- package/dist/utilities/hcl/hcl.utility.d.ts +128 -0
- package/dist/utilities/hcl/hcl.utility.js +402 -0
- package/dist/utilities/hcl/hcl.utility.js.map +1 -0
- package/dist/utilities/http/http.utility.d.ts +57 -0
- package/dist/utilities/http/http.utility.js +98 -0
- package/dist/utilities/http/http.utility.js.map +1 -0
- package/dist/utilities/node/node.utility.d.ts +3 -0
- package/dist/utilities/node/node.utility.js +3 -0
- package/dist/utilities/node/node.utility.js.map +1 -1
- package/dist/utilities/object/object.utility.d.ts +12 -0
- package/dist/utilities/object/object.utility.js +12 -0
- package/dist/utilities/object/object.utility.js.map +1 -1
- package/dist/utilities/project/project.utility.d.ts +28 -0
- package/dist/utilities/project/project.utility.js +35 -0
- package/dist/utilities/project/project.utility.js.map +1 -0
- package/dist/utilities/string/string.utility.d.ts +41 -0
- package/dist/utilities/string/string.utility.js +65 -0
- package/dist/utilities/string/string.utility.js.map +1 -0
- package/dist/utilities/terraform/terraform.utility.d.ts +276 -0
- package/dist/utilities/terraform/terraform.utility.js +623 -0
- package/dist/utilities/terraform/terraform.utility.js.map +1 -0
- package/dist/utilities/test-helpers/test-classes.d.ts +36 -30
- package/dist/utilities/test-helpers/test-classes.js +38 -39
- package/dist/utilities/test-helpers/test-classes.js.map +1 -1
- package/dist/utilities/test-helpers/test-models.d.ts +8 -1
- package/dist/utilities/test-helpers/test-models.js +37 -12
- package/dist/utilities/test-helpers/test-models.js.map +1 -1
- package/dist/utilities/test-helpers/test-modes.d.ts +315 -0
- package/dist/utilities/test-helpers/test-modes.js +486 -0
- package/dist/utilities/test-helpers/test-modes.js.map +1 -0
- package/dist/utilities/test-helpers/test-modules.d.ts +47 -0
- package/dist/utilities/test-helpers/test-modules.js +85 -0
- package/dist/utilities/test-helpers/test-modules.js.map +1 -0
- package/dist/utilities/test-helpers/test-overlays.d.ts +20 -2
- package/dist/utilities/test-helpers/test-overlays.js +56 -6
- package/dist/utilities/test-helpers/test-overlays.js.map +1 -1
- package/dist/utilities/test-helpers/test-resources.d.ts +23 -3
- package/dist/utilities/test-helpers/test-resources.js +83 -23
- package/dist/utilities/test-helpers/test-resources.js.map +1 -1
- package/dist/utilities/validation/validation.utility.d.ts +24 -0
- package/dist/utilities/validation/validation.utility.js +24 -0
- package/dist/utilities/validation/validation.utility.js.map +1 -1
- package/package.json +12 -6
- package/dist/functions/diff/diff.utility.js.map +0 -1
- package/dist/services/capture/capture.service.d.ts +0 -19
- package/dist/services/capture/capture.service.js +0 -43
- package/dist/services/capture/capture.service.js.map +0 -1
- package/dist/services/state-management/local-encryption.state-provider.d.ts +0 -20
- package/dist/services/state-management/local-encryption.state-provider.js +0 -90
- package/dist/services/state-management/local-encryption.state-provider.js.map +0 -1
- package/dist/utilities/cidr/cidr.utility.d.ts +0 -10
- package/dist/utilities/cidr/cidr.utility.js +0 -51
- package/dist/utilities/cidr/cidr.utility.js.map +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { TransactionError } from '../errors/index.js';
|
|
2
|
+
import { Container } from '../functions/container/container.js';
|
|
3
|
+
import { DiffAction } from '../functions/diff/diff.js';
|
|
4
|
+
import { ResourceDataRepository } from '../resources/resource-data.repository.js';
|
|
5
|
+
import { AResource } from '../resources/resource.abstract.js';
|
|
6
|
+
import { ATerraformResource } from '../resources/terraform-resource.abstract.js';
|
|
7
|
+
import { StateManagementService } from '../services/state-management/state-management.service.js';
|
|
8
|
+
import { TransactionService } from '../services/transaction/transaction.service.js';
|
|
9
|
+
import { StringUtility } from '../utilities/string/string.utility.js';
|
|
10
|
+
/**
|
|
11
|
+
* Flattens a resource response to the strings terraform's `data "external"` protocol accepts - it
|
|
12
|
+
* takes a JSON object of strings and nothing else, so an action returning `{ Port: 80 }` fails the
|
|
13
|
+
* apply. This is the same contract {@link commit} enforces on the way back in, applied here so the
|
|
14
|
+
* CLI and the commit path cannot disagree.
|
|
15
|
+
*
|
|
16
|
+
* A `null`/`undefined` value is rejected rather than emitted as `"null"`: no resource legitimately
|
|
17
|
+
* emits one, so it signals a broken action, and the string would otherwise land in octo state at
|
|
18
|
+
* the next commit.
|
|
19
|
+
*/
|
|
20
|
+
function toFlatStringResponse(resourceId, response) {
|
|
21
|
+
const flatResponse = {};
|
|
22
|
+
const nullKeys = [];
|
|
23
|
+
for (const [key, value] of Object.entries(response)) {
|
|
24
|
+
if (value === null || value === undefined) {
|
|
25
|
+
nullKeys.push(key);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
flatResponse[key] = String(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (nullKeys.length > 0) {
|
|
32
|
+
throw new TransactionError(`Resource "${resourceId}" returned null response values: ${nullKeys.join(', ')}! ` +
|
|
33
|
+
'Every response key must carry a value.');
|
|
34
|
+
}
|
|
35
|
+
return flatResponse;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Runs a single resource action, invoked by terraform mid-apply for an external resource.
|
|
39
|
+
*
|
|
40
|
+
* Octo-internal: not a step of the user's generate → validate → apply → commit run — terraform
|
|
41
|
+
* shells back into it from a generated `local-exec` provisioner; users never run it by hand.
|
|
42
|
+
*
|
|
43
|
+
* Boots normally, computes the full resource diff, filters to `resourceId` — the diff decides
|
|
44
|
+
* whether this is an add, update, delete, or noop. Explicit `inputs`
|
|
45
|
+
* (`<parentResourceId>.<responseKey>` keys) are injected into the parent resources' responses in
|
|
46
|
+
* memory before the action runs. Rejects a `resourceId` that is not an external resource.
|
|
47
|
+
*
|
|
48
|
+
* What the action made of the resource is recorded against it, and a delete clears that record.
|
|
49
|
+
* Repeating a call for the same inputs and the same desired properties does nothing, because that
|
|
50
|
+
* record says the work is already done - terraform replaces a `null_resource` by destroying and
|
|
51
|
+
* recreating it, so it calls back twice for one change, and octo state learns nothing of the first
|
|
52
|
+
* call until `commit`. Nothing else in octo state is touched.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export async function runAction(app, { inputs = {}, resourceId }) {
|
|
57
|
+
const container = Container.getInstance();
|
|
58
|
+
const [resourceDataRepository, stateManagementService, transactionService] = await Promise.all([
|
|
59
|
+
container.get(ResourceDataRepository),
|
|
60
|
+
container.get(StateManagementService),
|
|
61
|
+
container.get(TransactionService),
|
|
62
|
+
]);
|
|
63
|
+
const recordedState = await stateManagementService.getExternalResourceState(resourceId);
|
|
64
|
+
const diffs = await app.diff();
|
|
65
|
+
const transaction = transactionService.beginTransaction(diffs, {
|
|
66
|
+
filterResourceDiffsByResourceId: resourceId,
|
|
67
|
+
skipActualResourceUpdate: true,
|
|
68
|
+
yieldResourceDiffs: true,
|
|
69
|
+
yieldResourceTransaction: true,
|
|
70
|
+
});
|
|
71
|
+
const resourceDiffs = await transaction.next();
|
|
72
|
+
const allDiffs = resourceDiffs.value.flat();
|
|
73
|
+
// A terraform resource is managed by terraform and must never be run via run-action.
|
|
74
|
+
// Guard both paths: a changed resource surfaces in `allDiffs`; an unchanged one has no diff at all,
|
|
75
|
+
// so we also check the resource in the new graph directly.
|
|
76
|
+
const targetResource = resourceDataRepository
|
|
77
|
+
.getNewResourcesByProperties()
|
|
78
|
+
.find((r) => r.resourceId === resourceId && !r.isMarkedDeleted());
|
|
79
|
+
if (targetResource instanceof ATerraformResource || allDiffs.some((d) => d.node instanceof ATerraformResource)) {
|
|
80
|
+
throw new TransactionError(`Resource "${resourceId}" is a terraform resource and cannot be run via run-action!`);
|
|
81
|
+
}
|
|
82
|
+
if (allDiffs.length === 0) {
|
|
83
|
+
// Noop: still report the current response so terraform captures consistent outputs.
|
|
84
|
+
return { action: 'noop', resourceId, response: toFlatStringResponse(resourceId, targetResource?.response ?? {}) };
|
|
85
|
+
}
|
|
86
|
+
// The work is already done: the record says an action ran for these inputs and left the resource
|
|
87
|
+
// in the shape being asked for again. The diff cannot tell, because it is computed against the
|
|
88
|
+
// last commit either way.
|
|
89
|
+
if (recordedState &&
|
|
90
|
+
targetResource &&
|
|
91
|
+
StringUtility.deterministicHash(recordedState.inputs) === StringUtility.deterministicHash(inputs) &&
|
|
92
|
+
StringUtility.deterministicHash(recordedState.properties) ===
|
|
93
|
+
StringUtility.deterministicHash(targetResource.properties)) {
|
|
94
|
+
return { action: 'noop', resourceId, response: recordedState.response };
|
|
95
|
+
}
|
|
96
|
+
// Inject explicit inputs into the parent resources the actions will read. An input is keyed
|
|
97
|
+
// either as "<parentId>.<key>" (one response key, from a native parent) or bare "<parentId>"
|
|
98
|
+
// (an external parent's entire response map, passed as one JSON object — its keys aren't
|
|
99
|
+
// enumerable at generation time). Inputs not matching a parent are ignored.
|
|
100
|
+
for (const diff of allDiffs) {
|
|
101
|
+
const node = diff.node;
|
|
102
|
+
for (const parent of node.parents) {
|
|
103
|
+
const parentResource = parent instanceof AResource ? parent : parent.getActual();
|
|
104
|
+
for (const [inputKey, inputValue] of Object.entries(inputs)) {
|
|
105
|
+
const separatorIndex = inputKey.indexOf('.');
|
|
106
|
+
if (separatorIndex === -1) {
|
|
107
|
+
if (inputKey === parentResource.resourceId) {
|
|
108
|
+
const wholeResponse = typeof inputValue === 'string' ? JSON.parse(inputValue) : inputValue;
|
|
109
|
+
Object.assign(parentResource.response, wholeResponse);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else if (inputKey.substring(0, separatorIndex) === parentResource.resourceId) {
|
|
113
|
+
parentResource.response[inputKey.substring(separatorIndex + 1)] = inputValue;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Run the action.
|
|
119
|
+
await transaction.next();
|
|
120
|
+
const action = allDiffs.some((d) => d.action === DiffAction.DELETE && d.field === 'resourceId')
|
|
121
|
+
? 'delete'
|
|
122
|
+
: allDiffs.some((d) => d.action === DiffAction.ADD && d.field === 'resourceId')
|
|
123
|
+
? 'add'
|
|
124
|
+
: 'update';
|
|
125
|
+
if (action === 'delete') {
|
|
126
|
+
await stateManagementService.deleteExternalResourceState(resourceId);
|
|
127
|
+
return { action, resourceId, response: {} };
|
|
128
|
+
}
|
|
129
|
+
// Record what the action made of the resource, for the next call and for the next plan.
|
|
130
|
+
const targetContext = allDiffs[0].node.getContext();
|
|
131
|
+
const resource = resourceDataRepository.getNewResourceByContext(targetContext);
|
|
132
|
+
const response = toFlatStringResponse(resourceId, resource?.response ?? {});
|
|
133
|
+
await stateManagementService.saveExternalResourceState(resourceId, {
|
|
134
|
+
inputs,
|
|
135
|
+
properties: JSON.parse(JSON.stringify(resource?.properties ?? {})),
|
|
136
|
+
response,
|
|
137
|
+
});
|
|
138
|
+
return { action, resourceId, response };
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=run-action.mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-action.mode.js","sourceRoot":"","sources":["../../src/modes/run-action.mode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAQtE;;;;;;;;;GASG;AACH,SAAS,oBAAoB,CAAC,UAAkB,EAAE,QAAiC;IACjF,MAAM,YAAY,GAA2B,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,CAAC,GAAG,EAAE,K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ate-resource-actions.js';
|
|
3
|
+
import type { ModelTransactionResult } from './apply-transaction.js';
|
|
4
|
+
/**
|
|
5
|
+
* One argument terraform plans to change on a resource, with the values on either side.
|
|
6
|
+
*
|
|
7
|
+
* Values are rendered, truncated strings rather than the raw payload: a report is read, not
|
|
8
|
+
* replayed, and the raw payload of a real resource is both enormous and a place secrets live.
|
|
9
|
+
*/
|
|
10
|
+
export interface ValidateFieldChange {
|
|
11
|
+
field: string;
|
|
12
|
+
/**
|
|
13
|
+
* The current value. Absent on a create. `(sensitive)` when terraform marked it so.
|
|
14
|
+
*/
|
|
15
|
+
from?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The planned value. `(known after apply)` when terraform cannot say yet.
|
|
18
|
+
*/
|
|
19
|
+
to?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One terraform address and the actions terraform plans on it (`create`, `update`, `delete`, …).
|
|
23
|
+
*/
|
|
24
|
+
export interface ValidateTerraformChange {
|
|
25
|
+
address: string;
|
|
26
|
+
/**
|
|
27
|
+
* Which arguments moved, for the changes where that is the whole question: an in-place `update`,
|
|
28
|
+
* and a `create`+`delete` where the point is *which* argument forced the replacement.
|
|
29
|
+
*
|
|
30
|
+
* Left empty on a plain create or delete, where the address and the action already say everything.
|
|
31
|
+
*/
|
|
32
|
+
changedFields: ValidateFieldChange[];
|
|
33
|
+
/**
|
|
34
|
+
* How many further arguments moved that `changedFields` does not list. Absent means none were
|
|
35
|
+
* left out: a reader of a replace has to be able to tell a complete field list from a capped one.
|
|
36
|
+
*/
|
|
37
|
+
omittedFieldCount?: number;
|
|
38
|
+
tfActions: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* What `validate` saw, as a report rather than a verdict.
|
|
42
|
+
*
|
|
43
|
+
* Octo's diff and terraform's plan measure different things from different baselines: octo's diff is
|
|
44
|
+
* `desired graph − last committed graph`, terraform's plan is `desired HCL − real cloud state`. The
|
|
45
|
+
* report correlates the two and explains what it can. Only being unable to read a plan makes it
|
|
46
|
+
* unsuccessful — see {@link ValidateReport.failures}.
|
|
47
|
+
*/
|
|
48
|
+
export interface ValidateReport {
|
|
49
|
+
/**
|
|
50
|
+
* Terraform changes with no octo diff of their own that octo can explain: the resource references
|
|
51
|
+
* something whose identity moved, or the resource no longer renders that address.
|
|
52
|
+
*/
|
|
53
|
+
attributedChanges: {
|
|
54
|
+
address: string;
|
|
55
|
+
causeKind: 'address-no-longer-rendered' | 'identity-changed';
|
|
56
|
+
causeResourceId: string;
|
|
57
|
+
moduleId: string;
|
|
58
|
+
tfActions: string[];
|
|
59
|
+
}[];
|
|
60
|
+
/**
|
|
61
|
+
* How far this report can be trusted, decided by whether intent changed.
|
|
62
|
+
*
|
|
63
|
+
* - `exact` — octo's diff is empty. Nothing is mocked and no dependency output moves, so every
|
|
64
|
+
* folder's plan reflects reality and drift detection is reliable.
|
|
65
|
+
* - `approximate` — octo's diff is non-empty. Each folder is planned alone against the *last
|
|
66
|
+
* applied* outputs of its dependencies, so a cross-folder consequence of this change is invisible
|
|
67
|
+
* until apply, and a renamed producer's outputs come from `mock_outputs`. The report may both
|
|
68
|
+
* understate what apply will do and overstate drift.
|
|
69
|
+
*/
|
|
70
|
+
confidence: 'approximate' | 'exact';
|
|
71
|
+
/**
|
|
72
|
+
* Destroys terraform plans of a resource whose class declares that destroying it loses data, whatever
|
|
73
|
+
* the cause.
|
|
74
|
+
*/
|
|
75
|
+
dataLoss: {
|
|
76
|
+
address: string;
|
|
77
|
+
message: string;
|
|
78
|
+
moduleId: string;
|
|
79
|
+
resourceId: string;
|
|
80
|
+
}[];
|
|
81
|
+
/**
|
|
82
|
+
* Terraform changes nothing in octo explains: the infrastructure moved out from under intent.
|
|
83
|
+
*/
|
|
84
|
+
drift: {
|
|
85
|
+
address: string;
|
|
86
|
+
moduleId: string;
|
|
87
|
+
tfActions: string[];
|
|
88
|
+
}[];
|
|
89
|
+
/**
|
|
90
|
+
* Folders terraform could not plan. The only unsuccessful outcome, because validate cannot report
|
|
91
|
+
* on a folder it was unable to read.
|
|
92
|
+
*/
|
|
93
|
+
failures: {
|
|
94
|
+
message: string;
|
|
95
|
+
moduleId?: string;
|
|
96
|
+
}[];
|
|
97
|
+
/**
|
|
98
|
+
* Octo resources that changed, each with the terraform changes correlated to it. An empty
|
|
99
|
+
* `terraformChanges` means the intent change carries no infrastructure cost.
|
|
100
|
+
*/
|
|
101
|
+
intentChanges: {
|
|
102
|
+
moduleId?: string;
|
|
103
|
+
octoAction: AggregatedResourceAction['action'];
|
|
104
|
+
reason?: string;
|
|
105
|
+
resourceContext: string;
|
|
106
|
+
resourceId: string;
|
|
107
|
+
terraformChanges: ValidateTerraformChange[];
|
|
108
|
+
}[];
|
|
109
|
+
/**
|
|
110
|
+
* Resources rendered into another module folder than the one holding their terraform state. The state
|
|
111
|
+
* moves with them before terraform runs, so terraform updates them in place.
|
|
112
|
+
*/
|
|
113
|
+
moves: {
|
|
114
|
+
fromModuleId: string;
|
|
115
|
+
moduleId: string;
|
|
116
|
+
resourceId: string;
|
|
117
|
+
}[];
|
|
118
|
+
/**
|
|
119
|
+
* Observations that judge nothing: a folder octo does not track, a delete it cannot correlate.
|
|
120
|
+
*/
|
|
121
|
+
notes: {
|
|
122
|
+
message: string;
|
|
123
|
+
moduleId?: string;
|
|
124
|
+
}[];
|
|
125
|
+
/**
|
|
126
|
+
* Terraform changes planned against a value that may be a `mock_outputs` placeholder. Reported
|
|
127
|
+
* apart from {@link ValidateReport.drift}, and never as drift.
|
|
128
|
+
*/
|
|
129
|
+
uncertain: {
|
|
130
|
+
address: string;
|
|
131
|
+
moduleId: string;
|
|
132
|
+
reason: string;
|
|
133
|
+
tfActions: string[];
|
|
134
|
+
}[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* One module's parsed terraform plan, i.e. the JSON produced by `terraform show -json <plan-file>`
|
|
138
|
+
* (run via terragrunt by the caller, so it is backend-agnostic). Only `resource_changes` is read.
|
|
139
|
+
*/
|
|
140
|
+
export interface TerraformPlan {
|
|
141
|
+
resource_changes?: {
|
|
142
|
+
address: string;
|
|
143
|
+
change?: {
|
|
144
|
+
actions?: string[];
|
|
145
|
+
after?: Record<string, unknown> | null;
|
|
146
|
+
after_sensitive?: Record<string, unknown> | boolean | null;
|
|
147
|
+
after_unknown?: Record<string, unknown> | boolean | null;
|
|
148
|
+
before?: Record<string, unknown> | null;
|
|
149
|
+
before_sensitive?: Record<string, unknown> | boolean | null;
|
|
150
|
+
};
|
|
151
|
+
mode?: string;
|
|
152
|
+
}[];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Read-only correlation of `terraform plan` against intent. Never writes state or folders.
|
|
156
|
+
*
|
|
157
|
+
* `plans` maps each module folder's id to its parsed terraform plan, and `planErrors` maps a folder
|
|
158
|
+
* terraform *failed* to plan to the reason why. The two are disjoint, and a folder in neither was
|
|
159
|
+
* never inspected.
|
|
160
|
+
*
|
|
161
|
+
* `persistedMappings` is the octo→terraform mapping captured by the last commit. It supplies the
|
|
162
|
+
* addresses of resources deleted since (absent from this boot's generated files), and identifies
|
|
163
|
+
* producers that have never been applied, whose outputs terragrunt can only supply as a mock.
|
|
164
|
+
*
|
|
165
|
+
* Plans are partitioned by the tracked set (intent ∪ the committed folder record,
|
|
166
|
+
* `previousFolders`): a plan for a module the sweep filled is demanded and correlated; a plan for a
|
|
167
|
+
* committed-then-deleted (emptied) folder is read when supplied; a plan for a folder octo does
|
|
168
|
+
* **not** track is noted and excluded from all correlation, and re-declaring its module in intent
|
|
169
|
+
* re-adopts it.
|
|
170
|
+
*
|
|
171
|
+
* `externalResourceStateIds` names every external resource a `run-action` published and no commit
|
|
172
|
+
* has recorded yet, from `StateManagementService.listExternalResourceStateIds()`. Each one is
|
|
173
|
+
* reported as a note.
|
|
174
|
+
*
|
|
175
|
+
* By-design limit: correlation is resource-level, not field-level.
|
|
176
|
+
*
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
export declare function validate({ externalResourceStateIds, persistedMappings, planErrors, plans, previousFolders, transaction, }: {
|
|
180
|
+
externalResourceStateIds?: string[];
|
|
181
|
+
persistedMappings: Map<string, TerraformResourceOutput>;
|
|
182
|
+
planErrors?: Map<string, string>;
|
|
183
|
+
plans: Map<string, TerraformPlan>;
|
|
184
|
+
previousFolders?: TerraformFolderOutput[];
|
|
185
|
+
transaction: ModelTransactionResult;
|
|
186
|
+
}): Promise<ValidateReport>;
|