Documentation ¶
Index ¶
- Constants
- func FindTerraform(ctx context.Context) (string, error)
- func NewBaseMeta(cfg config.CommonConfig) (*baseMeta, error)
- type BaseMeta
- type ConfigInfo
- type ConfigInfos
- type Dependency
- type ImportItem
- type ImportList
- type MetaGroupDummy
- func (m MetaGroupDummy) CleanTFState(_ context.Context, _ string)
- func (m MetaGroupDummy) CleanUpWorkspace(_ context.Context) error
- func (m MetaGroupDummy) DeInit(_ context.Context) error
- func (m MetaGroupDummy) ExportResourceMapping(_ context.Context, l ImportList) error
- func (m MetaGroupDummy) ExportSkippedResources(_ context.Context, l ImportList) error
- func (m MetaGroupDummy) GenerateCfg(_ context.Context, l ImportList) error
- func (m MetaGroupDummy) Init(_ context.Context) error
- func (m MetaGroupDummy) ListResource(_ context.Context) (ImportList, error)
- func (m MetaGroupDummy) ParallelImport(_ context.Context, items []*ImportItem) error
- func (m MetaGroupDummy) PushState(_ context.Context) error
- func (m MetaGroupDummy) ScopeName() string
- func (m MetaGroupDummy) Workspace() string
- type MetaMap
- func (meta *MetaMap) CleanTFState(ctx context.Context, addr string)
- func (meta MetaMap) CleanUpWorkspace(_ context.Context) error
- func (meta MetaMap) DeInit(ctx context.Context) error
- func (meta MetaMap) ExportResourceMapping(_ context.Context, l ImportList) error
- func (meta MetaMap) ExportSkippedResources(_ context.Context, l ImportList) error
- func (meta MetaMap) GenerateCfg(ctx context.Context, l ImportList) error
- func (meta *MetaMap) Init(ctx context.Context) error
- func (meta *MetaMap) ListResource(_ context.Context) (ImportList, error)
- func (meta *MetaMap) ParallelImport(ctx context.Context, items []*ImportItem) error
- func (meta MetaMap) PushState(ctx context.Context) error
- func (meta MetaMap) ScopeName() string
- func (meta MetaMap) Workspace() string
- type MetaQuery
- func (meta *MetaQuery) CleanTFState(ctx context.Context, addr string)
- func (meta MetaQuery) CleanUpWorkspace(_ context.Context) error
- func (meta MetaQuery) DeInit(ctx context.Context) error
- func (meta MetaQuery) ExportResourceMapping(_ context.Context, l ImportList) error
- func (meta MetaQuery) ExportSkippedResources(_ context.Context, l ImportList) error
- func (meta MetaQuery) GenerateCfg(ctx context.Context, l ImportList) error
- func (meta *MetaQuery) Init(ctx context.Context) error
- func (meta *MetaQuery) ListResource(ctx context.Context) (ImportList, error)
- func (meta *MetaQuery) ParallelImport(ctx context.Context, items []*ImportItem) error
- func (meta MetaQuery) PushState(ctx context.Context) error
- func (meta MetaQuery) ScopeName() string
- func (meta MetaQuery) Workspace() string
- type MetaResource
- func (meta *MetaResource) CleanTFState(ctx context.Context, addr string)
- func (meta MetaResource) CleanUpWorkspace(_ context.Context) error
- func (meta MetaResource) DeInit(ctx context.Context) error
- func (meta MetaResource) ExportResourceMapping(_ context.Context, l ImportList) error
- func (meta MetaResource) ExportSkippedResources(_ context.Context, l ImportList) error
- func (meta MetaResource) GenerateCfg(ctx context.Context, l ImportList) error
- func (meta *MetaResource) Init(ctx context.Context) error
- func (meta *MetaResource) ListResource(_ context.Context) (ImportList, error)
- func (meta *MetaResource) ParallelImport(ctx context.Context, items []*ImportItem) error
- func (meta MetaResource) PushState(ctx context.Context) error
- func (meta MetaResource) ScopeName() string
- func (meta MetaResource) Workspace() string
- type MetaResourceGroup
- func (meta *MetaResourceGroup) CleanTFState(ctx context.Context, addr string)
- func (meta MetaResourceGroup) CleanUpWorkspace(_ context.Context) error
- func (meta MetaResourceGroup) DeInit(ctx context.Context) error
- func (meta MetaResourceGroup) ExportResourceMapping(_ context.Context, l ImportList) error
- func (meta MetaResourceGroup) ExportSkippedResources(_ context.Context, l ImportList) error
- func (meta MetaResourceGroup) GenerateCfg(ctx context.Context, l ImportList) error
- func (meta *MetaResourceGroup) Init(ctx context.Context) error
- func (meta *MetaResourceGroup) ListResource(ctx context.Context) (ImportList, error)
- func (meta *MetaResourceGroup) ParallelImport(ctx context.Context, items []*ImportItem) error
- func (meta MetaResourceGroup) PushState(ctx context.Context) error
- func (meta MetaResourceGroup) ScopeName() string
- func (meta MetaResourceGroup) Workspace() string
- type TFConfigTransformer
Constants ¶
View Source
const ResourceMappingFileName = "aztfexportResourceMapping.json"
View Source
const SkippedResourcesFileName = "aztfexportSkippedResources.txt"
Variables ¶
This section is empty.
Functions ¶
func FindTerraform ¶
FindTerraform finds the path to the terraform executable.
func NewBaseMeta ¶
func NewBaseMeta(cfg config.CommonConfig) (*baseMeta, error)
Types ¶
type BaseMeta ¶
type BaseMeta interface { // Init initializes the base meta, including initialize terraform, provider and soem runtime temporary resources. Init(ctx context.Context) error // DeInit deinitializes the base meta, including cleaning up runtime temporary resources. DeInit(ctx context.Context) error // Workspace returns the path of the output directory. Workspace() string // ParallelImport imports the specified import list in parallel (parallelism is set during the meta builder function). // Import error won't be returned in the error, but is recorded in each ImportItem. ParallelImport(ctx context.Context, items []*ImportItem) error // PushState pushes the terraform state file (the base state of the workspace, adding the newly imported resources) back to the workspace. PushState(ctx context.Context) error // CleanTFState clean up the specified TF resource from the workspace's state file. CleanTFState(ctx context.Context, addr string) // GenerateCfg generates the TF configuration of the import list. Only resources successfully imported will be processed. GenerateCfg(ctx context.Context, l ImportList) error // ExportSkippedResources writes a file listing record resources that are skipped to be imported to the output directory. ExportSkippedResources(ctx context.Context, l ImportList) error // ExportResourceMapping writes a resource mapping file to the output directory. ExportResourceMapping(ctx context.Context, l ImportList) error // CleanUpWorkspace is a weired method that is only meant to be used internally by aztfexport, which under the hood will remove everything in the output directory, except the generated TF config. // This method does nothing if HCLOnly in the Config is not set. CleanUpWorkspace(ctx context.Context) error }
type ConfigInfo ¶
type ConfigInfo struct { ImportItem DependsOn []Dependency // contains filtered or unexported fields }
type ConfigInfos ¶
type ConfigInfos []ConfigInfo
func (ConfigInfos) AddDependency ¶
func (cfgs ConfigInfos) AddDependency() error
type Dependency ¶
type Dependency struct {
Candidates []string
}
type ImportItem ¶
type ImportItem struct { // Azure resource Id AzureResourceID armid.ResourceId // The TF resource id TFResourceId string // Whether this azure resource failed to import into terraform (this might due to the TFResourceType doesn't match the resource) ImportError error // Whether this azure resource has been successfully imported Imported bool // Whether this azure resource failed to validate into terraform (tbh, this should reside in UI layer only) ValidateError error // The terraform resource TFAddr tfaddr.TFAddr // The cached terraform resource addr (this is only used by the interactive mode when reverting skipping this import item) TFAddrCache tfaddr.TFAddr // Whether this TF resource type is from recommendation IsRecommended bool Recommendations []string // State is what is being imported&read by terraform-plugin-go client. It is nil when importing via terraform binary. State cty.Value }
func (ImportItem) Skip ¶
func (item ImportItem) Skip() bool
type ImportList ¶
type ImportList []ImportItem
func (ImportList) ImportErrored ¶
func (l ImportList) ImportErrored() ImportList
func (ImportList) Imported ¶
func (l ImportList) Imported() ImportList
func (ImportList) NonSkipped ¶
func (l ImportList) NonSkipped() ImportList
func (ImportList) Skipped ¶
func (l ImportList) Skipped() ImportList
type MetaGroupDummy ¶
type MetaGroupDummy struct {
// contains filtered or unexported fields
}
func NewGroupMetaDummy ¶
func NewGroupMetaDummy(rg string) MetaGroupDummy
func (MetaGroupDummy) CleanTFState ¶
func (m MetaGroupDummy) CleanTFState(_ context.Context, _ string)
func (MetaGroupDummy) CleanUpWorkspace ¶
func (m MetaGroupDummy) CleanUpWorkspace(_ context.Context) error
func (MetaGroupDummy) ExportResourceMapping ¶
func (m MetaGroupDummy) ExportResourceMapping(_ context.Context, l ImportList) error
func (MetaGroupDummy) ExportSkippedResources ¶
func (m MetaGroupDummy) ExportSkippedResources(_ context.Context, l ImportList) error
func (MetaGroupDummy) GenerateCfg ¶
func (m MetaGroupDummy) GenerateCfg(_ context.Context, l ImportList) error
func (MetaGroupDummy) ListResource ¶
func (m MetaGroupDummy) ListResource(_ context.Context) (ImportList, error)
func (MetaGroupDummy) ParallelImport ¶
func (m MetaGroupDummy) ParallelImport(_ context.Context, items []*ImportItem) error
func (MetaGroupDummy) ScopeName ¶
func (m MetaGroupDummy) ScopeName() string
func (MetaGroupDummy) Workspace ¶
func (m MetaGroupDummy) Workspace() string
type MetaMap ¶
type MetaMap struct {
// contains filtered or unexported fields
}
func (*MetaMap) CleanTFState ¶
func (MetaMap) CleanUpWorkspace ¶
func (MetaMap) ExportResourceMapping ¶
func (meta MetaMap) ExportResourceMapping(_ context.Context, l ImportList) error
func (MetaMap) ExportSkippedResources ¶
func (meta MetaMap) ExportSkippedResources(_ context.Context, l ImportList) error
func (MetaMap) GenerateCfg ¶
func (meta MetaMap) GenerateCfg(ctx context.Context, l ImportList) error
func (*MetaMap) ListResource ¶
func (meta *MetaMap) ListResource(_ context.Context) (ImportList, error)
func (*MetaMap) ParallelImport ¶
func (meta *MetaMap) ParallelImport(ctx context.Context, items []*ImportItem) error
type MetaQuery ¶
type MetaQuery struct {
// contains filtered or unexported fields
}
func (*MetaQuery) CleanTFState ¶
func (MetaQuery) CleanUpWorkspace ¶
func (MetaQuery) ExportResourceMapping ¶
func (meta MetaQuery) ExportResourceMapping(_ context.Context, l ImportList) error
func (MetaQuery) ExportSkippedResources ¶
func (meta MetaQuery) ExportSkippedResources(_ context.Context, l ImportList) error
func (MetaQuery) GenerateCfg ¶
func (meta MetaQuery) GenerateCfg(ctx context.Context, l ImportList) error
func (*MetaQuery) ListResource ¶
func (meta *MetaQuery) ListResource(ctx context.Context) (ImportList, error)
func (*MetaQuery) ParallelImport ¶
func (meta *MetaQuery) ParallelImport(ctx context.Context, items []*ImportItem) error
type MetaResource ¶
type MetaResource struct { AzureId armid.ResourceId ResourceName string ResourceType string // contains filtered or unexported fields }
func NewMetaResource ¶
func NewMetaResource(cfg config.Config) (*MetaResource, error)
func (*MetaResource) CleanTFState ¶
func (MetaResource) CleanUpWorkspace ¶
func (MetaResource) ExportResourceMapping ¶
func (meta MetaResource) ExportResourceMapping(_ context.Context, l ImportList) error
func (MetaResource) ExportSkippedResources ¶
func (meta MetaResource) ExportSkippedResources(_ context.Context, l ImportList) error
func (MetaResource) GenerateCfg ¶
func (meta MetaResource) GenerateCfg(ctx context.Context, l ImportList) error
func (*MetaResource) ListResource ¶
func (meta *MetaResource) ListResource(_ context.Context) (ImportList, error)
func (*MetaResource) ParallelImport ¶
func (meta *MetaResource) ParallelImport(ctx context.Context, items []*ImportItem) error
func (MetaResource) ScopeName ¶
func (meta MetaResource) ScopeName() string
type MetaResourceGroup ¶
type MetaResourceGroup struct {
// contains filtered or unexported fields
}
func NewMetaResourceGroup ¶
func NewMetaResourceGroup(cfg config.Config) (*MetaResourceGroup, error)
func (*MetaResourceGroup) CleanTFState ¶
func (MetaResourceGroup) CleanUpWorkspace ¶
func (MetaResourceGroup) ExportResourceMapping ¶
func (meta MetaResourceGroup) ExportResourceMapping(_ context.Context, l ImportList) error
func (MetaResourceGroup) ExportSkippedResources ¶
func (meta MetaResourceGroup) ExportSkippedResources(_ context.Context, l ImportList) error
func (MetaResourceGroup) GenerateCfg ¶
func (meta MetaResourceGroup) GenerateCfg(ctx context.Context, l ImportList) error
func (*MetaResourceGroup) ListResource ¶
func (meta *MetaResourceGroup) ListResource(ctx context.Context) (ImportList, error)
func (*MetaResourceGroup) ParallelImport ¶
func (meta *MetaResourceGroup) ParallelImport(ctx context.Context, items []*ImportItem) error
func (MetaResourceGroup) ScopeName ¶
func (meta MetaResourceGroup) ScopeName() string
type TFConfigTransformer ¶
type TFConfigTransformer func(configs ConfigInfos) (ConfigInfos, error)
Click to show internal directories.
Click to hide internal directories.