5 ms·
I enjoy writing near-pristine CloudFormation. My only tweak is that I write "literate" templates in Markdown using ```yaml blocks, then strip everything else ou
by jdub 5y ago
I enjoy writing near-pristine CloudFormation. My only tweak is that I write "literate" templates in Markdown using ```yaml blocks, then strip everything else out before executing them.
I (re)use a lot of templates as "products", e.g. I have an RDS PostgreSQL template that I've been maintaining and using for years.
CloudFormation modules are great for encapsulation and reuse if you actually have anything you want to reuse at sub-template granularity. I rarely do. For example, we have a bunch of API services that all work the same way. In that case, the granularity of reuse is the template. I don't have a bunch of different services/products that all need to reuse a given resource in the same way.
For the same reason, I'm not very excited by CDK and other CloudFormation-producing tools.
I started mucking around with Terraform, but immediately discovered I needed to create a provider (custom resource). That's an incredibly manual process to begin with, but almost all of it is translating between Terraform representation (structures based on HCL2) and the JSON representation of whatever API you're using. So much translation when 99.999% of the APIs you'll use will be JSON. Aaaaaarrrrghhhh.
Sorry.
- mixedCase 5y ago> but immediately discovered I needed to create a provider That doesn't make any sense to me, if you're coming from CloudFormation. What for?
- jdub 5y agoTerraform often doesn't cover complex, less commonly used AWS services or features. For example, practically zero coverage of the entire Media Services suite of products.
- mixedCase 5y agoAnd for those edge cases, you can use this: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack https://registry.terraform.io/providers/hashicorp/aws/latest... Which still gives all the power of HCL to generate the CF stacks. No need to create a new provider.
- jdub 5y agoMigrating a 1500+ line CloudFormation template to Terraform (with some hope that a little extra flexibility would simplify the solution) only to keep using CloudFormation (through a Terraform-shaped hole) for the most complex parts of the problem... would not have been helpful.
- mixedCase 5y agoHence my mention of HCL. Between the language and Terraform modules, you're certainly not just "using CloudFormation through a Terraform-shaped hole". You have proper Terraform available to work with the CF template. You can even fully abstract each resource behind a module 1:1 if you wanted to. In a way, it's similar to how you'd treat C with inline assembly.