Documentation ¶
Overview ¶
Package terraform is a generated GoMock package.
Index ¶
- Variables
- func GetProviderEnvSecretIDs(envConfig recipes.Configuration) map[string][]string
- func Install(ctx context.Context, installer *install.Installer, tfDir string) (*tfexec.Terraform, error)
- func NewExecutor(ucpConn sdk.Connection, secretProvider *ucp_provider.SecretProvider, ...) *executor
- func NewTerraform(ctx context.Context, tfRootDir, execPath string) (*tfexec.Terraform, error)
- type MockTerraformExecutor
- func (m *MockTerraformExecutor) Delete(arg0 context.Context, arg1 Options) error
- func (m *MockTerraformExecutor) Deploy(arg0 context.Context, arg1 Options) (*tfjson.State, error)
- func (m *MockTerraformExecutor) EXPECT() *MockTerraformExecutorMockRecorder
- func (m *MockTerraformExecutor) GetRecipeMetadata(arg0 context.Context, arg1 Options) (map[string]any, error)
- type MockTerraformExecutorDeleteCall
- func (c *MockTerraformExecutorDeleteCall) Do(f func(context.Context, Options) error) *MockTerraformExecutorDeleteCall
- func (c *MockTerraformExecutorDeleteCall) DoAndReturn(f func(context.Context, Options) error) *MockTerraformExecutorDeleteCall
- func (c *MockTerraformExecutorDeleteCall) Return(arg0 error) *MockTerraformExecutorDeleteCall
- type MockTerraformExecutorDeployCall
- func (c *MockTerraformExecutorDeployCall) Do(f func(context.Context, Options) (*tfjson.State, error)) *MockTerraformExecutorDeployCall
- func (c *MockTerraformExecutorDeployCall) DoAndReturn(f func(context.Context, Options) (*tfjson.State, error)) *MockTerraformExecutorDeployCall
- func (c *MockTerraformExecutorDeployCall) Return(arg0 *tfjson.State, arg1 error) *MockTerraformExecutorDeployCall
- type MockTerraformExecutorGetRecipeMetadataCall
- func (c *MockTerraformExecutorGetRecipeMetadataCall) Do(f func(context.Context, Options) (map[string]any, error)) *MockTerraformExecutorGetRecipeMetadataCall
- func (c *MockTerraformExecutorGetRecipeMetadataCall) DoAndReturn(f func(context.Context, Options) (map[string]any, error)) *MockTerraformExecutorGetRecipeMetadataCall
- func (c *MockTerraformExecutorGetRecipeMetadataCall) Return(arg0 map[string]any, arg1 error) *MockTerraformExecutorGetRecipeMetadataCall
- type MockTerraformExecutorMockRecorder
- func (mr *MockTerraformExecutorMockRecorder) Delete(arg0, arg1 any) *MockTerraformExecutorDeleteCall
- func (mr *MockTerraformExecutorMockRecorder) Deploy(arg0, arg1 any) *MockTerraformExecutorDeployCall
- func (mr *MockTerraformExecutorMockRecorder) GetRecipeMetadata(arg0, arg1 any) *MockTerraformExecutorGetRecipeMetadataCall
- type Options
- type TerraformExecutor
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRecipeNameEmpty is the error when the recipe name is empty. ErrRecipeNameEmpty = errors.New("recipe name cannot be empty") )
Functions ¶
func GetProviderEnvSecretIDs ¶ added in v0.36.0
func GetProviderEnvSecretIDs(envConfig recipes.Configuration) map[string][]string
GetProviderEnvSecretIDs parses the envConfig to extract secret IDs configured in providers configuration and environment variables and returns a map of secret store IDs and corresponding slice of keys.
func Install ¶
func Install(ctx context.Context, installer *install.Installer, tfDir string) (*tfexec.Terraform, error)
Install installs Terraform under /install in the provided Terraform root directory for the resource. It installs the latest version of Terraform and returns the path to the installed Terraform executable. It returns an error if the directory creation or Terraform installation fails.
func NewExecutor ¶
func NewExecutor(ucpConn sdk.Connection, secretProvider *ucp_provider.SecretProvider, k8sClientSet kubernetes.Interface) *executor
NewExecutor creates a new Executor with the given UCP connection and secret provider, to execute a Terraform recipe.
Types ¶
type MockTerraformExecutor ¶
type MockTerraformExecutor struct {
// contains filtered or unexported fields
}
MockTerraformExecutor is a mock of TerraformExecutor interface.
func NewMockTerraformExecutor ¶
func NewMockTerraformExecutor(ctrl *gomock.Controller) *MockTerraformExecutor
NewMockTerraformExecutor creates a new mock instance.
func (*MockTerraformExecutor) Delete ¶
func (m *MockTerraformExecutor) Delete(arg0 context.Context, arg1 Options) error
Delete mocks base method.
func (*MockTerraformExecutor) EXPECT ¶
func (m *MockTerraformExecutor) EXPECT() *MockTerraformExecutorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTerraformExecutor) GetRecipeMetadata ¶
func (m *MockTerraformExecutor) GetRecipeMetadata(arg0 context.Context, arg1 Options) (map[string]any, error)
GetRecipeMetadata mocks base method.
type MockTerraformExecutorDeleteCall ¶ added in v0.35.0
MockTerraformExecutorDeleteCall wrap *gomock.Call
func (*MockTerraformExecutorDeleteCall) Do ¶ added in v0.35.0
func (c *MockTerraformExecutorDeleteCall) Do(f func(context.Context, Options) error) *MockTerraformExecutorDeleteCall
Do rewrite *gomock.Call.Do
func (*MockTerraformExecutorDeleteCall) DoAndReturn ¶ added in v0.35.0
func (c *MockTerraformExecutorDeleteCall) DoAndReturn(f func(context.Context, Options) error) *MockTerraformExecutorDeleteCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockTerraformExecutorDeleteCall) Return ¶ added in v0.35.0
func (c *MockTerraformExecutorDeleteCall) Return(arg0 error) *MockTerraformExecutorDeleteCall
Return rewrite *gomock.Call.Return
type MockTerraformExecutorDeployCall ¶ added in v0.35.0
MockTerraformExecutorDeployCall wrap *gomock.Call
func (*MockTerraformExecutorDeployCall) Do ¶ added in v0.35.0
func (c *MockTerraformExecutorDeployCall) Do(f func(context.Context, Options) (*tfjson.State, error)) *MockTerraformExecutorDeployCall
Do rewrite *gomock.Call.Do
func (*MockTerraformExecutorDeployCall) DoAndReturn ¶ added in v0.35.0
func (c *MockTerraformExecutorDeployCall) DoAndReturn(f func(context.Context, Options) (*tfjson.State, error)) *MockTerraformExecutorDeployCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockTerraformExecutorDeployCall) Return ¶ added in v0.35.0
func (c *MockTerraformExecutorDeployCall) Return(arg0 *tfjson.State, arg1 error) *MockTerraformExecutorDeployCall
Return rewrite *gomock.Call.Return
type MockTerraformExecutorGetRecipeMetadataCall ¶ added in v0.35.0
MockTerraformExecutorGetRecipeMetadataCall wrap *gomock.Call
func (*MockTerraformExecutorGetRecipeMetadataCall) Do ¶ added in v0.35.0
func (c *MockTerraformExecutorGetRecipeMetadataCall) Do(f func(context.Context, Options) (map[string]any, error)) *MockTerraformExecutorGetRecipeMetadataCall
Do rewrite *gomock.Call.Do
func (*MockTerraformExecutorGetRecipeMetadataCall) DoAndReturn ¶ added in v0.35.0
func (c *MockTerraformExecutorGetRecipeMetadataCall) DoAndReturn(f func(context.Context, Options) (map[string]any, error)) *MockTerraformExecutorGetRecipeMetadataCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockTerraformExecutorGetRecipeMetadataCall) Return ¶ added in v0.35.0
func (c *MockTerraformExecutorGetRecipeMetadataCall) Return(arg0 map[string]any, arg1 error) *MockTerraformExecutorGetRecipeMetadataCall
Return rewrite *gomock.Call.Return
type MockTerraformExecutorMockRecorder ¶
type MockTerraformExecutorMockRecorder struct {
// contains filtered or unexported fields
}
MockTerraformExecutorMockRecorder is the mock recorder for MockTerraformExecutor.
func (*MockTerraformExecutorMockRecorder) Delete ¶
func (mr *MockTerraformExecutorMockRecorder) Delete(arg0, arg1 any) *MockTerraformExecutorDeleteCall
Delete indicates an expected call of Delete.
func (*MockTerraformExecutorMockRecorder) Deploy ¶
func (mr *MockTerraformExecutorMockRecorder) Deploy(arg0, arg1 any) *MockTerraformExecutorDeployCall
Deploy indicates an expected call of Deploy.
func (*MockTerraformExecutorMockRecorder) GetRecipeMetadata ¶
func (mr *MockTerraformExecutorMockRecorder) GetRecipeMetadata(arg0, arg1 any) *MockTerraformExecutorGetRecipeMetadataCall
GetRecipeMetadata indicates an expected call of GetRecipeMetadata.
type Options ¶
type Options struct { // RootDir is the root directory of where Terraform is installed and executed for a specific recipe deployment/deletion request. RootDir string // EnvConfig is the kubernetes runtime and cloud provider configuration for the Radius Environment in which the application consuming the terraform recipe will be deployed. EnvConfig *recipes.Configuration // EnvRecipe is the recipe metadata associated with the Radius Environment in which the application consuming the terraform recipe will be deployed. EnvRecipe *recipes.EnvironmentDefinition // ResourceRecipe is recipe metadata associated with the Radius resource deploying the Terraform recipe. ResourceRecipe *recipes.ResourceMetadata // Secrets represents a map of secrets required for recipe execution. // The outer map's key represents the secretStoreIDs while // while the inner map's key-value pairs represent the [secretKey]secretValue. Secrets map[string]map[string]string }
Options represents the options required to build inputs to interact with Terraform.
type TerraformExecutor ¶
type TerraformExecutor interface { // Deploy installs terraform and runs terraform init and apply on the terraform module referenced by the recipe using terraform-exec. Deploy(ctx context.Context, options Options) (*tfjson.State, error) // Delete installs terraform and runs terraform destroy on the terraform module referenced by the recipe using terraform-exec, // and deletes the Kubernetes secret created for terraform state store. Delete(ctx context.Context, options Options) error // GetRecipeMetadata installs terraform and runs terraform get to retrieve information on the terraform module GetRecipeMetadata(ctx context.Context, options Options) (map[string]any, error) }