Skip to content
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

yaml-cfn: deprecation #14161

Closed
smaud opened this issue Apr 14, 2021 · 12 comments
Closed

yaml-cfn: deprecation #14161

smaud opened this issue Apr 14, 2021 · 12 comments
Assignees
Labels
guidance Question that needs advice or information.

Comments

@smaud
Copy link

smaud commented Apr 14, 2021

❓ General Issue

Deprecation notice

The Protest

HEY! I was using that!

Don't just remove a useful utility!

Please give some advice on an alternative we can use

Environment

  • **CDK CLI Version:1.98.0
  • **Module Version:1.98.0
  • **Node.js Version:all
  • **OS:all
  • **Language (Version):TS

Other information

@smaud smaud added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Apr 14, 2021
@peterwoodworth peterwoodworth removed the needs-triage This issue or PR still needs to be triaged. label Apr 20, 2021
@peterwoodworth peterwoodworth self-assigned this Apr 20, 2021
@peterwoodworth
Copy link
Contributor

Thanks for submitting this issue @smaud,

I'm not familiar with this package myself, but the PR which deprecated it has some good info that will hopefully help: #14001

Let me know if you will still need help finding an alternative after seeing the details of the PR

@smaud
Copy link
Author

smaud commented Apr 21, 2021

Hi @peterwoodworth thanks for the response! I've looked at #14001 and not sure what the workaround/solution is. Is yaml parsing now a part of cdk.core? So do I have to use some non-aws package for importing yaml into CDK scripts?

@NGL321
Copy link
Contributor

NGL321 commented May 6, 2021

Hey @smaud,

Actually in practice, nothing has changed since that PR. yaml-cfn has not been removed or deprecated. Essentially, we needed cdk-core to have no internal dependencies (so that it can be a root library and default include). Having yaml-cfn live in its own package meant that any time you used cdk-core you HAD to install this additional dependency.

SO, rather than conceding the point, it was migrated to solely exist in each package it was required in. The code from the original package was just copied and pasted into the dependent packages. I realize this is semantic, but it allowed us to maintain our standards. In practice, you should be able to use the yaml-cfn functionality exactly the same way you did before, only now you dont even need to import another package.

I hope that helps!

😸 😷

@NGL321 NGL321 added the closing-soon This issue will automatically close in 4 days unless further comments are made. label May 6, 2021
@smaud
Copy link
Author

smaud commented May 6, 2021

thanks @NGL321,

I think I understand, but I don't know how to implement what you've just said.

What I'm asking for is doco.

What do I do in my code?

import * as cdk from '@aws-cdk/core';
import * as yaml from '@aws-cdk/yaml-cfn';

const myJSON = yaml.deserialize(readFileSync(myYAMLFile, 'utf-8').toString());

OR

import * as cdk from '@aws-cdk/core';

const myJSON = cdk.yaml.deserialize(readFileSync(myYAMLFile, 'utf-8').toString());

Could you please provide an example?

@github-actions github-actions bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label May 7, 2021
@peterwoodworth
Copy link
Contributor

@smaud It looks like the yaml-cfn package was only absorbed privately and isn't public anymore. This package was more intended to be used by us and not really by CDK users. So I don't think there's a way for you to just use the serialize/deserialize functions natively with the CDK.

That said, it should be pretty easy to implement those functions in your own project. Create a new file and paste this code into it, then simply call these functions wherever you need. Make sure you npm install yaml too

@smaud
Copy link
Author

smaud commented May 11, 2021

Thanks @peterwoodworth,
Yeah we are moving towards cloud native tools and yaml seems to be a standard configuration language used in AWS services like EC2 Imagebuilder Components and SSM Documents.

One of the KPIs we will be aiming to implement in our contract with AWS is zero workarounds, which means we don't need to implement these functions.

The expectation here then is that the CDK & Cloudformation teams, will support and maintain a package which converts yaml file formats to json because it is a feature of AWS cloud services.

How should I request this feature through my TAM?

@peterwoodworth
Copy link
Contributor

peterwoodworth commented May 11, 2021

I'll handle this feature request myself - no need to go through the TAM since you're already right here! I'll have an update for you tomorrow 😄

If a TAM becomes necessary I'll let you know

@NGL321
Copy link
Contributor

NGL321 commented May 11, 2021

Hey @smaud,

Unfortunately Peter was incorrect in his assessment that readding this is a good feature-request. If you are simply looking for a method to convert yaml to json, I highly recommend you check our the js-yaml library for node. This particular tool in the CDK is for specifically converting Cloudformation outputs and should not be used for general-purpose language switching.
IF on the other hand your concern is importing yaml-based Cloudformation I suggest you look into the cloudformation-include package.
All that said, I do not think reverting this code to public or giving it its own package is something we will want to do for the CDK. If you have a counterpoint and you strongly believe it should be provided, please feel free to reopen this issue to create another to let us know why and we can reconsider!

Cheers
😸 😷

@NGL321 NGL321 closed this as completed May 11, 2021
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

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.

@smaud
Copy link
Author

smaud commented May 11, 2021

Hi @NGL321

Please see my message above. In AWS SysOps we will use yaml for the specification of EC2 Imagebuilder components and recipes in our CDK. The requirement is to convert the yaml to a json format, so that the Typescript can make appropriate additions to our CDK implementation.

Using AWS Cloud Native tools means zero third party dependencies. Hence an AWS supported yaml converter to json is required. We do not have an SLA with the vendor of js-yaml.

Please advise if we need to raise the request with out AWS TAM if that is the preferred method.

@NGL321
Copy link
Contributor

NGL321 commented May 12, 2021

I appreciate your concern, but as an open source project, our goal with the CDK is to ensure we can meet the needs of our users as well as maintain rigorous standards for the project.
This is an incredibly niche request as well as adding what would largely be bloat to the CDK project, so it is not a feature we would generally like to add.

If you would like to determine that through more official channels, reaching out to your TAM would be a good approach, and we can have this conversation through internal AWS ticketing.

😸 😷

@smaud
Copy link
Author

smaud commented May 12, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants