Sato
Converts CloudFormation (and now also ARM) into Terraform. In Go, quickerly.
Install
Download the latest releases https://github.com/JamesWoolfenden/sato/releases/tag/v0.1.19 or:
Compile locally:
git clone https://github.com/JamesWoolfenden/sato
cd sato
go installWindows
I'm now using Scoop to distribute releases, it's much quicker to update and easier to manage than previous methods, you can install scoop from https://scoop.sh/.
Add my scoop bucket:
scoop bucket add iac https://github.com/JamesWoolfenden/scoop.gitThen you can install a tool:
scoop install satoUsage
Get yourself some valid CloudFormation*
That's it. So by default (overridable) the parsed CloudFormation (now Terraform) will be in a .sato subdirectory. So let's have a look see:
> ls .sato
aws_codebuild_project.productionbuild.tf aws_codebuild_project.stagingbuild.tf aws_codepipeline_pipeline.pipeline.tf aws_iam_role.pipelinerole.tf variables.tf
aws_codebuild_project.productiondeploy.tf aws_codebuild_project.stagingdeploy.tf aws_iam_role.codebuildrole.tf aws_s3_bucket.pipelines3bucket.tfSo there are some files that could be Terraform.
The Cats Pyjamas
Testing...
>terraform init
...
Terraform has been successfully initialized!
....
>terraform plan
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
...
Plan: 12 to add, 0 to change, 0 to destroy.
...See - finds the terraform resource
This tells you the equivalent resource required given a CF ..... or an ARM resource;
$ sato see -r Microsoft.Storage/storageAccounts
azurerm_storage_accountor
$sato see -r AWS::EC2::Instance
aws_instance%Bisect - ARM to terraform
What? You've got these legacy ARM templates, and you'd dearly love to drop them, but you really don't fancy Bicep and the rework. I got you covered. Sato now bisects ARM into Terraform - Take one of the Azure quickstart examples from here https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.compute/vm-simple-windows:
Clone it:
git clone https://github.com/Azure/azure-quickstart-templates.gitThen bisect it!
I make an opinionated translation, in Terraform there are no parameters, resources and dependencies are very different, there's no 1 for 1 - ARM to Terraform, so the aim is to get you close to 100%.
There needs to be a lot of work supporting resources and built-in functions/template as yet. If you want to use this, let me know so, then I'll know to do so, or even better send me a PR.
Extra credit - Pike
If you use my other tool, Pike you can now apply that and get the policy requirements:
pike scan -d .sato -o json
Valid CloudFormation
Ditch it all, Ok, ok but some older samples can play fast and lose with the CloudFormation schema and data types. The Go-formation parser is less accommodating, you may need to be stricter on your typing.
- Booleans are true or false and not "false"
- Ints are 1,2,3 not "1", "2", "3"