What Is A Terraformer Used For?
Infrastructure to Code: Terraformer
What if I say, that you tin can just draw your deject infrastructure in the web interface and get a terraform code? Don't you lot believe me? Anton Babenko already did that in the modules.tf project, simply build your infra diagram on cloudcraft and go your terraform code. Sounds pretty nice, huh?
But what, if yous already accept some infrastructure and desire to migrate it to the code? Or another case: you always created Datadog monitors manually, and now, you desire to manage them as a code. In that location is a tool that could help you with that. Terraformer — a CLI tool that generates tf
/json
and tfstate
files based on existing infrastructure.
Let'south talk a flake about the terraformer below.
I'm not a terraformer developer, just used it in my job, and want to share some information well-nigh this smashing tool.
Intro
Information technology'south quite rare that the entire infrastructure begins to be written from scratch. Unremarkably, something is already added manually through the CLI or Spider web UI, some resources are added to terraform, etc.
IMHO, terraformer greatly facilitates process when you need to become whatever info about this infrastructure. Or, for example, you desire to migrate from CloudFormation or something like that or practise periodic checks for manual changes in the infrastructure.
About the terraformer project
The project is created and maintained by Sergey Lanzman, SRE from Google/Waze. The first public release was published on two May 2019. This release supported AWS and GCP.
At the fourth dimension of this writing, terraformer supports fourteen clouds and more than 10 providers like Kubernetes, Datadog, Keycloak, etc. The full listing of supported providers is hither.
More lxx developers already contributed to this project, then we say that project is really live and gets a lot of new features every 24-hour interval.
Expect, I've heard about terraforming, isn't it the same?
Unfortunately, this project is not alive but still has smashing functionality. There are some problems with terraforming because of its architecture.
Terraforming gets all attributes from cloud APIs and creates HCL and
tfstate
files with templating. Each attribute in the API needs to map to aspect in Terraform. Generated files from templating tin be broken with illegal syntax. When a provider adds new attributes the terraforming code needs to exist updated.Terraformer instead uses Terraform provider files for mapping attributes, HCL library from Hashicorp, and Terraform code.
Ok, so how does terraformer work under the hood?
Terraformer uses terraform providers which already contain all resources and logic for working with the cloud provider'due south API. A tool works with these providers through the RPC-calls, and then it allows them to employ new versions of providers without code changes. Every new resource calculation is really easy.
Let'due south play with it a bit.
Installation
Download binary for terraformer and unpack it:
Check your installation:
Importing resource
Let's import all SSL certificates (ACM) and databases (RDS) from North Virginia (united states-due east-1) region from our AWS cloud.
In my example, I have multiple AWS accounts, then here I use profiles feature, terraformer supports it equally well.
First import:
Terraformer generated many files, let's see the files and directories construction:
Hither we can run across, that nosotros get terraform files with tfstate
in every resource's directory. Terraformer supports different resource structures, more data near that you can find here.
Let'south test what terraform plan
shows for us:
Here we can encounter that terraform code and tfstate
are synchronized. Cool.
By default generated lawmaking is for Terraform 0.12. I utilise Terraform 0.14, so I had issues with init similar here:
I fixed it by updating the country:
This command updated tfstate
version from 3 to 4.
My experience
I've imported more than 50k lines of lawmaking with this tool for AWS, Datadog, New Relic, and GitHub providers.
I didn't become whatsoever problems with updating tfstate
version, converting the code to 0.12 or pushing tfstate
to the S3 backend.
Some resources like Redshift still arent' supported, so I imported them from terraforming, so this tool could help you lot likewise.
Summary
Terraformer is a great tool for opposite-terraforming. It's an piece of cake-extendible framework that allows us to rapidly add new resources and providers. The maintainer and community are actively working on this projection. Some things similar the former tfstate
version or 0.12 generated code are modest issues and could exist fixed manually, or maybe automatically in the hereafter 😉.
Thank you to the community that works on that. Alive long and prosper 🖖, terraformer.
Subscribe to FAUN topics and get your weekly curated e-mail of the must-read tech stories, news, and tutorials 🗞️
Follow u.s. on Twitter 🐦 and Facebook 👥 and Instagram 📷 and join our Facebook and Linkedin Groups 💬
If this postal service was helpful, please click the clap 👏 button below a few times to testify your support for the author! ⬇
What Is A Terraformer Used For?,
Source: https://faun.pub/terraformer-5036241f90cc
Posted by: springerneigne.blogspot.com
0 Response to "What Is A Terraformer Used For?"
Post a Comment