Documentation ¶
Overview ¶
Package tf implements the Terraform "provider". In the past there were other providers, but there aren't anymore, so this is a deprecated pattern
Index ¶
- Constants
- func CheckTerraformPlanOutput(logger lager.Logger, output executor.ExecutionOutput) error
- type DeploymentManager
- func (d *DeploymentManager) CreateAndSaveDeployment(deploymentID string, workspace *workspace.TerraformWorkspace) (storage.TerraformDeployment, error)
- func (d *DeploymentManager) DeleteTerraformDeployment(deploymentID string) error
- func (d *DeploymentManager) GetBindingDeployments(deploymentID string) ([]storage.TerraformDeployment, error)
- func (d *DeploymentManager) GetTerraformDeployment(deploymentID string) (storage.TerraformDeployment, error)
- func (d *DeploymentManager) MarkOperationFinished(deployment *storage.TerraformDeployment, err error) error
- func (d *DeploymentManager) MarkOperationStarted(deployment *storage.TerraformDeployment, operationType string) error
- func (d *DeploymentManager) OperationStatus(deploymentID string) (bool, string, string, error)
- func (d *DeploymentManager) ResetOperationType(deploymentID string) error
- func (d *DeploymentManager) UpdateWorkspaceHCL(deploymentID string, serviceDefinitionAction TfServiceDefinitionV1Action, ...) error
- type DeploymentManagerInterface
- type ImportParameterMapping
- type ImportResource
- type TerraformProvider
- func (provider *TerraformProvider) Bind(ctx context.Context, bindContext *varcontext.VarContext) (map[string]any, error)
- func (provider *TerraformProvider) CheckOperationConstraints(deploymentID string, operationType string) error
- func (provider *TerraformProvider) CheckUpgradeAvailable(deploymentGUID string) error
- func (provider *TerraformProvider) ClearOperationType(ctx context.Context, instanceGUID string) error
- func (provider *TerraformProvider) DefaultInvoker() invoker.TerraformInvoker
- func (provider *TerraformProvider) DeleteBindingData(ctx context.Context, instanceGUID, bindingID string) error
- func (provider *TerraformProvider) DeleteInstanceData(ctx context.Context, instanceGUID string) error
- func (provider *TerraformProvider) Deprovision(ctx context.Context, instanceGUID string, vc *varcontext.VarContext) (*string, error)
- func (provider *TerraformProvider) GetImportedProperties(ctx context.Context, instanceGUID string, ...) (map[string]any, error)
- func (provider *TerraformProvider) GetTerraformOutputs(_ context.Context, instanceGUID string) (storage.JSONObject, error)
- func (provider *TerraformProvider) PollInstance(_ context.Context, instanceGUID string) (bool, string, string, error)
- func (provider *TerraformProvider) Provision(ctx context.Context, provisionContext *varcontext.VarContext) error
- func (provider *TerraformProvider) Unbind(ctx context.Context, instanceGUID, bindingID string, vc *varcontext.VarContext) error
- func (provider *TerraformProvider) Update(ctx context.Context, updateContext *varcontext.VarContext) error
- func (provider *TerraformProvider) UpgradeBindings(ctx context.Context, instanceContext *varcontext.VarContext, ...) error
- func (provider *TerraformProvider) UpgradeInstance(ctx context.Context, instanceContext *varcontext.VarContext) (*sync.WaitGroup, error)
- func (provider *TerraformProvider) VersionedInvoker(version *version.Version) invoker.TerraformInvoker
- func (provider *TerraformProvider) Wait(ctx context.Context, id string) error
- type TfCatalogDefinitionV1
- type TfServiceDefinitionV1
- type TfServiceDefinitionV1Action
- func (action *TfServiceDefinitionV1Action) IsTfImport(provisionContext *varcontext.VarContext) bool
- func (action *TfServiceDefinitionV1Action) LoadTemplate(srcDir string) error
- func (action *TfServiceDefinitionV1Action) Validate() (errs *validation.FieldError)
- func (action *TfServiceDefinitionV1Action) ValidateTemplateIO() (errs *validation.FieldError)
- type TfServiceDefinitionV1Plan
Constants ¶
const ( InProgress = "in progress" Succeeded = "succeeded" Failed = "failed" )
Variables ¶
This section is empty.
Functions ¶
func CheckTerraformPlanOutput ¶
func CheckTerraformPlanOutput(logger lager.Logger, output executor.ExecutionOutput) error
Types ¶
type DeploymentManager ¶
type DeploymentManager struct {
// contains filtered or unexported fields
}
func NewDeploymentManager ¶
func NewDeploymentManager(store broker.ServiceProviderStorage, logger lager.Logger) *DeploymentManager
func (*DeploymentManager) CreateAndSaveDeployment ¶
func (d *DeploymentManager) CreateAndSaveDeployment(deploymentID string, workspace *workspace.TerraformWorkspace) (storage.TerraformDeployment, error)
func (*DeploymentManager) DeleteTerraformDeployment ¶
func (d *DeploymentManager) DeleteTerraformDeployment(deploymentID string) error
func (*DeploymentManager) GetBindingDeployments ¶
func (d *DeploymentManager) GetBindingDeployments(deploymentID string) ([]storage.TerraformDeployment, error)
func (*DeploymentManager) GetTerraformDeployment ¶
func (d *DeploymentManager) GetTerraformDeployment(deploymentID string) (storage.TerraformDeployment, error)
func (*DeploymentManager) MarkOperationFinished ¶
func (d *DeploymentManager) MarkOperationFinished(deployment *storage.TerraformDeployment, err error) error
func (*DeploymentManager) MarkOperationStarted ¶
func (d *DeploymentManager) MarkOperationStarted(deployment *storage.TerraformDeployment, operationType string) error
func (*DeploymentManager) OperationStatus ¶
func (*DeploymentManager) ResetOperationType ¶ added in v2.4.1
func (d *DeploymentManager) ResetOperationType(deploymentID string) error
func (*DeploymentManager) UpdateWorkspaceHCL ¶
func (d *DeploymentManager) UpdateWorkspaceHCL(deploymentID string, serviceDefinitionAction TfServiceDefinitionV1Action, templateVars map[string]any) error
type DeploymentManagerInterface ¶
type DeploymentManagerInterface interface { GetTerraformDeployment(deploymentID string) (storage.TerraformDeployment, error) CreateAndSaveDeployment(deploymentID string, workspace *workspace.TerraformWorkspace) (storage.TerraformDeployment, error) MarkOperationStarted(deployment *storage.TerraformDeployment, operationType string) error MarkOperationFinished(deployment *storage.TerraformDeployment, err error) error OperationStatus(deploymentID string) (bool, string, string, error) UpdateWorkspaceHCL(deploymentID string, serviceDefinitionAction TfServiceDefinitionV1Action, templateVars map[string]any) error GetBindingDeployments(deploymentID string) ([]storage.TerraformDeployment, error) DeleteTerraformDeployment(deploymentID string) error ResetOperationType(deploymentID string) error }
type ImportParameterMapping ¶
type ImportParameterMapping struct { TfVariable string `yaml:"tf_variable"` ParameterName string `yaml:"parameter_name"` }
ImportParameterMapping mapping for tf variable to service parameter
type ImportResource ¶
ImportResource represents TF resource to IaaS resource ID mapping for import
type TerraformProvider ¶
type TerraformProvider struct { invoker.TerraformInvokerBuilder DeploymentManagerInterface // contains filtered or unexported fields }
func NewTerraformProvider ¶
func NewTerraformProvider( tfBinContext executor.TFBinariesContext, invokerBuilder invoker.TerraformInvokerBuilder, logger lager.Logger, serviceDefinition TfServiceDefinitionV1, deploymentManager DeploymentManagerInterface, ) *TerraformProvider
NewTerraformProvider creates a new ServiceProvider backed by Terraform module definitions for provision and bind.
func (*TerraformProvider) Bind ¶
func (provider *TerraformProvider) Bind(ctx context.Context, bindContext *varcontext.VarContext) (map[string]any, error)
Bind creates a new backing Terraform job and executes it, waiting on the result.
func (*TerraformProvider) CheckOperationConstraints ¶
func (provider *TerraformProvider) CheckOperationConstraints(deploymentID string, operationType string) error
func (*TerraformProvider) CheckUpgradeAvailable ¶
func (provider *TerraformProvider) CheckUpgradeAvailable(deploymentGUID string) error
func (*TerraformProvider) ClearOperationType ¶ added in v2.4.1
func (provider *TerraformProvider) ClearOperationType(ctx context.Context, instanceGUID string) error
func (*TerraformProvider) DefaultInvoker ¶
func (provider *TerraformProvider) DefaultInvoker() invoker.TerraformInvoker
func (*TerraformProvider) DeleteBindingData ¶
func (provider *TerraformProvider) DeleteBindingData(ctx context.Context, instanceGUID, bindingID string) error
DeleteBindingData deletes a terraform deployment from the database
func (*TerraformProvider) DeleteInstanceData ¶
func (provider *TerraformProvider) DeleteInstanceData(ctx context.Context, instanceGUID string) error
DeleteInstanceData deletes a terraform deployment from the database
func (*TerraformProvider) Deprovision ¶
func (provider *TerraformProvider) Deprovision(ctx context.Context, instanceGUID string, vc *varcontext.VarContext) (*string, error)
Deprovision performs a terraform destroy on the instance.
func (*TerraformProvider) GetImportedProperties ¶
func (*TerraformProvider) GetTerraformOutputs ¶
func (provider *TerraformProvider) GetTerraformOutputs(_ context.Context, instanceGUID string) (storage.JSONObject, error)
func (*TerraformProvider) PollInstance ¶
func (provider *TerraformProvider) PollInstance(_ context.Context, instanceGUID string) (bool, string, string, error)
PollInstance returns the instance status of the backing job.
func (*TerraformProvider) Provision ¶
func (provider *TerraformProvider) Provision(ctx context.Context, provisionContext *varcontext.VarContext) error
Provision creates the necessary resources that an instance of this service needs to operate.
func (*TerraformProvider) Unbind ¶
func (provider *TerraformProvider) Unbind(ctx context.Context, instanceGUID, bindingID string, vc *varcontext.VarContext) error
Unbind performs a terraform destroy on the binding.
func (*TerraformProvider) Update ¶
func (provider *TerraformProvider) Update(ctx context.Context, updateContext *varcontext.VarContext) error
Update makes necessary updates to resources, so they match new desired configuration
func (*TerraformProvider) UpgradeBindings ¶
func (provider *TerraformProvider) UpgradeBindings(ctx context.Context, instanceContext *varcontext.VarContext, bindingContexts []*varcontext.VarContext) error
func (*TerraformProvider) UpgradeInstance ¶
func (provider *TerraformProvider) UpgradeInstance(ctx context.Context, instanceContext *varcontext.VarContext) (*sync.WaitGroup, error)
func (*TerraformProvider) VersionedInvoker ¶
func (provider *TerraformProvider) VersionedInvoker(version *version.Version) invoker.TerraformInvoker
type TfCatalogDefinitionV1 ¶
type TfCatalogDefinitionV1 []*TfServiceDefinitionV1
func (TfCatalogDefinitionV1) Validate ¶
func (tfb TfCatalogDefinitionV1) Validate() (errs *validation.FieldError)
Validate checks the service definitions for semantic errors.
type TfServiceDefinitionV1 ¶
type TfServiceDefinitionV1 struct { Version int `yaml:"version"` Name string `yaml:"name"` ID string `yaml:"id"` Description string `yaml:"description"` DisplayName string `yaml:"display_name"` ImageURL serviceimage.ServiceImage `yaml:"image_url"` DocumentationURL string `yaml:"documentation_url"` ProviderDisplayName string `yaml:"provider_display_name"` SupportURL string `yaml:"support_url"` Tags []string `yaml:"tags,flow"` Plans []TfServiceDefinitionV1Plan `yaml:"plans"` ProvisionSettings TfServiceDefinitionV1Action `yaml:"provision"` BindSettings TfServiceDefinitionV1Action `yaml:"bind"` Examples []broker.ServiceExample `yaml:"examples"` PlanUpdateable bool `yaml:"plan_updateable"` RequiredEnvVars []string }
TfServiceDefinitionV1 is the first version of user defined services.
func NewExampleTfServiceDefinition ¶
func NewExampleTfServiceDefinition(serviceID string, planID string) TfServiceDefinitionV1
NewExampleTfServiceDefinition creates a new service definition with sample values for the service broker suitable to give a user a template to manually edit.
func (*TfServiceDefinitionV1) ToService ¶
func (tfb *TfServiceDefinitionV1) ToService(tfBinContext executor.TFBinariesContext, maintenanceInfo *domain.MaintenanceInfo) (*broker.ServiceDefinition, error)
ToService converts the flat TfServiceDefinitionV1 into a broker.ServiceDefinition that the registry can use.
func (*TfServiceDefinitionV1) Validate ¶
func (tfb *TfServiceDefinitionV1) Validate() (errs *validation.FieldError)
Validate checks the service definition for semantic errors.
type TfServiceDefinitionV1Action ¶
type TfServiceDefinitionV1Action struct { PlanInputs []broker.BrokerVariable `yaml:"plan_inputs"` UserInputs []broker.BrokerVariable `yaml:"user_inputs"` Computed []varcontext.DefaultVariable `yaml:"computed_inputs"` Template string `yaml:"template"` TemplateRef string `yaml:"template_ref"` Outputs []broker.BrokerVariable `yaml:"outputs"` Templates map[string]string `yaml:"templates"` TemplateRefs map[string]string `yaml:"template_refs"` ImportVariables []broker.ImportVariable `yaml:"import_inputs"` ImportParameterMappings []ImportParameterMapping `yaml:"import_parameter_mappings"` ImportParametersToDelete []string `yaml:"import_parameters_to_delete"` ImportParametersToAdd []ImportParameterMapping `yaml:"import_parameters_to_add"` }
TfServiceDefinitionV1Action holds information needed to process user inputs for a single provision or bind call.
func (*TfServiceDefinitionV1Action) IsTfImport ¶
func (action *TfServiceDefinitionV1Action) IsTfImport(provisionContext *varcontext.VarContext) bool
func (*TfServiceDefinitionV1Action) LoadTemplate ¶
func (action *TfServiceDefinitionV1Action) LoadTemplate(srcDir string) error
LoadTemplate loads template ref into template if provided
func (*TfServiceDefinitionV1Action) Validate ¶
func (action *TfServiceDefinitionV1Action) Validate() (errs *validation.FieldError)
Validate implements validation.Validatable.
func (*TfServiceDefinitionV1Action) ValidateTemplateIO ¶
func (action *TfServiceDefinitionV1Action) ValidateTemplateIO() (errs *validation.FieldError)
type TfServiceDefinitionV1Plan ¶
type TfServiceDefinitionV1Plan struct { Name string `yaml:"name"` ID string `yaml:"id"` Description string `yaml:"description"` DisplayName string `yaml:"display_name"` Bullets []string `yaml:"bullets,omitempty"` Free bool `yaml:"free,omitempty"` Properties map[string]any `yaml:"properties"` ProvisionOverrides map[string]any `yaml:"provision_overrides,omitempty"` BindOverrides map[string]any `yaml:"bind_overrides,omitempty"` }
TfServiceDefinitionV1Plan represents a service plan in a human-friendly format that can be converted into an OSB compatible plan.
func (*TfServiceDefinitionV1Plan) ToPlan ¶
func (plan *TfServiceDefinitionV1Plan) ToPlan(maintenanceInfo *domain.MaintenanceInfo) broker.ServicePlan
ToPlan converts this plan definition to a broker.ServicePlan.
func (*TfServiceDefinitionV1Plan) Validate ¶
func (plan *TfServiceDefinitionV1Plan) Validate() (errs *validation.FieldError)
Validate implements validation.Validatable.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package command is an interface for the Terraform command
|
Package command is an interface for the Terraform command |
Package executor executes Terraform
|
Package executor executes Terraform |
executorfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Package hclparser is used to parse HCL (Hashicorp Configuration Language) that Terraform is written in
|
Package hclparser is used to parse HCL (Hashicorp Configuration Language) that Terraform is written in |
Package invoker allows different Terraform versions to be invoked
|
Package invoker allows different Terraform versions to be invoked |
invokerfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Package workspace is a model for Terraform workspaces
|
Package workspace is a model for Terraform workspaces |
workspacefakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |