How googlecloudplatform/terraformer works
Terraformer is a CLI for reverse-importing existing infrastructure into Terraform configuration and state. The documented workflow selects a provider and resources, optionally filters or plans the import, discovers remote objects, then writes HCL/JSON and state; optional capabilities include custom output layouts, remote GCS state, and connecting resources through remote state. Provider packages implement discovery across cloud, infrastructure, identity, monitoring, and developer-tool APIs. The README documents orchestration and output features, but their implementation is not present in the sampled source, so those links are shown at the documented subsystem level.
Main entry points: root.go Command root · plan.go Plan command · import.go Import command · main.go CLI entry
Components 19
CLI workflow
- CLI entry
main.go - Command root
cmd/root.go - Import command
cmd/import.go - Plan command
cmd/plan.go - Provider commands
cmd/provider_cmd_aws.go
Import pipeline
- Import plan
- Resource selection
- Resource discovery
- Terraform conversion
Provider integrations
- Provider adapters
providers/aws/aws_provider.go - Cloud adapters
providers/gcp/gcp_provider.go - SaaS adapters
providers/datadog/datadog_provider.go - Other adapters
providers/kubernetes/kubernetes_provider.go
Generated artifacts
- Terraform files
- Terraform state
- Remote state links
Other components
- Operator
- Infrastructure APIs
- GCS bucket
Connections 21
- Operator → CLI entry: runs
- CLI entry → Command root: starts
- Command root → Import command: dispatches
- Command root → Plan command: dispatches
- Import command → Provider commands: selects provider
- Plan command → Resource selection: defines scope
- Plan command → Import plan: writes plan
- Import plan → Import command: guides import
- Provider commands → Resource selection: passes options
- Resource selection → Resource discovery: limits resources
- Resource discovery → Provider adapters: dispatches discovery
- Provider adapters → Infrastructure APIs: reads resources
- Cloud adapters → Infrastructure APIs: reads resources
- SaaS adapters → Infrastructure APIs: reads resources
- Other adapters → Infrastructure APIs: reads resources
- Resource discovery → Terraform conversion: provides objects
- Terraform conversion → Terraform files: generates HCL/JSON
- Terraform conversion → Terraform state: generates state
- Terraform state → GCS bucket: uploads optionally
- Terraform files → Remote state links: connects optionally
- GCS bucket → Remote state links: provides state