Documentation
¶
Overview ¶
Package gcloudtf handles parsing Terraform files to extract structured information out of it, to support a few tools to speed up the DeployStack authoring process
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
Name string `json:"name" yaml:"name"`
Text string `json:"text" yaml:"text"`
Kind string `json:"kind" yaml:"kind"`
Type string `json:"type" yaml:"type"`
Attr map[string]string `json:"attr" yaml:"attr"`
// contains filtered or unexported fields
}
Block represents one of several kinds of Terraform constructs: resources, variables, module
func NewModuleBlock ¶
func NewModuleBlock(t *tfconfig.ModuleCall) (Block, error)
NewModuleBlock converts a parsed Terraform Module to a Block
func NewResourceBlock ¶
NewResourceBlock converts a parsed Terraform Resource to a Block
func NewVariableBlock ¶
NewVariableBlock converts a parsed Terraform Variable to a Block
func (Block) IsResource ¶
IsResource returns true if block is a Terraform resource
func (Block) IsVariable ¶
IsVariable returns true if block is a Terraform variable
type Blocks ¶
type Blocks []Block
Blocks is a slice of type Block
type GCPResource ¶
type GCPResource struct {
Label string `json:"label" yaml:"label"`
Product string `json:"product" yaml:"product"`
APICalls []string `json:"api_calls" yaml:"api_calls"`
TestConfig TestConfig `json:"test_config" yaml:"test_config"`
AliasOf []string `json:"aliasof" yaml:"aliasof"`
}
GCPResource is a Terraform resource that matches up with a GCP product. This is used to automate the generation of tests and documentation
type GCPResources ¶
type GCPResources map[string]GCPResource
GCPResources is a collection of GCPResource
func NewGCPResources ¶
func NewGCPResources(path string) (GCPResources, error)
NewGCPResources reads in a yaml file as a config
func (GCPResources) GetProduct ¶
func (g GCPResources) GetProduct(key string) string
GetProduct returns the prouct name assoicated with the terraform resource
type TestConfig ¶
type TestConfig struct {
TestType string `json:"test_type" yaml:"test_type"`
TestCommand string `json:"test_command" yaml:"test_command"`
Suffix string `json:"suffix" yaml:"suffix"`
Region bool `json:"region" yaml:"region"`
Zone bool `json:"zone" yaml:"zone"`
LabelField string `json:"label_field" yaml:"label_field"`
Expected string `json:"expected" yaml:"expected"`
Todo string `json:"todo" yaml:"todo"`
}
TestConfig is the information needed to automate test creation.
func (TestConfig) HasTest ¶
func (t TestConfig) HasTest() bool
HasTest returns true if test config actually has a test in it.
func (TestConfig) HasTodo ¶
func (t TestConfig) HasTodo() bool
HasTodo returns true if test config actually has a todo in it.