aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

AWS Cdk Custom Resource Creation

Open VinayRana5674 opened this issue 6 years ago • 2 comments

Can anyone please help me, I have been trying this thing for 5 days. I have a custom resource in AWS YAML format, which I want to create in AWS CDK. I am able to add condition and ServiceToken using AWS CDK CfnCustomResource but I can't add properties. Please help me to find out the solution.

YAML Template

LookupAmi:
Condition: UseGI
Properties:
  ServiceToken:
      Fn::ImportValue: !Join ['', [!If [ MyProd, '', 'qa-'], Prod-LookupAmiFunction]]
  AMI: {Ref: AMI}      
  appId: {Ref: AppId}
  envType: {Ref: EnvType}
  osType: {Ref: OSType}
Type: Custom::AmiLookup

Corresponding AWS CDK typescript code which is working.

const LookupAmi = new cfn.CfnCustomResource(this, 'LookupAmi', {
  serviceToken : "DSDS"  # Just a random value but it is working



});LookupAmi.cfnOptions.condition = UseGI

I want to add properties of YAML template, how could I do it. Please help me........

VinayRana5674 avatar Jan 31 '20 15:01 VinayRana5674

here is a custom resource example. The properties can be any [key: string]: any;

richardhboyd avatar Feb 02 '20 18:02 richardhboyd

We're happy to help you out, but GitHub issues is not a support forum. There are websites much better suited for that, such as StackOverflow.

Please ask that same question again on StackOverflow under the aws-cdk. If you can't get a response to your question, please bring it to our attention again and we will do our best to answer it.

eladb avatar Feb 04 '20 13:02 eladb