Documentation ¶
Index ¶
- type Platform
- func (p *Platform) AddFile(filename, code string) *Platform
- func (p *Platform) AddProvider(name string, provider terraform.ResourceProvider) *Platform
- func (p *Platform) AddProvisioner(name string, provisioner terraform.ResourceProvisioner) *Platform
- func (p *Platform) Apply(destroy bool) error
- func (p *Platform) BindVars(vars map[string]interface{}) *Platform
- func (p *Platform) Export(dir string) error
- func (p *Platform) OutputValueAsString(name string) (string, error)
- func (p *Platform) PersistStateToFile(filename string) (*Platform, error)
- func (p *Platform) Plan(destroy bool) (*plans.Plan, error)
- func (p *Platform) ReadState(r io.Reader) (*Platform, error)
- func (p *Platform) ReadStateFromFile(filename string) (*Platform, error)
- func (p *Platform) SetMiddleware(lm *logger.Middleware) *Platform
- func (p *Platform) Stats() *Stats
- func (p *Platform) Var(name string, value interface{}) *Platform
- func (p *Platform) WriteState(w io.Writer) (*Platform, error)
- func (p *Platform) WriteStateToFile(filename string) (*Platform, error)
- type Provider
- func (p *Provider) ApplyResourceChange(req providers.ApplyResourceChangeRequest) (resp providers.ApplyResourceChangeResponse)
- func (p *Provider) Close() error
- func (p *Provider) Configure(req providers.ConfigureRequest) (resp providers.ConfigureResponse)
- func (p *Provider) GetSchema() (resp providers.GetSchemaResponse)
- func (p *Provider) ImportResourceState(req providers.ImportResourceStateRequest) (resp providers.ImportResourceStateResponse)
- func (p *Provider) PlanResourceChange(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse)
- func (p *Provider) PrepareProviderConfig(req providers.PrepareProviderConfigRequest) (resp providers.PrepareProviderConfigResponse)
- func (p *Provider) ReadDataSource(req providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse)
- func (p *Provider) ReadResource(req providers.ReadResourceRequest) (resp providers.ReadResourceResponse)
- func (p *Provider) Stop() error
- func (p *Provider) UpgradeResourceState(req providers.UpgradeResourceStateRequest) (resp providers.UpgradeResourceStateResponse)
- func (p *Provider) ValidateDataSourceConfig(req providers.ValidateDataSourceConfigRequest) (resp providers.ValidateDataSourceConfigResponse)
- func (p *Provider) ValidateResourceTypeConfig(req providers.ValidateResourceTypeConfigRequest) (resp providers.ValidateResourceTypeConfigResponse)
- type Provisioner
- func (p *Provisioner) Close() error
- func (p *Provisioner) GetSchema() (resp provisioners.GetSchemaResponse)
- func (p *Provisioner) ProvisionResource(req provisioners.ProvisionResourceRequest) (resp provisioners.ProvisionResourceResponse)
- func (p *Provisioner) Stop() error
- func (p *Provisioner) ValidateProvisionerConfig(req provisioners.ValidateProvisionerConfigRequest) (resp provisioners.ValidateProvisionerConfigResponse)
- type State
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Platform ¶
type Platform struct { Code map[string]string Providers map[addrs.Provider]providers.Factory Provisioners map[string]provisioners.Factory Vars map[string]interface{} State *State Hooks []terraform.Hook LogMiddleware *logger.Middleware ExpectedStats *Stats // contains filtered or unexported fields }
Platform is the platform to be managed by Terraform
func NewPlatform ¶
NewPlatform return an instance of Platform with default values
func (*Platform) AddFile ¶
AddFile adds Terraform code into a file. Such file could be in a directory, use os.PathSeparator as path separator.
func (*Platform) AddProvider ¶
func (p *Platform) AddProvider(name string, provider terraform.ResourceProvider) *Platform
AddProvider adds a new provider to the providers list
func (*Platform) AddProvisioner ¶
func (p *Platform) AddProvisioner(name string, provisioner terraform.ResourceProvisioner) *Platform
AddProvisioner adds a new provisioner to the provisioner list
func (*Platform) Apply ¶
Apply brings the platform to the desired state. It'll destroy the platform when `destroy` is `true`.
func (*Platform) BindVars ¶
BindVars binds the map of variables to the Platform variables, to be used by Terraform
func (*Platform) Export ¶
Export save all the code to the given directory. The directory must exists and there should be code to export.
func (*Platform) OutputValueAsString ¶
OutputValueAsString returns the value of the Terraform output parameter in the code
func (*Platform) PersistStateToFile ¶
PersistStateToFile reads the state from the given file, if exists. Then will save the current state to the given file every time it changes during the Terraform actions.
func (*Platform) Plan ¶
Plan returns execution plan for an existing configuration to apply to the platform.
func (*Platform) ReadState ¶
ReadState takes a io.Reader as input to read from it the Terraform state
func (*Platform) ReadStateFromFile ¶
ReadStateFromFile will load the Terraform state from a file and assign it to the Platform state.
func (*Platform) SetMiddleware ¶
func (p *Platform) SetMiddleware(lm *logger.Middleware) *Platform
SetMiddleware assigns the given log middleware into the Platform
func (*Platform) WriteState ¶
WriteState takes a io.Writer as input to write the Terraform state
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the provider.Interface wrapping the legacy ResourceProvider but not using gRPC like terraform does
func NewProvider ¶
func NewProvider(provider terraform.ResourceProvider) *Provider
NewProvider creates a Terranova Provider to wrap the given legacy ResourceProvider
func (*Provider) ApplyResourceChange ¶
func (p *Provider) ApplyResourceChange(req providers.ApplyResourceChangeRequest) (resp providers.ApplyResourceChangeResponse)
ApplyResourceChange implements the ApplyResourceChange from providers.Interface. Takes the planned state for a resource, which may yet contain unknown computed values, and applies the changes returning the final state.
func (*Provider) Close ¶
Close implements the Close from providers.Interface. It's to shuts down the plugin process but this is not a plugin, so nothing is done here
func (*Provider) Configure ¶
func (p *Provider) Configure(req providers.ConfigureRequest) (resp providers.ConfigureResponse)
Configure implements the Configure from providers.Interface. Configures and initialized the provider.
func (*Provider) GetSchema ¶
func (p *Provider) GetSchema() (resp providers.GetSchemaResponse)
GetSchema implements the GetSchema from providers.Interface. Returns the complete schema for the provider.
func (*Provider) ImportResourceState ¶
func (p *Provider) ImportResourceState(req providers.ImportResourceStateRequest) (resp providers.ImportResourceStateResponse)
ImportResourceState implements the ImportResourceState from providers.Interface. Requests that the given resource be imported.
func (*Provider) PlanResourceChange ¶
func (p *Provider) PlanResourceChange(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse)
PlanResourceChange implements the PlanResourceChange from providers.Interface. Takes the current state and proposed state of a resource, and returns the planned final state.
func (*Provider) PrepareProviderConfig ¶
func (p *Provider) PrepareProviderConfig(req providers.PrepareProviderConfigRequest) (resp providers.PrepareProviderConfigResponse)
PrepareProviderConfig implements the PrepareProviderConfig from providers.Interface. Allows the provider to validate the configuration values, and set or override any values with defaults.
func (*Provider) ReadDataSource ¶
func (p *Provider) ReadDataSource(req providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse)
ReadDataSource implements the ReadDataSource from providers.Interface. Returns the data source's current state.
func (*Provider) ReadResource ¶
func (p *Provider) ReadResource(req providers.ReadResourceRequest) (resp providers.ReadResourceResponse)
ReadResource implements the ReadResource from providers.Interface. Refreshes a resource and returns its current state.
func (*Provider) Stop ¶
Stop implements the Stop from providers.Interface. It is called when the provider should halt any in-flight actions.
Stop should not block waiting for in-flight actions to complete. It should take any action it wants and return immediately acknowledging it has received the stop request. Terraform will not make any further API calls to the provider after Stop is called.
The error returned, if non-nil, is assumed to mean that signaling the stop somehow failed and that the user should expect potentially waiting a longer period of time.
func (*Provider) UpgradeResourceState ¶
func (p *Provider) UpgradeResourceState(req providers.UpgradeResourceStateRequest) (resp providers.UpgradeResourceStateResponse)
UpgradeResourceState implements the UpgradeResourceState from providers.Interface. It is called when the state loader encounters an instance state whose schema version is less than the one reported by the currently-used version of the corresponding provider, and the upgraded result is used for any further processing.
func (*Provider) ValidateDataSourceConfig ¶
func (p *Provider) ValidateDataSourceConfig(req providers.ValidateDataSourceConfigRequest) (resp providers.ValidateDataSourceConfigResponse)
ValidateDataSourceConfig implements the ValidateDataSourceConfig from providers.Interface. Allows the provider to validate the data source configuration values.
func (*Provider) ValidateResourceTypeConfig ¶
func (p *Provider) ValidateResourceTypeConfig(req providers.ValidateResourceTypeConfigRequest) (resp providers.ValidateResourceTypeConfigResponse)
ValidateResourceTypeConfig implements the ValidateResourceTypeConfig from providers.Interface. Allows the provider to validate the resource configuration values.
type Provisioner ¶
type Provisioner struct {
// contains filtered or unexported fields
}
Provisioner implements the provisioners.Interface wrapping the legacy terraform.ResourceProvisioner but not using gRPC like terraform does
func NewProvisioner ¶
func NewProvisioner(provisioner terraform.ResourceProvisioner) *Provisioner
NewProvisioner creates a Terranova Provisioner to wrap the given legacy ResourceProvisioner
func (*Provisioner) Close ¶
func (p *Provisioner) Close() error
Close implements Close from provisioners.Interface. It shuts down the plugin process if applicable.
func (*Provisioner) GetSchema ¶
func (p *Provisioner) GetSchema() (resp provisioners.GetSchemaResponse)
GetSchema implements GetSchema from provisioners.Interface. It returns the schema for the provisioner configuration.
func (*Provisioner) ProvisionResource ¶
func (p *Provisioner) ProvisionResource(req provisioners.ProvisionResourceRequest) (resp provisioners.ProvisionResourceResponse)
ProvisionResource implements ProvisionResource from provisioners.Interface. It runs the provisioner with provided configuration. ProvisionResource blocks until the execution is complete. If the returned diagnostics contain any errors, the resource will be left in a tainted state.
func (*Provisioner) Stop ¶
func (p *Provisioner) Stop() error
Stop implements Stop from provisioners.Interface. It is called to interrupt the provisioner.
Stop should not block waiting for in-flight actions to complete. It should take any action it wants and return immediately acknowledging it has received the stop request. Terraform will not make any further API calls to the provisioner after Stop is called.
The error returned, if non-nil, is assumed to mean that signaling the stop somehow failed and that the user should expect potentially waiting a longer period of time.
func (*Provisioner) ValidateProvisionerConfig ¶
func (p *Provisioner) ValidateProvisionerConfig(req provisioners.ValidateProvisionerConfigRequest) (resp provisioners.ValidateProvisionerConfigResponse)
ValidateProvisionerConfig implements ValidateProvisionerConfig from provisioners.Interface. It allows the provisioner to validate the configuration values.
type Stats ¶
type Stats struct {
Add, Change, Destroy int
// contains filtered or unexported fields
}
Stats encapsulate the statistics of changes to apply or applied
func (*Stats) FromCountHook ¶
FromCountHook return stats from a given count hook