terraform

package
v0.0.0-...-4ff0b0b Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlatformReferencePrefix_File  = "file:"
	PlatformReferencePrefix_Https = "https://"
	PlatformReferencePrefix_Git   = "git+"
)

Variables

View Source
var (
	ErrPlatformNotFound = fmt.Errorf("platform not found")
	ErrUnauthenticated  = fmt.Errorf("unauthenticated")
)

Functions

func WithOutputDir

func WithOutputDir(outputDir string) terraformEngineOption

func WithRepository

func WithRepository(repository PluginRepository) terraformEngineOption

Types

type DeploymentModule

type DeploymentModule struct {
	Terraform string `json:"terraform" yaml:"terraform"`
}

type Identifiable

type Identifiable interface {
	GetIdentity(string) (*ResourceBlueprint, error)
	GetIdentities() map[string]ResourceBlueprint
}

type IdentitiesBlueprint

type IdentitiesBlueprint struct {
	Identities []ResourceBlueprint `json:"identities" yaml:"identities"`
}

func (IdentitiesBlueprint) GetIdentities

func (i IdentitiesBlueprint) GetIdentities() []ResourceBlueprint

type IdentityPluginManifest

type IdentityPluginManifest struct {
	PluginManifest `json:",inline" yaml:",inline"`
	IdentityType   string `json:"identity_type" yaml:"identity_type"`
}

type Library

type Library struct {
	Team    string `json:"team" yaml:"team"`
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version" yaml:"version"`
}

type NilTerraformBackend

type NilTerraformBackend struct {
	cdktf.TerraformBackend
}

NilTerraformBackend prevents cdktf from automatically defining a backend in the output Terraform configuration.

func NewNilTerraformBackend

func NewNilTerraformBackend(app constructs.Construct, name *string) *NilTerraformBackend

NewNilTerraformBackend creates a nil backend that prevents the backend field from being defined in the output terraform. We have this here as there is no way to disable the backend in cdktf. https://github.com/hashicorp/terraform-cdk/issues/2435

func (*NilTerraformBackend) ToTerraform

func (t *NilTerraformBackend) ToTerraform() interface{}

ToTerraform returns empty config to ensure an undefined backend in the output.

type PanicError

type PanicError struct {
	OriginalPanic interface{}
	StackTrace    []byte
}

PanicError represents an error that occurred due to a panic during terraform operations

func NewPanicError

func NewPanicError(panicValue interface{}, stackTrace []byte) *PanicError

NewPanicError creates a new PanicError with the given panic details

func (*PanicError) Error

func (e *PanicError) Error() string

func (*PanicError) Is

func (e *PanicError) Is(target error) bool

type PlatformReferencePrefix

type PlatformReferencePrefix string

type PlatformRepository

type PlatformRepository interface {
	// <team>/<platform>/<revision>
	GetPlatform(string) (*PlatformSpec, error)
}

type PlatformSpec

type PlatformSpec struct {
	Name string `json:"name" yaml:"name"`

	Libraries map[string]string `json:"libraries" yaml:"libraries"`

	Variables map[string]Variable `json:"variables" yaml:"variables,omitempty"`

	ServiceBlueprints    map[string]*ServiceBlueprint  `json:"services" yaml:"services"`
	BucketBlueprints     map[string]*ResourceBlueprint `json:"buckets,omitempty" yaml:"buckets,omitempty"`
	TopicBlueprints      map[string]*ResourceBlueprint `json:"topics,omitempty" yaml:"topics,omitempty"`
	DatabaseBlueprints   map[string]*ResourceBlueprint `json:"databases,omitempty" yaml:"databases,omitempty"`
	EntrypointBlueprints map[string]*ResourceBlueprint `json:"entrypoints" yaml:"entrypoints"`
	InfraSpecs           map[string]*ResourceBlueprint `json:"infra" yaml:"infra"`
}

func PlatformFromId

func PlatformFromId(fs afero.Fs, platformId string, repositories ...PlatformRepository) (*PlatformSpec, error)

func PlatformSpecFromFile

func PlatformSpecFromFile(fs afero.Fs, filePath string) (*PlatformSpec, error)

func PlatformSpecFromReader

func PlatformSpecFromReader(reader io.Reader) (*PlatformSpec, error)

func (PlatformSpec) GetLibraries

func (p PlatformSpec) GetLibraries() map[string]*Library

func (PlatformSpec) GetLibrary

func (p PlatformSpec) GetLibrary(name string) (*Library, error)

func (PlatformSpec) GetResourceBlueprint

func (p PlatformSpec) GetResourceBlueprint(intentType string, intentSubType string) (*ResourceBlueprint, error)

func (PlatformSpec) GetResourceBlueprintsForType

func (p PlatformSpec) GetResourceBlueprintsForType(typ string) (map[string]*ResourceBlueprint, error)

func (PlatformSpec) GetServiceBlueprint

func (p PlatformSpec) GetServiceBlueprint(intentSubType string) (*ServiceBlueprint, error)

type Plugin

type Plugin struct {
	Library Library `json:"library" yaml:"library"`
	Name    string  `json:"name" yaml:"name"`
}

type PluginInput

type PluginInput struct {
	Description string `json:"description" yaml:"description"`
	Type        string `json:"default" yaml:"default"`
	Nullable    bool   `json:"nullable" yaml:"nullable"`
	Required    bool   `json:"required" yaml:"required"`
}

type PluginManifest

type PluginManifest struct {
	Name       string                  `json:"name" yaml:"name"`
	Icon       string                  `json:"icon" yaml:"icon"`
	Deployment DeploymentModule        `json:"deployment" yaml:"deployment"`
	Type       string                  `json:"type" yaml:"type"`
	Runtime    *RuntimeModule          `json:"runtime,omitempty" yaml:"runtime,omitempty"`
	Inputs     map[string]PluginInput  `json:"inputs" yaml:"inputs"`
	Outputs    map[string]PluginOutput `json:"outputs" yaml:"outputs"`
}

type PluginOutput

type PluginOutput struct {
	Description string `json:"description" yaml:"description"`
}

type PluginRepository

type PluginRepository interface {
	GetResourcePlugin(team, libname, version, name string) (*ResourcePluginManifest, error)
	GetIdentityPlugin(team, libname, version, name string) (*IdentityPluginManifest, error)
}

type ResourceBlueprint

type ResourceBlueprint struct {
	PluginId   string                 `json:"plugin" yaml:"plugin"`
	Properties map[string]interface{} `json:"properties" yaml:"properties"`
	DependsOn  []string               `json:"depends_on" yaml:"depends_on,omitempty"`
	Variables  map[string]Variable    `json:"variables" yaml:"variables,omitempty"`
}

func (*ResourceBlueprint) ResolvePlugin

func (r *ResourceBlueprint) ResolvePlugin(platform *PlatformSpec) (*Plugin, error)

type ResourcePluginManifest

type ResourcePluginManifest struct {
	PluginManifest     `json:",inline" yaml:",inline"`
	RequiredIdentities []string `json:"required_identities" yaml:"required_identities"`
	Capabilities       []string `json:"capabilities" yaml:"capabilities"`
}

type RuntimeModule

type RuntimeModule struct {
	GoModule string `json:"go_module" yaml:"go_module"`
}

type ServiceBlueprint

type ServiceBlueprint struct {
	*ResourceBlueprint   `json:",inline" yaml:",inline"`
	*IdentitiesBlueprint `json:",inline" yaml:",inline"`
}

type SpecReference

type SpecReference struct {
	Source string
	Path   []string
}

func SpecReferenceFromToken

func SpecReferenceFromToken(token string) (*SpecReference, error)

type SugaOutputs

type SugaOutputs struct {
	Id *string `json:"id"`
}

type SugaServiceOutputs

type SugaServiceOutputs struct {
	SugaOutputs  `json:",inline"`
	HttpEndpoint *string `json:"http_endpoint"`
}

type SugaServiceSchedule

type SugaServiceSchedule struct {
	CronExpression *string `json:"cron_expression"`
	Path           *string `json:"path"`
}

type SugaServiceVariables

type SugaServiceVariables struct {
	SugaVariables `json:",inline"`
	ImageId       *string                         `json:"image_id"`
	Env           interface{}                     `json:"env"`
	Identities    *map[string]interface{}         `json:"identities"`
	Schedules     *map[string]SugaServiceSchedule `json:"schedules,omitempty"`
	StackId       *string                         `json:"stack_id"`
}

type SugaVariables

type SugaVariables struct {
	Name *string `json:"name"`
}

type TerraformDeployment

type TerraformDeployment struct {
	// contains filtered or unexported fields
}

func NewTerraformDeployment

func NewTerraformDeployment(engine *TerraformEngine, stackName string) *TerraformDeployment

func (*TerraformDeployment) Synth

func (td *TerraformDeployment) Synth()

type TerraformEngine

type TerraformEngine struct {
	// contains filtered or unexported fields
}

func New

func New(platformSpec *PlatformSpec, opts ...terraformEngineOption) *TerraformEngine

func NewFromFile

func NewFromFile(platformFile io.Reader, opts ...terraformEngineOption) *TerraformEngine

func (*TerraformEngine) Apply

func (e *TerraformEngine) Apply(appSpec *app_spec_schema.Application) (result string, err error)

Apply the engine to the target environment

func (*TerraformEngine) GetPluginManifestsForType

func (e *TerraformEngine) GetPluginManifestsForType(typ string) (map[string]*ResourcePluginManifest, error)

type Variable

type Variable struct {
	Type        string      `json:"type" yaml:"type"`
	Description string      `json:"description" yaml:"description"`
	Default     interface{} `json:"default" yaml:"default"`
	Nullable    bool        `json:"nullable" yaml:"nullable"`
}

Jump to

Keyboard shortcuts

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