0

Since I've seen Hashicorp Terraform, I have been wondering why the "plan" it can export has binary format.

Now in the AWS world you have got a declarative configuration language called CloudFormation which can be abstracted from using AWS CDK (Cloud Development Kit) in a common programming language of your choice.

Therefore my question: imagine somebody familiar with CloudFormation would like to see what CDK code will do. Is there a way to export a CloudFormation file using CDK?

1
  • So from your experience there's no way to export CF file from terraform code?
    – koalaok
    Commented Apr 9, 2022 at 10:03

2 Answers 2

0

Yes: in the hello world CDK example, they call it "synthesizing":

cdk synth

^^ produces CloudFormation file.

1
  • The only problem is that sometimes synth requires online access (if your lambda is in VPC). Commented Dec 11, 2023 at 13:52
0

As Tamara had already mentioned, CDK already produces this for you during synthesis. To clarify this further, if you look in the cdk.out directory, you'll find a xxxxx.template.json file for every stack.

This is your synthesized template that CDK passes onto Cloudformation.

Additionally, you may also benefit from taking a look at cdk diff.

The cdk diff command compares the current version of a stack defined in your app with the already-deployed version, or with a saved AWS CloudFormation template, and displays a list of changes.

Let me know if you have any further questions!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.