Documentation ¶
Index ¶
- Constants
- func CallTerraform(opts ...string) ([]byte, error)
- func GoFmt(file string) error
- func PrefixedDescriptionString(input string) string
- func PrefixedLabelString(input string) string
- func ProviderName() (providerName *string, err error)
- func SchemaItemFormatter(input interface{}, name string) string
- func SchemaItemFormatterAttributes(input interface{}, name string) string
- func SchemaItemFormatterSpecial(input Schema, name string) string
- func Terrafmt(path string) error
- func TerraformResourceName(provider, resourceName string) string
- func ToDelimTitle(input string) string
- func ToString(value interface{}) string
- func UpdateRegistration(servicePackagePath string, resourceName string, resource resourceType, ...) error
- type Configuration
- type DocType
- type DocsVersion
- type Resource
- type Schema
- type Timeouts
Constants ¶
const ( Register operation = "register" Unregister operation = "unregister" )
const ( TypeResource resourceType = "resource" TypeDatasource resourceType = "datasource" )
Variables ¶
This section is empty.
Functions ¶
func CallTerraform ¶
CallTerraform calls the locally installed terraform binary with the specified options returns the raw []byte output for the caller to process.
func PrefixedLabelString ¶
func ProviderName ¶
func SchemaItemFormatter ¶
func Terrafmt ¶
Terrafmt calls (if installed) katbyte/terrafmt to format Terraform configurations in the specified file
func TerraformResourceName ¶
func ToDelimTitle ¶
func UpdateRegistration ¶
func UpdateRegistration(servicePackagePath string, resourceName string, resource resourceType, _ operation, isTyped bool) error
UpdateRegistration modifies the `registration.go` file to add (or remove?) items from the relevant blocks when a user adds (or removes?) a resource or datasource via `tfpdk resource` or `tfpdk datasource`
servicePackagePath = The path from the route of the provider to the service package to which the item is to be registered resourceName = the model name of a typed resource, or the snakeCase name of the item resource = string value for the item type, one of TypeResource or TypeDatasource op = one of Register or Unregister // TODO - removing is a future concern so not yet implemented isTyped = true if the resources uses the TypedSDK
Types ¶
type Configuration ¶
type Configuration struct { ProviderName string `hcl:"provider_name,optional"` ProviderCanonicalName string `hcl:"provider_canonical_name,optional"` ServicePackagesPath string `hcl:"service_packages_path,optional"` SchemaAPIURL string `hcl:"schema_api_url,optional"` DocsPath string `hcl:"docs_path,optional"` DocsVersion DocsVersion `hcl:"docs_version,optional"` ProviderGithubOrg string `hcl:"provider_github_org,optional"` ResourceDocsDirname string `hcl:"resource_docs_directory_name,optional"` DataSourceDocsDirname string `hcl:"data_source_docs_directory_name,optional"` TypedSDK bool `hcl:"use_typed_sdk,optional"` }
func LoadConfig ¶
func LoadConfig() *Configuration
LoadConfig loads the configuration file if present to allow users to override various settings in the tool, such as path to services, docs and any SDK options.
type DocType ¶
type DocType string
const DocTypeDataSource DocType = "data-source"
const DocTypeResource DocType = "resource"
type DocsVersion ¶
type DocsVersion string
const ( ConfigFileName = ".tfpdk.hcl" DocsVersionLegacy DocsVersion = "legacy" DocsVersionRegistry DocsVersion = "registry" )
type Resource ¶
type Schema ¶
type Schema struct { Type string `json:"type,omitempty"` ConfigMode string `json:"config_mode,omitempty"` Optional bool `json:"optional,omitempty"` Required bool `json:"required,omitempty"` Default interface{} `json:"default,omitempty"` Description string `json:"description,omitempty"` Computed bool `json:"computed,omitempty"` ForceNew bool `json:"force_new,omitempty"` Elem interface{} `json:"elem,omitempty"` MaxItems int `json:"max_items,omitempty"` MinItems int `json:"min_items,omitempty"` }