Open SomayaB opened 4 years ago
@SomayaB I am wondering how far is this being implemented/designed? Currently, we would like to use CDK for creating some products in a service catalog, but we're facing a major issue being that first we need to publish the YAML templates to S3.
So it would be great if it would be possible to do something like this:
import * as cdk from '@aws-cdk/core';
import { CfnCloudFormationProduct } from '@aws-cdk/aws-servicecatalog';
import { CfnParameter, CfnOutput, Fn } from '@aws-cdk/core';
import { Bucket } from '@aws-cdk/aws-s3';
class S3Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const bucketName = new CfnParameter(this, 'BucketName');
this.templateOptions.metadata = {
'AWS::CloudFormation::Interface': {
ParameterGroups: [
{
Label: { default: 'Bucket Configuration' },
Parameters: [bucketName.logicalId]
}
],
ParameterLabels: {
[bucketName.logicalId]: {
default: 'Which name should the bucket have'
}
}
}
}
const bucket = new Bucket(this, 'test-bucket', {
bucketName: bucketName.valueAsString
});
new CfnOutput(this, 'S3Id', {
value: bucket.bucketArn,
exportName: Fn.sub('${AWS::StackName}-S3Id')
})
}
}
export class EmptyCdkStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const product = new CfnCloudFormationProduct(this, 's3-product', {
name: 'S3 Product',
description: 'This is an s3 product',
owner: 'whoever',
provisioningArtifactParameters: [
{
info: S3Stack
}
]
});
}
}
The major issue here is that:
provisioningArtifactParameters: [
{
info: S3Stack
}
]
expects a "LoadTemplateFromURL": "https://s3.amazonaws.com/cf-templates-ozkq9d3hgiq2-us-east-1/..."
property instead, being the URL a template in an S3 bucket.
If someone is reaching here and needs some light on how to achieve my previous comment until there's some development in the CDK project I put together a project to showcase it: https://github.com/AlexRex/cdk-service-catalog
The idea is to create a stack inside a stack (which won't be deployed) and get the resulting JSON template out of it (https://github.com/AlexRex/cdk-service-catalog/blob/master/src/products/s3-bucket/s3-bucket.product.ts#L11).
I hope it helps.
@AlexRex this isn't currently being worked on by the core team, but we are always accepting contributions if you're interested in pushing this forward.
You can look at the roadmap to see which modules the core team is working on developing at any given time.
+1
@AlexRex pleased to share that we have released new feature with this latest PR that allows you to create a product version/artifact from what we call a ProductStack
.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
@TheRealAmazonKendra what else would need to be done to stablize this AWS feature?
This issue is a major missing feature - https://github.com/aws/aws-cdk/issues/24757
This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.
Add your +1 đź‘Ť to help us prioritize high-level constructs for this service
Overview:
AWS Service Catalog enables organizations to create and manage catalogs of products that are approved for use on AWS.
AWS Docs
Maturity: CloudFormation Resources Only
See the AWS Construct Library Module Lifecycle doc for more information about maturity levels.
Implementation:
See the CDK API Reference for more implementation details.
Issue list: