Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FarmModule ¶
type FarmModuleGroup ¶
type FarmModuleGroup struct { Name string Export bool Modules []FarmModule }
func (FarmModuleGroup) CreateTerraformFile ¶
func (g FarmModuleGroup) CreateTerraformFile(rootDir string) (dirPath string, err error)
CreateTerraformFile writes a terraform module file. The file wil be stored in a sub-directory under a provided root directory. If the root path is empty the file will be stored in a temporary directory instead. When using a temporary directory each module-group will need to be freshly initialized by 'terraform init' every time.
func (FarmModuleGroup) PrepareDir ¶
func (g FarmModuleGroup) PrepareDir(rootDir string) (dirPath string, err error)
func (FarmModuleGroup) ToTerraform ¶
func (refArr FarmModuleGroup) ToTerraform() (string, error)
type FarmModuleGroupsMap ¶
type FarmModuleGroupsMap map[string]FarmModuleGroup
func (FarmModuleGroupsMap) FilterExport ¶
func (groups FarmModuleGroupsMap) FilterExport(wantExport bool) (filteredGroups FarmModuleGroupsMap)
FilterExport filters the FarmModuleGroupsMap based on the Export flag. It returns a new FarmModuleGroupsMap containing only the groups that match the given Export flag.
type FarmModuleList ¶
type FarmModuleList struct {
Farm []FarmModuleRef `yaml:"farm"`
}
func LoadFarmModules ¶
func LoadFarmModules(listFilePath string) (FarmModuleList, error)
func (FarmModuleList) Groups ¶
func (l FarmModuleList) Groups() FarmModuleGroupsMap
Groups organizes the FarmModuleRefs in the FarmModuleList into a FarmModuleGroupsMap. Each group in the map is identified by its name and contains an array of FarmModules. The Export flag for each group is also set based on the FarmModuleRef.
func (FarmModuleList) Validate ¶
func (l FarmModuleList) Validate() error
Validate ensures that the FarmModuleList adheres to the following criteria: - Each module's name and source must be non-empty. - Each module's name must be unique. - Each combination of a module's source and version must be unique. - A group name must not conflict with a module name. - All modules within the same group must have the same 'export' flag value.
type FarmModuleRef ¶
type FarmModuleRef struct { Name string `yaml:"name"` Source string `yaml:"source"` Version string `yaml:"version,omitempty"` Export bool `yaml:"export,omitempty"` Group string `yaml:"group,omitempty"` }
func (FarmModuleRef) GetGroupName ¶
func (r FarmModuleRef) GetGroupName() string
GetGroupName returns the group name for a FarmModuleRef. If the Group field is not empty, it returns that. Otherwise, it returns the Name field.