Documentation ¶
Index ¶
Examples ¶
Constants ¶
const TerraformProviderFake = "fake-sync"
TerraformProviderFake is the name of a fake Terraform provider
const (
// TerraformProviderPanos is the name of a Palo Alto PANOS Terraform provider.
TerraformProviderPanos = "panos"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake is the handler for out-of-band actions for a fake Terraform provider. Intended to be used for testing and examples.
type Handler ¶
type Handler interface { // Do executes the handler. Receives previous error and returns previous // error wrapped in any new errors. Do(error) error // SetNext sets the next handler that should be called SetNext(Handler) }
Handler handles additional actions that need to be executed. These can be at any level. Handlers can be chained such that they execute and continue to the next handler. A chain of handlers will return an aggregate of any errors after the handlers are all executed.
func TerraformProviderHandler ¶
TerraformProviderHandler returns the handler for providers that require post-Apply, out-of-band actions for a Terraform driver.
Returned handler may be nil even if returned err is nil. This happens when no providers have a handler.
Example ¶
providers := make([]map[string]interface{}, 0) fourth := make(map[string]interface{}) fourth[TerraformProviderFake] = map[string]interface{}{ "name": "4", "err": true, } providers = append(providers, fourth) third := make(map[string]interface{}) third[TerraformProviderFake] = map[string]interface{}{ "name": "3", } providers = append(providers, third) second := make(map[string]interface{}) second[TerraformProviderFake] = map[string]interface{}{ "name": "2", "err": true, } providers = append(providers, second) first := make(map[string]interface{}) first[TerraformProviderFake] = map[string]interface{}{ "name": "1", } providers = append(providers, first) var next Handler = nil for _, p := range providers { for k, v := range p { h, err := TerraformProviderHandler(k, v) if err != nil { fmt.Println(err) return } if h != nil { h.SetNext(next) next = h } } } fmt.Println("Handler Errors:", next.Do(nil))
Output: FakeHandler: '1' FakeHandler: '2' FakeHandler: '3' FakeHandler: '4' Handler Errors: error 4: error 2
type Panos ¶
type Panos struct {
// contains filtered or unexported fields
}
Panos is the post-apply handler for the panos Terraform Provider. It performs the out-of-band Commit API request needed after a Terraform apply.
See https://registry.terraform.io/providers/PaloAltoNetworks/panos/latest/docs for details on Commit and panos provider (outdated use of SDK at the time). See https://github.com/PaloAltoNetworks/pango for latest version of SDK.