-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(servicecatalog): allow creating a CFN Product Version with CDK code #17144
Conversation
…te a product version from cdk code. Add ability to define a product version entirely within CDK as opposed to referencing templates or local assets. The service catalog `ProductStack` is similar to `NestedStacks` that do not deploy themselves but rather are referenced by the parent stacks. The resources defined in your product are added to the product stack like any other cdk app. Co-authored-by: Dillon Ponzo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @arcrank! A few comments before we merge this in.
packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/test/product-stack.test.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/test/product-stack.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mis-clicked on "Comment" instead of "Request changes".
Pull request has been modified.
So there are two things that stick out.
|
packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts
Outdated
Show resolved
Hide resolved
Fail how? Considering the |
I think I think you might need to hook up into the synthesis step in a different way ( |
@skinny85 this was the simplest form I could get this into, hopefully there isn't some JSII compatibility issue with this sort of interface check. Wasn't sure if the renaming appropriate, let me know if there is better terminology we can use. |
erge branch 'prod_stack' of github.com:arcrank/aws-cdk into prod_stack
packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/test/product-stack.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @arcrank! A few small comments, but we should be very, very close to merging this in.
packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts
Outdated
Show resolved
Hide resolved
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an amazing feature, and I think will be a game changer for ServiceCatalog usability from the CDK. Awesome work @arcrank!
ProductStack
resource and ability to create a product version from cdk code.
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Can someone point me to the documentation or examples of how we can use this product stack to create Service Catalog product? We're itching to use this functionality but struggling |
Yes! Thank you @skinny85 |
@skinny85 @arcrank What's the correct way to reference parameters as value within the productStack? I'm trying to do something like: const natGateways = new cdk.CfnParameter(this, "natGateways", {
type: "Number",
description: "The number of Nat Gateways to attach",
}); And then: const vpc = new ec2.Vpc(this, "threeTierVPC", {
cidr: "10.0.0.0/16",
natGateways: natGateways.valueAsNumber,
}); Both within the product stack. This however doesn't create a Nat Gateway even if I pass two when deploying the product. |
@shahbhavik01 can you show your entire CDK code, and the resulting template that's generated? (You will find it in the |
@skinny85 Yes. See attached. The goal we're working on is to create a set of products under one portfolio. Attached is the code containing the product. I have added my bin/ lib/ and cdk.out folders. |
Thanks, I am able to replicate. I think this partly an issue with passing in tokens to the |
@arcrank Thank you for looking into it. If I get rid of the conditional VPC resources and then create each resource individually, would this work? Does the code look ok otherwise? Is this how you intended the use of service catalog product on CDK? |
@shahbhavik01, putting CfnParameters in the ProductStack should and does work when it's mapping to a field in the template. The crux of issue is that it's not really a You bring up a good point that we definitely want to consider going forward, as more powerful abstractions for resources will not be available to product stack, when a construct or resources represents a cdk function that can map to n underlying resources depending on the configuration. We will definitely be looking into this going forward. |
Thank you for the detailed explanation. I will keep that in mind and develop accordingly. |
…ode (aws#17144) Add ability to define a product version entirely within CDK as opposed to referencing templates or local assets. The service catalog `ProductStack` is similar to `NestedStacks` that do not deploy themselves but rather are referenced by the parent stacks. The resources defined in your product are added to the product stack like any other cdk app. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* Co-authored-by: Dillon Ponzo <[email protected]>
Add ability to define a product version entirely within CDK as opposed to referencing templates or local assets.
The service catalog
ProductStack
is similar toNestedStacks
that do not deploy themselves but rather are referencedby the parent stacks. The resources defined in your product are added to the product stack like any other cdk app.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Co-authored-by: Dillon Ponzo [email protected]