config

package
v0.31.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RecipeParams

type RecipeParams map[string]any

RecipeParams is the map of recipe parameters and its values.

type TFModuleConfig

type TFModuleConfig map[string]any

TFModuleConfig is the type of Terraform module configuration.

func (TFModuleConfig) SetParams

func (tf TFModuleConfig) SetParams(params RecipeParams)

SetParams sets the recipe parameters in the Terraform module configuration.

type TerraformConfig

type TerraformConfig struct {
	// Terraform represents number of settings related to Terraform's behavior.
	Terraform *TerraformDefinition `json:"terraform"`

	// Provider is the Terraform provider configuration.
	// https://developer.hashicorp.com/terraform/language/providers/configuration
	// https://developer.hashicorp.com/terraform/language/syntax/json#provider-blocks
	Provider map[string]any `json:"provider,omitempty"`

	// Module is the Terraform module configuration.
	// https://developer.hashicorp.com/terraform/language/modules/syntax
	Module map[string]TFModuleConfig `json:"module"`

	// Output is the Terraform output configuration.
	// https://developer.hashicorp.com/terraform/language/values/outputs
	Output map[string]any `json:"output,omitempty"`
}

TerraformConfig represents the Terraform configuration file structure for properties populated in the configuration by Radius.

func New

func New(ctx context.Context, moduleName string, envRecipe *recipes.EnvironmentDefinition, resourceRecipe *recipes.ResourceMetadata, envConfig *recipes.Configuration) (*TerraformConfig, error)

New creates TerraformConfig with the given module name and its inputs (module source, version, parameters) Parameters are populated from environment recipe and resource recipe metadata.

func (*TerraformConfig) AddOutputs

func (cfg *TerraformConfig) AddOutputs(localModuleName string) error

Add outputs to the config file referencing module outputs to populate expected Radius resource outputs. Outputs of modules are accessible through this format: module.<MODULE NAME>.<OUTPUT NAME> https://developer.hashicorp.com/terraform/language/modules/syntax#accessing-module-output-values This function only updates config in memory, Save() must be called to persist the updated config.

func (*TerraformConfig) AddProviders

func (cfg *TerraformConfig) AddProviders(ctx context.Context, requiredProviders []string, ucpConfiguredProviders map[string]providers.Provider, envConfig *recipes.Configuration) error

AddProviders adds provider configurations for requiredProviders that are supported by Radius to generate custom provider configurations. Save() must be called to save the generated providers config. requiredProviders contains a list of provider names that are required for the module.

func (*TerraformConfig) AddRecipeContext

func (cfg *TerraformConfig) AddRecipeContext(ctx context.Context, moduleName string, recipeCtx *recipecontext.Context) error

AddRecipeContext adds RecipeContext to TerraformConfig module parameters if recipeCtx is not nil. Save() must be called after adding recipe context to the module config.

func (*TerraformConfig) AddTerraformBackend

func (cfg *TerraformConfig) AddTerraformBackend(resourceRecipe *recipes.ResourceMetadata, backend backends.Backend) (map[string]any, error)

AddTerraformBackend adds backend configurations to store Terraform state file for the deployment. Save() must be called to save the generated backend config. Currently, the supported backend for Terraform Recipes is Kubernetes secret. https://developer.hashicorp.com/terraform/language/settings/backends/kubernetes

func (*TerraformConfig) Save

func (cfg *TerraformConfig) Save(ctx context.Context, workingDir string) error

Save writes the Terraform config to main.tf.json file in the working directory. This overwrites the existing file if it exists.

type TerraformDefinition

type TerraformDefinition struct {
	// Backend defines where Terraform stores its state.
	// https://developer.hashicorp.com/terraform/language/state
	Backend map[string]interface{} `json:"backend"`
}

Directories

Path Synopsis
Package backends is a generated GoMock package.
Package backends is a generated GoMock package.
Package providers is a generated GoMock package.
Package providers is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL