-
Hello All! I have a question that I'm hoping someone could answer for me. Here is my use case: My company has a project with some Currently, I'm able to accomplish this like this: module.exports = {
deploy: {
start: async ({ arc, cloudformation, dryRun, inventory, stage }) => {
if (stage !== "staging") return;
delete cloudformation.Resources.FunctionOneScheduledLambda
delete cloudformation.Resources.FunctionOneScheduledEvent
delete cloudformation.Resources.FunctionOneScheduledPermission
// etc...
return cloudformation;
},
},
}; This works fine but is slightly tedious to do for every function and a little prone to user error if someone forgets to edit this file when they add a new function, or if the function name changes for some reason. My question is this: Is it possible to edit either the module.exports = {
deploy: {
start: async ({ arc, cloudformation, dryRun, inventory, stage }) => {
if (stage !== "staging") return;
const newInventory = {
...inventory,
inv: {
...inventory.inv,
scheduled: null,
},
};
// Is there something like this?
const newCloudformation = createCloudformation(newInventory);
return newCloudformation;
},
},
}; I looked through the docs, and some examples of other plugins, but I can't seem to find something similar. Future possibilities: If this was possible it could enable a pretty cool plugin that would allow you to ignore deploying certain functions based on the environment which may be useful. Something like this...just thinking out loud!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The Arc and Inventory objects are intentionally deep-frozen, so unfortunately that path is not available to you. My suggestion would be to create your One note: Arc's |
Beta Was this translation helpful? Give feedback.
The Arc and Inventory objects are intentionally deep-frozen, so unfortunately that path is not available to you. My suggestion would be to create your
@scheduled
functions conditionally via theset.scheduled
API. Return nothing in !production, and return the stuff you want to deploy in prod.One note: Arc's
set
APIs do not have astage
parameter, so useinventory.inv._arc.deployStage
to infer the intended stage.deployStage
will benull
when local (e.g. run in Sandbox).