Documentation ¶
Overview ¶
Package tfimport provides utilities to import resources from a Terraform config.
Index ¶
- Variables
- func DoesNotExist(output string) bool
- func Import(rn runner.Runner, ir *Resource, inputDir string, terraformPath string, ...) (output string, err error)
- func NotImportable(output string) bool
- func Run(rn runner.Runner, importRn runner.Runner, runArgs *RunArgs) error
- type Resource
- type RunArgs
Constants ¶
This section is empty.
Variables ¶
var Importers = map[string]resourceImporter{}/* 102 elements not displayed */
Importers defines all supported resource importers. These can be sorted in Vim using ":SortRangesByHeader" from https://github.com/jrhouston/tfk8s
var RequiresInteractive = map[string]bool{ "google_billing_budget": true, "google_resource_manager_lien": true, }
RequiresInteractive lists resources which require interactivity and can't be fully automatically imported.
var Unimportable = map[string]bool{ "google_bigquery_dataset_access": true, "google_service_account_key": true, "google_storage_bucket_object": true, "local_file": true, "null_resource": true, "random_password": true, "random_pet": true, "random_shuffle": true, "random_string": true, "tls_private_key": true, }
Unimportable defines resources that are explicitly not supported by their provider.
Functions ¶
func DoesNotExist ¶
DoesNotExist parses the output of a `terraform import` command to determine if it indicated that a resource does not exist.
func Import ¶
func Import(rn runner.Runner, ir *Resource, inputDir string, terraformPath string, interactive bool) (output string, err error)
Import runs `terraform import` for the given importable resource. It parses the output string to determine to determine if the provider said the resource doesn't exist or isn't importable.
func NotImportable ¶
NotImportable parses the output of a `terraform import` command to determine if it indicated that a resource is not importable.
Types ¶
type Resource ¶
type Resource struct { Change terraform.ResourceChange ProviderConfig importer.ConfigMap Importer resourceImporter }
Resource represents a resource and an importer that can import it.
func Importable ¶
func Importable(rc terraform.ResourceChange, pcv importer.ConfigMap, interactive bool) (*Resource, bool)
Importable returns an importable Resource which contains an Importer, and whether it successfully created that resource. pcv represents provider config values, which will be used if the resource does not have values defined.
type RunArgs ¶
type RunArgs struct { InputDir string TerraformPath string DryRun bool Interactive bool Verbose bool // This is a "set" of resource types to import. // If not nil and not empty, will import only resources which match it. SpecificResourceTypes map[string]bool }
RunArgs are the supported tfimport run arguments.