Documentation
¶
Index ¶
- func CleanBeforeCopy(relPath string) string
- func ConvertNameToCanonical(name string) string
- func IsValidDir(path string) error
- type Client
- func (c *Client) CreateBaseDirsIfNotExist(repoRoot string) error
- func (c *Client) CreateTargetPath(targetPath string) error
- func (c *Client) GenerateFile(sourcePath, destPath string, funcMap template.FuncMap, data interface{}) error
- func (c *Client) GenerateModule(templateVersion string, paths *TargetPaths) error
- func (c *Client) GenerateModuleExample(templateVersion string, paths *TargetPaths) error
- func (c *Client) GenerateTerraformFiles(sourcePath, targetPath string) error
- func (c *Client) ResolvePaths(module, group string) (*TargetPaths, error)
- func (c *Client) Validate(module, group string, options *GenOptions) error
- type Config
- type DocsGenerator
- type GenOptions
- type Generator
- type ModuleGenerator
- type Options
- func (o *Options) GetCurrentDir() string
- func (o *Options) GetDestDir() (string, error)
- func (o *Options) GetHomeDir() string
- func (o *Options) GetModulesDir() string
- func (o *Options) GetRepoRoot() (string, error)
- func (o *Options) GetTFTemplateDirV1() (string, error)
- func (o *Options) IsGitRepo() (string, bool)
- type TargetPaths
- type TerraformGenerator
- type TerraformGeneratorImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanBeforeCopy ¶
func ConvertNameToCanonical ¶
ConvertNameToCanonical converts a name to canonical format. It replaces all '-' with '_'.
func IsValidDir ¶
IsValidDir checks if the given path is a valid directory. It returns an error if the path is not a valid directory. Or if the directory isn't a directory.
Types ¶
type Client ¶
func NewGeneratorDefault ¶
func NewGeneratorDefault() *Client
func (*Client) CreateBaseDirsIfNotExist ¶
func (*Client) CreateTargetPath ¶
func (*Client) GenerateFile ¶
func (c *Client) GenerateFile(sourcePath, destPath string, funcMap template.FuncMap, data interface{}) error
GenerateFile generates a file from a template. It's a wrapper around the ProcessTemplFile function that's used from the TFTest library.
func (*Client) GenerateModule ¶
func (c *Client) GenerateModule(templateVersion string, paths *TargetPaths) error
GenerateModule generates a canonical module from the template directory.
func (*Client) GenerateModuleExample ¶
func (c *Client) GenerateModuleExample(templateVersion string, paths *TargetPaths) error
GenerateModuleExample generates an example module from the template directory.
func (*Client) GenerateTerraformFiles ¶
GenerateTerraformFiles generates files from templates, allowing individual file treatment.
func (*Client) ResolvePaths ¶
func (c *Client) ResolvePaths(module, group string) (*TargetPaths, error)
type DocsGenerator ¶
type GenOptions ¶
type GenOptions struct {
FailIfNotGitRepo bool
}
type ModuleGenerator ¶
type ModuleGenerator interface { // GenerateModule GenerateCanonical generates a canonical module from the template directory. // 'templatedir' is the targetModulePath to the template directory. // 'destpath' is the targetModulePath to the destination directory. GenerateModule(templatedir string, paths *TargetPaths) error GenerateModuleExample(templatedir string, paths *TargetPaths) error // Validate validates the module generation. // 'module' is the name of the module. // 'group' is the group name of the module. If the group is passed, normally it refers // to the 'service' (cloud provider) the module is for. E.g.: /modules/s3/s3_bucket Validate(module, group string, options *GenOptions) error // ResolvePaths ResolveModuleDestPath resolves the destination targetModulePath for the module. // 'module' is the name of the module. // 'group' is the group name of the module. If the group is passed, normally it refers // to the 'service' (cloud provider) the module is for. E.g.: /modules/s3/s3_bucket ResolvePaths(module, group string) (*TargetPaths, error) // CreateBaseDirsIfNotExist CreateModulesDirectoryIfNotExists creates the modules directory if it does not exist. // 'repoRoot' is the root directory of the repository. CreateBaseDirsIfNotExist(repoRoot string) error CreateTargetPath(targetPath string) error GenerateTerraformFiles(sourcePath string, destPath string) error GenerateFile(sourcePath string, destPath string, funcMap template.FuncMap, data interface{}) error }
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func (*Options) GetCurrentDir ¶
func (*Options) GetDestDir ¶
func (*Options) GetHomeDir ¶
func (*Options) GetModulesDir ¶
func (*Options) GetRepoRoot ¶
func (*Options) GetTFTemplateDirV1 ¶
type TargetPaths ¶
type TerraformGenerator ¶
type TerraformGenerator interface { GenerateProvidersFile(targetPath string) error GenerateMainFile(targetPath string) error GenerateVariablesFile(targetPath string) error GenerateOutputsFile(targetPath string) error GenerateVersionsFile(targetPath string) error GenerateTerraformDocsFile(targetPath string) error }
type TerraformGeneratorImpl ¶
type TerraformGeneratorImpl struct {
Generator ModuleGenerator
}
Click to show internal directories.
Click to hide internal directories.