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

(aws cdk lib): CloudFormationDeployments missing in aws-cdk-lib #18211

Closed
dreamorosi opened this issue Dec 29, 2021 · 8 comments
Closed

(aws cdk lib): CloudFormationDeployments missing in aws-cdk-lib #18211

dreamorosi opened this issue Dec 29, 2021 · 8 comments
Labels
aws-cdk-lib Related to the aws-cdk-lib package effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1

Comments

@dreamorosi
Copy link
Contributor

General Issue

Unable to find CloudFormationDeployments from v1 (exported in 'aws-cdk/lib/api/cloudformation-deployments') in aws-cdk-lib (v2)

The Question

While writing some e2e tests for a library we are using CDK to provision different stacks for each suite to test the behaviour of our library in an actual Lambda execution environment. We are already able to do so using CDK v1 using something along the lines of:

import { App, Stack } from '@aws-cdk/core';
import { SdkProvider } from 'aws-cdk/lib/api/aws-auth';
import { CloudFormationDeployments } from 'aws-cdk/lib/api/cloudformation-deployments';

const integTestApp = new App();
const stack = new Stack(integTestApp, 'ExampleIntegTest');

// Add Constructs

const stackArtifact = integTestApp.synth().getStackByName(stack.stackName);
const sdkProvider = await SdkProvider.withAwsCliCompatibleDefaults({
  profile: process.env.AWS_PROFILE,
});
const cloudFormation = new CloudFormationDeployments({ sdkProvider });

await cloudFormation.deployStack({
  stack: stackArtifact,
});

We would like to migrate this to aws-cdk-lib (v2) to get the benefits of the newer version but we are unable to find SdkProvider and CloudFormationDeployments in the new version, could you confirm their presence and/or provide an alternative for v2?

CDK CLI Version

N/A

Framework Version

2.3.0

Node.js Version

N/A

OS

N/A

Language

Typescript

Language Version

N/A

Other information

Alternatively we have considered using the CloudFormation client from aws-sdk to deploy the synthesised template but in doing so we would lose the hotswap feature which we are using while writing the tests to iterate faster.

@dreamorosi dreamorosi added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Dec 29, 2021
@github-actions github-actions bot added the aws-cdk-lib Related to the aws-cdk-lib package label Dec 29, 2021
@dreamorosi dreamorosi changed the title (module name): CloudFormationDeployments missing in aws-cdk-lib (aws cdk lib): CloudFormationDeployments missing in aws-cdk-lib Dec 29, 2021
@peterwoodworth
Copy link
Contributor

peterwoodworth commented Dec 29, 2021

Hey @dreamorosi,

It seems to me that this is intentional. This PR was merged for v2 which will prevent "deep imports". That is - only explicitly defined exports can be imported by the user. This isn't explicitly exported, so this class cannot be imported

I'm not sure if that is something we'd want to expose to the user, but let me know if you'd be interested in that 🙂

@peterwoodworth peterwoodworth removed the needs-triage This issue or PR still needs to be triaged. label Dec 29, 2021
@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 29, 2021
@dreamorosi
Copy link
Contributor Author

@peterwoodworth thanks for the quick reply.

Just to clarify, are CloudFormationDeployments and SdkProvider supposed to be present at all in aws-cdk-lib?? I've tried to look for that class using grep while having aws-cdk-lib installed and couldn't find them, exported or not.

In any case our use case would really benefit from having these two classes exposed in v2. I know this might fall under this RFC but there's evidence that other Customers are already relying on these classes from v1 (evidence 1, evidence 2) so while I understand that the discussion about CDK programmatic usage is a large one I'm only kindly asking to consider exposing in v2 something that was already available in v1 as an interim solution.

@peterwoodworth
Copy link
Contributor

Just to clarify, are CloudFormationDeployments and SdkProvider supposed to be present at all in aws-cdk-lib?

Currently, these classes are not exposed to the user in v2.

Thank you for your request and your reasoning, it's much appreciated 🙂

@peterwoodworth peterwoodworth added feature-request A feature should be added or improved. effort/small Small work item – less than a day of effort p1 and removed guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Dec 29, 2021
@peterwoodworth peterwoodworth removed their assignment Dec 29, 2021
@peterwoodworth
Copy link
Contributor

peterwoodworth commented Dec 29, 2021

@rix0rrr Is this something we want to be exposed to the user?

@asquithea
Copy link

I've been using SdkProvider and CloudFormationDeployments to wrap a service around CDK to deploy templated infrastructure on demand. My usage pattern is to use CloudFormationDeployments to upload assets and prepare a CloudFormation change-set, and then use the standard CloudFormation API to execute and monitor that change-set using SNS notifications.

Was aware from the start that these are not in the official API and might be changed without warning - but they are useful nonetheless as without it I would need to replicate all the CDK-specific business logic.

The high-level requirement would be something like:
Provide a way to get from .synth() - which produces a CloudAssembly - to one or more CloudFormation change-sets that can be invoked as normal.

I can live without all the monitoring functionality, as that's really more geared to the CLI.

@dreamorosi
Copy link
Contributor Author

@rix0rrr @peterwoodworth any chance we could get an answer on whether this is in the plans or not?

Not asking for any kind of ETA, just would like to know if this is something that might become exposed again or if we should just stick with v1 / find an alternative.

We are using this in awslabs/aws-lambda-powertools-typescript to run our end to end tests and being able to migrate to aws-cdk-lib would allow us to manage only one dependency instead of having to bump all the @aws-cdk/aws-* ones from v1.

@rix0rrr
Copy link
Contributor

rix0rrr commented Mar 11, 2022

The CLI cannotbe used in this way. We don't support it and have no compunction about breaking you.

In an ideal world the components would have been separated better, and we definitely have an ambition in that direction, but no concrete plans as of yet.

If you want to programmatically do a CDK deployment, shell out to the CLI.

@rix0rrr rix0rrr closed this as completed Mar 11, 2022
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-cdk-lib Related to the aws-cdk-lib package effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

No branches or pull requests

5 participants