Documentation ¶
Index ¶
- Constants
- Variables
- func CustomDiffInSequence(funcs ...CustomizeDiffFunc) schema.CustomizeDiffFunc
- func CustomDiffWithAll(funcs ...CustomizeDiffFunc) schema.CustomizeDiffFunc
- func CustomizeDiffShim(diffFunc CustomizeDiffFunc) schema.CustomizeDiffFunc
- func DefaultImporter() *schema.ResourceImporter
- func DefaultTimeout(tx interface{}) *time.Duration
- func HashString(input interface{}) int
- func ImporterValidatingResourceId(validateFunc IDValidationFunc) *schema.ResourceImporter
- func ImporterValidatingResourceIdThen(validateFunc IDValidationFunc, thenFunc ImporterFunc) *schema.ResourceImporter
- func Retry(timeout time.Duration, f RetryFunc) error
- func ValueChangeConditionShim(shimFunc ValueChangeConditionFunc) customdiff.ValueChangeConditionFunc
- type BasicMapReader
- type CreateFunc
- type CustomizeDiffFunc
- type DeleteFunc
- type ExistsFunc
- type IDValidationFunc
- type ImporterFunc
- type InstanceState
- type MapFieldReader
- type MapFieldWriter
- type ReadFunc
- type Resource
- type ResourceData
- type ResourceDiff
- type ResourceTimeout
- type RetryError
- type RetryFunc
- type Schema
- type SchemaDiffSuppressFunc
- type SchemaSetFunc
- type SchemaValidateFunc
- type Set
- type StateChangeConf
- type StateRefreshFunc
- type StateUpgrade
- type StateUpgrader
- type StateUpgraderFunc
- type TestCheckFunc
- type UpdateFunc
- type ValueChangeConditionFunc
- type ValueType
Constants ¶
const ( TypeInvalid = schema.TypeInvalid TypeBool = schema.TypeBool TypeInt = schema.TypeInt TypeFloat = schema.TypeFloat TypeString = schema.TypeString TypeList = schema.TypeList TypeMap = schema.TypeMap TypeSet = schema.TypeSet )
const ( SchemaConfigModeAuto = schema.SchemaConfigModeAuto SchemaConfigModeAttr = schema.SchemaConfigModeAttr SchemaConfigModeBlock = schema.SchemaConfigModeBlock )
const ( TimeoutCreate = schema.TimeoutCreate TimeoutRead = schema.TimeoutRead TimeoutUpdate = schema.TimeoutUpdate TimeoutDelete = schema.TimeoutDelete TimeoutDefault = schema.TimeoutDefault )
Variables ¶
var ExpandJsonFromString = structure.ExpandJsonFromString
var FlattenJsonToString = structure.FlattenJsonToString
var SuppressJsonDiff = structure.SuppressJsonDiff
Functions ¶
func CustomDiffInSequence ¶
func CustomDiffInSequence(funcs ...CustomizeDiffFunc) schema.CustomizeDiffFunc
CustomDiffInSequence returns a CustomizeDiffFunc that runs all of the given CustomizeDiffFuncs in sequence, stopping at the first one that returns an error and returning that error.
If all functions succeed, the combined function also succeeds.
func CustomDiffWithAll ¶
func CustomDiffWithAll(funcs ...CustomizeDiffFunc) schema.CustomizeDiffFunc
CustomDiffWithAll returns a CustomizeDiffFunc that runs all of the given CustomizeDiffFuncs and returns all of the errors produced.
If one function produces an error, functions after it are still run. If this is not desirable, use function Sequence instead.
If multiple functions returns errors, the result is a multierror.
func CustomizeDiffShim ¶
func CustomizeDiffShim(diffFunc CustomizeDiffFunc) schema.CustomizeDiffFunc
CustomizeDiffShim is a shim around the Terraform Plugin SDK which allows us to switch out the version of the Plugin SDK being used without breaking open PR's
func DefaultImporter ¶
func DefaultImporter() *schema.ResourceImporter
DefaultImporter is a wrapper around the default importer within the Plugin SDK at this point resources should be using ImporterValidatingResourceId, but this is providing a compatibility shim for the moment
func DefaultTimeout ¶
func HashString ¶
func HashString(input interface{}) int
HashString hashes strings. If you want a Set of strings, this is the SchemaSetFunc you want.
func ImporterValidatingResourceId ¶
func ImporterValidatingResourceId(validateFunc IDValidationFunc) *schema.ResourceImporter
ImporterValidatingResourceId validates the ID provided at import time is valid using the validateFunc.
func ImporterValidatingResourceIdThen ¶
func ImporterValidatingResourceIdThen(validateFunc IDValidationFunc, thenFunc ImporterFunc) *schema.ResourceImporter
ImporterValidatingResourceIdThen validates the ID provided at import time is valid using the validateFunc then runs the 'thenFunc', allowing the import to be customised.
func Retry ¶
Retry is a basic wrapper around StateChangeConf that will just retry a function until it no longer returns an error.
func ValueChangeConditionShim ¶
func ValueChangeConditionShim(shimFunc ValueChangeConditionFunc) customdiff.ValueChangeConditionFunc
ValueChangeConditionShim is a shim around the Terraform Plugin SDK which allows us to switch out the version of the Plugin SDK being used without breaking open PR's
Types ¶
type BasicMapReader ¶
type BasicMapReader = schema.BasicMapReader
type CreateFunc ¶
type CreateFunc = schema.CreateFunc //nolint:SA1019
type CustomizeDiffFunc ¶
type CustomizeDiffFunc = func(context.Context, *ResourceDiff, interface{}) error
func ForceNewIfChange ¶
func ForceNewIfChange(key string, f ValueChangeConditionFunc) CustomizeDiffFunc
ForceNewIfChange returns a CustomizeDiffFunc that flags the given key as requiring a new resource if the given condition function returns true.
The return value of the condition function is ignored if the old and new values compare equal, since no attribute diff is generated in that case.
This function is similar to ForceNewIf but provides the condition function only the old and new values of the given key, which leads to more compact and explicit code in the common case where the decision can be made with only the specific field value.
type DeleteFunc ¶
type DeleteFunc = schema.DeleteFunc
type ExistsFunc ¶
type ExistsFunc = schema.ExistsFunc
type IDValidationFunc ¶
type ImporterFunc ¶
type ImporterFunc = func(ctx context.Context, d *ResourceData, meta interface{}) ([]*ResourceData, error)
type InstanceState ¶
type InstanceState = terraform.InstanceState
type MapFieldReader ¶
type MapFieldReader = schema.MapFieldReader
type MapFieldWriter ¶
type MapFieldWriter = schema.MapFieldWriter
type ResourceData ¶
type ResourceData = schema.ResourceData
type ResourceDiff ¶
type ResourceDiff = schema.ResourceDiff
type ResourceTimeout ¶
type ResourceTimeout = schema.ResourceTimeout
type RetryError ¶
type RetryError = resource.RetryError
RetryError is the required return type of RetryFunc. It forces client code to choose whether or not a given error is retryable. TODO: deprecate this in the future
func NonRetryableError ¶
func NonRetryableError(err error) *RetryError
NonRetryableError is a helper to create a RetryError that's _not_ retryable from a given error.
func RetryableError ¶
func RetryableError(err error) *RetryError
RetryableError is a helper to create a RetryError that's retryable from a given error.
type SchemaDiffSuppressFunc ¶
type SchemaDiffSuppressFunc = schema.SchemaDiffSuppressFunc
type SchemaSetFunc ¶
type SchemaSetFunc = schema.SchemaSetFunc
func HashResource ¶
func HashResource(resource *Resource) SchemaSetFunc
HashResource hashes complex structures that are described using a *Resource. This is the default set implementation used when a set's element type is a full resource.
type SchemaValidateFunc ¶
type Set ¶
func NewSet ¶
func NewSet(f SchemaSetFunc, items []interface{}) *Set
NewSet is a convenience method for creating a new set with the given items.
type StateChangeConf ¶
type StateChangeConf = resource.StateChangeConf
type StateRefreshFunc ¶
type StateRefreshFunc = resource.StateRefreshFunc
type StateUpgrade ¶
type StateUpgrade interface { // Schema is a point-in-time reference to the Schema at the time of this version // // This only needs to include the Fields and Optional/Required/Computed/Defaults // it does not need to include validation functions so can/should be simplified // // NOTE: This also shouldn't reference the existing schema since it's a // point-in-time reference Schema() map[string]*Schema // UpgradeFunc is the upgrade function which should be run when upgrading this // from the "current" version to the "next" version of this Resource. UpgradeFunc() StateUpgraderFunc }
type StateUpgrader ¶
type StateUpgrader = schema.StateUpgrader
func StateUpgrades ¶
func StateUpgrades(upgrades map[int]StateUpgrade) []StateUpgrader
StateUpgrades is a wrapper around the Plugin SDK's State Upgraders which allows us to upgrade the Plugin SDK without breaking all open PR's and attempts to make this interface a little less verbose.
type StateUpgraderFunc ¶
type TestCheckFunc ¶
type TestCheckFunc = resource.TestCheckFunc
type UpdateFunc ¶
type UpdateFunc = schema.UpdateFunc