terraformutils

package
v3.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TerraformPluginVendorDir = ".terraform.d/plugins"

TerraformPluginVendorDir defines the location where Terraform plugins are installed as per Terraform documentation: https://www.terraform.io/docs/extend/how-terraform-works.html#discovery https://www.terraform.io/docs/configuration/providers.html#third-party-plugins

View Source
const TerraformPluginVendorDirWindows = "AppData\\terraform.d\\plugins"

TerraformPluginVendorDirWindows defines the path under which third party terraform plugins are to be installed

Variables

This section is empty.

Functions

func ConvertToTerraformCompliantName

func ConvertToTerraformCompliantName(name string) string

ConvertToTerraformCompliantName will convert the input string into a terraform compatible field name following Terraform's snake case field name convention (lower case and snake case).

func CreateStringSchemaProperty

func CreateStringSchemaProperty(propertyName string, required bool, defaultValue string) *schema.Schema

CreateStringSchemaProperty creates a terraform schema of type string configured based upon the parameters passed in

func MultiEnvDefaultString

func MultiEnvDefaultString(ks []string, defaultValue interface{}) (string, error)

MultiEnvDefaultString is a helper function that returns the value as string of the first environment variable in the given list 'ks' that returns a non-empty value. If none of the environment variables return a value, the default value is returned.

Types

type TerraformUtils

type TerraformUtils struct {
	// Platform defines the OS (darwin, linux, windows) depending on which Terraform Vendor dir paths will be built differently
	Platform string
	// HomeDir defines the user's home directory
	HomeDir string
}

TerraformUtils defines a struct that exposes some handy terraform utils functions

func NewTerraformUtils

func NewTerraformUtils() (*TerraformUtils, error)

NewTerraformUtils is a handy constructor to build a TerraformUtils object with default platform and homeDir values based on the user's computer settings

func (*TerraformUtils) GetTerraformPluginsVendorDir

func (t *TerraformUtils) GetTerraformPluginsVendorDir() (string, error)

GetTerraformPluginsVendorDir returns Terraform's global plugin vendor directory where Terraform suggests installing custom plugins such as the OopenAPI Terraform provider. This function supports the most used platforms including darwin, linux and windows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL