简体   繁体   English

使 cdk diff 忽略堆栈

[英]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:我用来实现类似结果的一种方法是执行以下操作:

  1. In package.json I added under scripts "cdk-diff": "tsc && cdk diff YourStackYouWantToDiff"在 package.json 中,我在脚本"cdk-diff": "tsc && cdk diff YourStackYouWantToDiff"
  2. I run 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.

相关问题 使用 CDK diff 比较包装在管道中的资源 - Using CDK diff to diff resources wrapped in a pipeline 在 AWS CDK 堆栈中指定 MSK 凭证 - Specifying MSK credentials in an AWS CDK stack 无法在 CDK 应用程序中为 AWS S3 Glacier 创建 CDK 堆栈? - Cannot create CDK stack for AWS S3 Glacier in CDK app? cdk diff 注释实际上是否从 AWS 读取以与 cdk.out 中生成的文件进行比较? - Does cdk diff comment actually read from AWS to compare with file generated in cdk.out? 提供堆栈名称的 cdk synth 仍然合成项目中的所有堆栈 - cdk synth with stack name provided still synths all the stacks in the project 如何使用 lambda 删除和重新创建 CDK 堆栈 (Cloudformation)? - How can I delete and recreate a CDK Stack (Cloudformation) using a lambda? CDK:如何使用/导入一个堆栈中定义的 s3 到另一个堆栈(在不同的文件中)? - CDK: How to use/import s3 defined in one stack to another stack (in a different file)? AWS CDK:如何从单个堆栈部署多个堆栈 - AWS CDK: How can I deploy multiple stack from a single stack 当目标位于依赖于目标组堆栈的单独堆栈中时,如何删除 CDK 中的目标组目标 - How can I delete the target group targets in CDK while the targets is in a separate stack that depends on the target group stack 使用aws cdk将一个堆栈中定义的所有资源获取到另一个堆栈 - Get all the resources defined in one stack to another stack using aws cdk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM