Documentation
¶
Overview ¶
infraharvest imports existing cloud infrastructure into Terraform code. The command line lives in internal/cli; main only sets up logging and turns the outcome into the process's exit code.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package e2e runs infraharvest end to end against local cloud emulators.
|
Package e2e runs infraharvest end to end against local cloud emulators. |
|
internal
|
|
|
adapters
Package adapters maps clusters of imported resources onto calls of curated public modules, such as terraform-aws-modules/s3-bucket/aws.
|
Package adapters maps clusters of imported resources onto calls of curated public modules, such as terraform-aws-modules/s3-bucket/aws. |
|
adapters/cmd/adaptercheck
command
Command adaptercheck checks the curated module adapters against module versions.
|
Command adaptercheck checks the curated module adapters against module versions. |
|
adapters/moduleinterface
Package moduleinterface reads a registry module version's interface (its variables and outputs, the providers it requires and the resources it declares) and checks adapters against it: the snapshots in internal/adapters/testdata/interfaces, and the nightly check for newer versions.
|
Package moduleinterface reads a registry module version's interface (its variables and outputs, the providers it requires and the resources it declares) and checks adapters against it: the snapshots in internal/adapters/testdata/interfaces, and the nightly check for newer versions. |
|
catalogue
Package catalogue holds what infraharvest knows about each Terraform resource type, as data: the ID Terraform imports a resource with, the arguments to leave out of generated configuration, the resources the default selection skips, the child resources a resource brings with it, the data source that reads one, and where its provider's APIs name it.
|
Package catalogue holds what infraharvest knows about each Terraform resource type, as data: the ID Terraform imports a resource with, the arguments to leave out of generated configuration, the resources the default selection skips, the child resources a resource brings with it, the data source that reads one, and where its provider's APIs name it. |
|
catalogue/cmd/listcoverage
command
Command listcoverage counts, for the newest release of each provider in providers, the resource types its schema has and the list resources: the types `terraform query` can discover.
|
Command listcoverage counts, for the newest release of each provider in providers, the resource types its schema has and the list resources: the types `terraform query` can discover. |
|
catalogue/schemameta
Package schemameta holds what each provider's own code says about its resource types' arguments and `terraform providers schema -json` leaves out: the value an argument defaults to, and which arguments exclude or need each other (ExactlyOneOf, ConflictsWith, AtLeastOneOf, RequiredWith).
|
Package schemameta holds what each provider's own code says about its resource types' arguments and `terraform providers schema -json` leaves out: the value an argument defaults to, and which arguments exclude or need each other (ExactlyOneOf, ConflictsWith, AtLeastOneOf, RequiredWith). |
|
cli
Package cli is infraharvest's command line: the root command and its subcommands.
|
Package cli is infraharvest's command line: the root command and its subcommands. |
|
cli/providers
Package providers holds the command of each provider infraharvest imports from: its flags, and how they become calls of the importer.
|
Package providers holds the command of each provider infraharvest imports from: its flags, and how they become calls of the importer. |
|
config
Package config reads infraharvest's configuration file.
|
Package config reads infraharvest's configuration file. |
|
discovery
Package discovery lists the resources an import covers: one Discoverer per service and scope (an account and region, a subscription, a project), run by List with a deadline each and a bounded number at a time.
|
Package discovery lists the resources an import covers: one Discoverer per service and scope (an account and region, a subscription, a project), run by List with a deadline each and a bounded number at a time. |
|
driftpolicy
Package driftpolicy decides what infraharvest drift does with each change it finds in the cloud: accept it into the code, or keep the code's value, which the next apply puts back.
|
Package driftpolicy decides what infraharvest drift does with each change it finds in the cloud: accept it into the code, or keep the code's value, which the next apply puts back. |
|
engine
Package engine generates Terraform configuration for existing resources by running Terraform itself.
|
Package engine generates Terraform configuration for existing resources by running Terraform itself. |
|
engine/cmd/opacapabilities
command
Command opacapabilities checks the OPA capabilities infraharvest gives conftest (internal/engine/gate/conftest_capabilities.json) against the OPA release the newest conftest is built with, and with -write bumps them to it.
|
Command opacapabilities checks the OPA capabilities infraharvest gives conftest (internal/engine/gate/conftest_capabilities.json) against the OPA release the newest conftest is built with, and with -write bumps them to it. |
|
engine/drift
Package drift finds what changed in the cloud since a root was last applied, and takes the changes it is told to accept into the root's code where it can be told how, held to the plan of the edited code and to the checks of the verification gate.
|
Package drift finds what changed in the cloud since a root was last applied, and takes the changes it is told to accept into the root's code where it can be told how, held to the plan of the edited code and to the checks of the verification gate. |
|
engine/envmerge
Package envmerge merges the finished roots of a stack's environments into the root they share, with what differs between them in each environment's var files, and works on that root afterwards: it verifies it as one environment, writes its moved blocks, hands its resources over to other roots, and gives back each environment's blocks as its own root would have them.
|
Package envmerge merges the finished roots of a stack's environments into the root they share, with what differs between them in each environment's var files, and works on that root afterwards: it verifies it as one environment, writes its moved blocks, hands its resources over to other roots, and gives back each environment's blocks as its own root would have them. |
|
engine/gate
Package gate is the verification gate: the checks a root passes before infraharvest calls it done, and in what order they run.
|
Package gate is the verification gate: the checks a root passes before infraharvest calls it done, and in what order they run. |
|
engine/hclfile
Package hclfile reads, edits and lays out Terraform configuration files: each a syntax tree with source positions and an editable tree, and the byte edits made to their source.
|
Package hclfile reads, edits and lays out Terraform configuration files: each a syntax tree with source positions and an editable tree, and the byte edits made to their source. |
|
engine/rootfile
Package rootfile names the files of a root the engine writes, and writes those it generates from data alone: the import blocks (imports.tf), the Terraform and provider requirements (versions.tf) and the provider block (providers.tf), the moved and removed blocks (moves.tf) with what roots hand over to each other, and the Terraform release the root requires.
|
Package rootfile names the files of a root the engine writes, and writes those it generates from data alone: the import blocks (imports.tf), the Terraform and provider requirements (versions.tf) and the provider block (providers.tf), the moved and removed blocks (moves.tf) with what roots hand over to each other, and the Terraform release the root requires. |
|
engine/secret
Package secret keeps secret values out of the configuration infraharvest generates: it finds them, among the values Terraform marks sensitive and those it writes in the open, moves them into sensitive variables, hides them from the output of infraharvest's own plans, and tells whether a file holds one.
|
Package secret keeps secret values out of the configuration infraharvest generates: it finds them, among the values Terraform marks sensitive and those it writes in the open, moves them into sensitive variables, hides them from the output of infraharvest's own plans, and tells whether a file holds one. |
|
engine/tfrun
Package tfrun runs Terraform, or OpenTofu, for the engine: it finds the binary, runs its commands in a root with the plugin cache the roots share, bounded in time or without the root's local state, and reads the diagnostics and the change summary of a plan.
|
Package tfrun runs Terraform, or OpenTofu, for the engine: it finds the binary, runs its commands in a root with the plugin cache the roots share, bounded in time or without the root's local state, and reads the diagnostics and the change summary of a plan. |
|
export
Package export writes the metadata of an import that a hosted control plane may receive: the inventory of the estate, the run and the verification gate, each a JSON document with a schema (see schemas/).
|
Package export writes the metadata of an import that a hosted control plane may receive: the inventory of the estate, the run and the verification gate, each a JSON document with a schema (see schemas/). |
|
filelock
Package filelock takes exclusive locks on files that hold across processes, with the operating system's own locks: flock on Unix, LockFileEx on Windows.
|
Package filelock takes exclusive locks on files that hold across processes, with the operating system's own locks: flock on Unix, LockFileEx on Windows. |
|
fsutil
Package fsutil writes files that must never be left half written, checks that a directory a run writes into holds nothing that would lead those writes elsewhere, and makes directories private to the user running infraharvest.
|
Package fsutil writes files that must never be left half written, checks that a directory a run writes into holds nothing that would lead those writes elsewhere, and makes directories private to the user running infraharvest. |
|
harvest
Package harvest is the API between the providers and the importer: a Provider maps each of its services to a Lister, which lists the service's resources and records each as a Resource.
|
Package harvest is the API between the providers and the importer: a Provider maps each of its services to a Lister, which lists the service's resources and records each as a Resource. |
|
importer
Package importer runs what the provider commands, discover, import, verify and drift, ask for, with no command line in it: the commands fill in Options from their flags and call it, so that what they do is tested without one.
|
Package importer runs what the provider commands, discover, import, verify and drift, ask for, with no command line in it: the commands fill in Options from their flags and call it, so that what they do is tested without one. |
|
logging
Package logging filters what the standard logger writes: it drops the debug and trace messages client libraries log, some of which hold whole HTTP requests, and keeps everything else.
|
Package logging filters what the standard logger writes: it drops the debug and trace messages client libraries log, some of which hold whole HTTP requests, and keeps everything else. |
|
managed
Package managed finds the resources Terraform already manages, from state, so that an import can leave them out instead of importing them a second time.
|
Package managed finds the resources Terraform already manages, from state, so that an import can leave them out instead of importing them a second time. |
|
managed/stores/azblob
Package azblob reads Terraform state from Azure Blob Storage, where the azurerm backend keeps it.
|
Package azblob reads Terraform state from Azure Blob Storage, where the azurerm backend keeps it. |
|
managed/stores/gcs
Package gcs reads Terraform state from Cloud Storage, where the gcs backend keeps it.
|
Package gcs reads Terraform state from Cloud Storage, where the gcs backend keeps it. |
|
managed/stores/hcp
Package hcp reads the current state of HCP Terraform (formerly Terraform Cloud) or Terraform Enterprise workspaces through their API.
|
Package hcp reads the current state of HCP Terraform (formerly Terraform Cloud) or Terraform Enterprise workspaces through their API. |
|
managed/stores/s3
Package s3 reads Terraform state from Amazon S3, where the s3 backend keeps it.
|
Package s3 reads Terraform state from Amazon S3, where the s3 backend keeps it. |
|
mcpserver
Package mcpserver serves infraharvest to AI agents over the Model Context Protocol.
|
Package mcpserver serves infraharvest to AI agents over the Model Context Protocol. |
|
picker
Package picker is an interactive terminal picker for a selection file: a tree of the listed resources by scope (provider, account and region) and type, to include or exclude one at a time or a group at once, with a live summary of what an import would bring under Terraform.
|
Package picker is an interactive terminal picker for a selection file: a tree of the listed resources by scope (provider, account and region) and type, to include or exclude one at a time or a group at once, with a live summary of what an import would bring under Terraform. |
|
providers/providertest
Package providertest stands up fake clouds for the providers' tests, at the HTTP level, so that a test doesn't depend on how a lister builds its clients: a Cloud answers every request its Handler is asked, whether the SDK sends it through the Cloud as its HTTP client (AWS, Azure) or to the Cloud's server (Google).
|
Package providertest stands up fake clouds for the providers' tests, at the HTTP level, so that a test doesn't depend on how a lister builds its clients: a Cloud answers every request its Handler is asked, whether the SDK sends it through the Cloud as its HTTP client (AWS, Azure) or to the Cloud's server (Google). |
|
providers/workers
Package workers runs a lister's per-resource reads in goroutines that can't take the process down: a panic in one is caught where it happened and raised again on the goroutine that waits, so that the discoverer's own recovery (see discovery.Discover) turns it into that service's failure, and the other services carry on.
|
Package workers runs a lister's per-resource reads in goroutines that can't take the process down: a panic in one is caught where it happened and raised again on the goroutine that waits, so that the discoverer's own recovery (see discovery.Discover) turns it into that service's failure, and the other services carry on. |
|
ratelimit
Package ratelimit limits the requests a run sends to each API host, such as ec2.eu-west-1.amazonaws.com or compute.googleapis.com: the clouds throttle by API, and a run lists many services, regions and accounts at once.
|
Package ratelimit limits the requests a run sends to each API host, such as ec2.eu-west-1.amazonaws.com or compute.googleapis.com: the clouds throttle by API, and a run lists many services, regions and accounts at once. |
|
report
Package report describes what an import did: what it found, what it imported, what it left out and why, and the versions it used.
|
Package report describes what an import did: what it found, what it imported, what it left out and why, and the versions it used. |
|
report/cfn
Package cfn is the report's section on the AWS CloudFormation stacks an import is scoped to (AWS --cfn-stack): what became of each stack's resources, whether the stack can be deleted without deleting what the import brought under Terraform, and the AWS CLI commands that update it with the copy of its template that has Retain added.
|
Package cfn is the report's section on the AWS CloudFormation stacks an import is scoped to (AWS --cfn-stack): what became of each stack's resources, whether the stack can be deleted without deleting what the import brought under Terraform, and the AWS CLI commands that update it with the copy of its template that has Retain added. |
|
report/mdtext
Package mdtext writes text infraharvest doesn't control into Markdown.
|
Package mdtext writes text infraharvest doesn't control into Markdown. |
|
selection
Package selection decides which listed resources an import brings under Terraform.
|
Package selection decides which listed resources an import brings under Terraform. |
|
sentence
Package sentence words lists as messages and help text read them.
|
Package sentence words lists as messages and help text read them. |
|
stackintent
Package stackintent carries a CloudFormation stack's template into a root generated from the stack's live resources (AWS --cfn-stack): the parameters it sets properties from become variables, its outputs become outputs, and its conditions are recorded as comments.
|
Package stackintent carries a CloudFormation stack's template into a root generated from the stack's live resources (AWS --cfn-stack): the parameters it sets properties from become variables, its outputs become outputs, and its conditions are recorded as comments. |
|
tfquery
Package tfquery lists resources through Terraform's own list resources: it writes list blocks into a .tfquery.hcl file of a working directory of its own, runs terraform query -json there and records each result by its resource identity (see harvest.RecordIdentity), which the import then imports it by.
|
Package tfquery lists resources through Terraform's own list resources: it writes list blocks into a .tfquery.hcl file of a working directory of its own, runs terraform query -json there and records each result by its resource identity (see harvest.RecordIdentity), which the import then imports it by. |
|
tftypes
Package tftypes holds what infraharvest knows of Terraform resource types that more than one package needs, such as the engine and the reading of managed state: which types are other names of each other, and the ID of a resource imported by its identity (see IdentityID).
|
Package tftypes holds what infraharvest knows of Terraform resource types that more than one package needs, such as the engine and the reading of managed state: which types are other names of each other, and the ID of a resource imported by its identity (see IdentityID). |
|
version
Package version holds the version infraharvest reports, which release builds set at link time.
|
Package version holds the version infraharvest reports, which release builds set at link time. |
|
pkg
|
|
|
cfn
Package cfn translates AWS CloudFormation templates into Terraform configuration for the AWS provider.
|
Package cfn translates AWS CloudFormation templates into Terraform configuration for the AWS provider. |
|
cfn/hclname
Package hclname holds what the CloudFormation converter (package cfn) writes that a program building on its output must write alike: the Terraform names of CloudFormation names, numbers as HCL literals, and the variables and data sources of SSM parameter types.
|
Package hclname holds what the CloudFormation converter (package cfn) writes that a program building on its output must write alike: the Terraform names of CloudFormation names, numbers as HCL literals, and the variables and data sources of SSM parameter types. |
|
Package schemas holds the JSON Schemas of the documents infraharvest export writes, so that a hosted control plane can validate what it receives.
|
Package schemas holds the JSON Schemas of the documents infraharvest export writes, so that a hosted control plane can validate what it receives. |
Click to show internal directories.
Click to hide internal directories.