aws/aws-cdk-rfcs

On-Demand CFN Resource Generator

workeitel opened this issue · 2 comments

PR Champion
#

Description

Allow generating "CFN resources" (L1s) on-demand for any CloudFormation resource, including all resources published to the CloudFormation Resource Registry.

Spaces:

  • Terraform
  • Kubernetes
  • F5

Progress

  • Tracking Issue Created
  • RFC PR Created
  • Core Team Member Assigned
  • Initial Approval / Final Comment Period
  • Ready For Implementation
    • implementation issue 1
  • Resolved
eladb commented

@workeitel wrote:

Use Case

So far cfn2ts tool was only used for generating L1 TS files for the CloudFormation resource specification. The cfn2ts tool is hardcoded to use the cfnspec package which has all resources checked in: https://github.com/aws/aws-cdk/blob/master/tools/cfn2ts/lib/index.ts#L1

With the latest launch of CloudFormation resource registry: https://aws.amazon.com/blogs/aws/cloudformation-update-cli-third-party-resource-support-registry/ everybody can build own CloudFormation resources (not only custom resources as before). That includes multiple steps including defining a Resource Provider Schema ( != resource specification )

Proposed Solution

The perfect scenario would be if

  1. cfn2ts understands the resource provider schema and I can generate L1 constructs directly based on it
  2. OR CloudFormation supports generating resource specification out of the resource provider schema and I can use then cfn2ts to generate L1 constructs.

Because both solutions most likely require more time I would like to see a better way of triggering cfn2ts in the meanwhile.

What works today:

  1. I write manually/generate with a custom tool a resource specification out of my resource provider schema
  2. I checkout the cdk repo since cfn2ts is not published on npm.
  3. Manually patch this line to point to my own resource specification: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/cfnspec/lib/index.ts#L9
  4. run cfn2ts to get my L1

Other

I suggest:

  1. something like cfn2ts --cfnspec-path ../myresource.json to override the path to the CloudFormation spec.
  2. Publishing cfn2ts as a own npm package for easier consumption.
eladb commented

Dup #77