from Hacker News

Ask HN: What's better Terraform or AWS CDK?

by Kalpeshbhalekar on 4/11/24, 10:45 AM with 12 comments

If one is not planning to go multi-cloud, is CDK a better decision?
  • by mousetree on 4/12/24, 8:55 AM

    We've been using CDK for Terraform[1] for a year or two for both AWS and GCP. It's working great. We especially like that it supports Typescript.

    [1] https://developer.hashicorp.com/terraform/cdktf

  • by speedgoose on 4/11/24, 4:10 PM

    https://opentofu.org/ is better than terraform, as it’s a fork that happened before terraform became not open source.
  • by andrewfromx on 4/11/24, 10:48 AM

  • by Sevii on 4/11/24, 1:41 PM

    Terraform and the CDK use different programming models to achieve similar goals. The CDK takes a more dynamic scripting approach much like Gradle, while Terraform is more descriptive and declarative. Functionally, I think they have similar capabilities.
  • by JojoFatsani on 4/11/24, 5:50 PM

    If you plan on making your devs do all your infra work, maybe CDK would be better. But you will eventually regret not having TF and its huge ecosystem of modules and integrations.
  • by ldjkfkdsjnv on 4/12/24, 4:35 PM

    CDK is far better if you are only on AWS and need advanced cloud setups.
  • by gabriel_dev on 4/12/24, 4:26 AM

    I guess the vendor lock issue is not as harsh if using Terraform
  • by noop_joe on 4/11/24, 2:47 PM

    It might not matter _that much_ depending on the complexity of the application you're modeling.

    There are lots of options. A few things to consider:

    - Is it a dedicated individual or group responsible for the IaC? What are they comfortable with? - Details about the running app will need to find their way into the infra somehow (env vars at least), if it's a separate group or individual, what will be the most obvious process to perform that exchange of information?

    I wrote a short piece about point two [1]. Disclosure: I work at a company building a platform with its own opinionated IaC.

    1. https://noop.dev/blog/build-apps-not-infrastructure/

  • by dakiol on 4/11/24, 2:11 PM

    Ansible
  • by uaas on 4/14/24, 12:36 PM

    CloudFormation