[英]Make cdk diff ignore stack
I have 2 cdk stacks that I have created that I use to deploy my lambda function.我创建了 2 个 cdk 堆栈,用于部署我的 lambda 函数。 One of the stacks is the CodePipeline stack that gets triggered by Github commits, builds tests and deploys by using the "CloudFormationDeployAction" in CodeDeploy.
其中一个堆栈是 CodePipeline 堆栈,它由 Github 提交触发,通过使用 CodeDeploy 中的“CloudFormationDeployAction”构建测试和部署。 Because I'm deploying my lambda through CodePipelines, I don't want it to be deployed through the terminal.
因为我正在通过 CodePipelines 部署我的 lambda,所以我不希望它通过终端部署。
But on the terminal when I execute "cdk diff" or "cdk deploy *" for the rest of my stack, cdk will try diff both the stacks and output potential changes with the Lambda stack, even though it's deployed already.但是在终端上,当我为我的堆栈的其余部分执行“cdk diff”或“cdk deploy *”时,cdk 将尝试 diff 堆栈并输出 Lambda 堆栈的潜在变化,即使它已经部署。 And doing a "cdk deploy *" will make cdk try to deploy and fail (due to missing parameters that is supplied through CodePipelines).
执行“cdk deploy *”将使 cdk 尝试部署并失败(由于缺少通过 CodePipelines 提供的参数)。
Is there a way to make the terminal commands ignore this LambdaStack?有没有办法让终端命令忽略这个 LambdaStack?
A way I use to achieve a similar result is by doing the following:我用来实现类似结果的一种方法是执行以下操作:
"cdk-diff": "tsc && cdk diff YourStackYouWantToDiff"
"cdk-diff": "tsc && cdk diff YourStackYouWantToDiff"
npm run cdk-diff
npm run cdk-diff
This will only execute the cdk diff
on the stacks you specify, here being YourStackYouWantToDiff.这只会在您指定的堆栈上执行
cdk diff
,这里是 YourStackYouWantToDiff。
In case of declared dependencies between stacks such as aStack.addDependency(bStack)
, the cdk diff
is executed on both aStack and bStack.在堆栈之间声明依赖关系的情况下,例如
aStack.addDependency(bStack)
, cdk diff
在 aStack 和 bStack 上执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.