{"modulePath":"github.com/GoogleCloudPlatform/deploystack/gcloudtf","version":"v0.0.0-20230216051911-d4fae17aa4a8","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package gcloudtf\n\nPackage gcloudtf handles parsing Terraform files to extract structured information out of it, to support a few tools to speed up the DeployStack authoring process\n\n## Types\n\n```go\ntype Block struct {\n\tName string            `json:\"name\" yaml:\"name\"`\n\tText string            `json:\"text\" yaml:\"text\"`\n\tKind string            `json:\"kind\" yaml:\"kind\"`\n\tType string            `json:\"type\" yaml:\"type\"`\n\tAttr map[string]string `json:\"attr\" yaml:\"attr\"`\n\t// contains filtered or unexported fields\n}\n```\nBlock represents one of several kinds of Terraform constructs: resources, variables, module\n\n```go\nfunc NewModuleBlock(t *tfconfig.ModuleCall) (Block, error)\n```\nNewModuleBlock converts a parsed Terraform Module to a Block\n\n```go\nfunc NewResourceBlock(t *tfconfig.Resource) (Block, error)\n```\nNewResourceBlock converts a parsed Terraform Resource to a Block\n\n```go\nfunc NewVariableBlock(t *tfconfig.Variable) (Block, error)\n```\nNewVariableBlock converts a parsed Terraform Variable to a Block\n\n```go\nfunc (b Block) IsModule() bool\n```\nIsModule returns true if block is a Terraform module\n\n```go\nfunc (b Block) IsResource() bool\n```\nIsResource returns true if block is a Terraform resource\n\n```go\nfunc (b Block) IsVariable() bool\n```\nIsVariable returns true if block is a Terraform variable\n\n```go\nfunc (b Block) NoDefault() bool\n```\nNoDefault returns true if block does not contain a default value\n\n```go\ntype Blocks []Block\n```\nBlocks is a slice of type Block\n\n```go\nfunc Extract(path string) (*Blocks, error)\n```\nExtract points to a path that includes Terraform files and extracts all of the information out of it for use with DeployStack Tools\n\n```go\nfunc NewBlocks(mod *tfconfig.Module) (*Blocks, error)\n```\nNewBlocks converts the results from a Terraform parse operation to Blocks.\n\n```go\ntype GCPResource struct {\n\tLabel      string     `json:\"label\" yaml:\"label\"`\n\tProduct    string     `json:\"product\" yaml:\"product\"`\n\tAPICalls   []string   `json:\"api_calls\" yaml:\"api_calls\"`\n\tTestConfig TestConfig `json:\"test_config\" yaml:\"test_config\"`\n\tAliasOf    []string   `json:\"aliasof\" yaml:\"aliasof\"`\n}\n```\nGCPResource is a Terraform resource that matches up with a GCP product. This is used to automate the generation of tests and documentation\n\n```go\ntype GCPResources map[string]GCPResource\n```\nGCPResources is a collection of GCPResource\n\n```go\nfunc NewGCPResources(path string) (GCPResources, error)\n```\nNewGCPResources reads in a yaml file as a config\n\n```go\nfunc (g GCPResources) GetProduct(key string) string\n```\nGetProduct returns the prouct name assoicated with the terraform resource\n\n```go\ntype List []string\n```\nList is a slice of strings that we add extra functionality to\n\n```go\nfunc (l List) Matches(s string) bool\n```\nMatches determines if a given string is an entry in the list.\n\n```go\ntype Repos []string\n```\nRepos is a slice of strings containing github urls\n\n```go\nfunc NewRepos(path string) (Repos, error)\n```\nNewRepos retrieves the list of repos from a ymal file.\n\n```go\ntype TestConfig struct {\n\tTestType    string `json:\"test_type\" yaml:\"test_type\"`\n\tTestCommand string `json:\"test_command\" yaml:\"test_command\"`\n\tSuffix      string `json:\"suffix\" yaml:\"suffix\"`\n\tRegion      bool   `json:\"region\" yaml:\"region\"`\n\tZone        bool   `json:\"zone\" yaml:\"zone\"`\n\tLabelField  string `json:\"label_field\" yaml:\"label_field\"`\n\tExpected    string `json:\"expected\" yaml:\"expected\"`\n\tTodo        string `json:\"todo\" yaml:\"todo\"`\n}\n```\nTestConfig is the information needed to automate test creation.\n\n```go\nfunc (t TestConfig) HasTest() bool\n```\nHasTest returns true if test config actually has a test in it.\n\n```go\nfunc (t TestConfig) HasTodo() bool\n```\nHasTodo returns true if test config actually has a todo in it.\n\n","path":"github.com/GoogleCloudPlatform/deploystack/gcloudtf","name":"gcloudtf","synopsis":"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","isRedistributable":true}
