terraform

package
v0.0.0-...-2996f3e Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 21 Imported by: 1

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 MockPlatformRepository

type MockPlatformRepository struct {
}

func NewMockPlatformRepository

func NewMockPlatformRepository() *MockPlatformRepository

func (MockPlatformRepository) GetPlatform

func (MockPlatformRepository) GetPlatform(name string) (*PlatformSpec, error)

type NitricOutputs

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

type NitricServiceOutputs

type NitricServiceOutputs struct {
	NitricOutputs `json:",inline"`
	HttpEndpoint  *string `json:"http_endpoint"`
}

type NitricServiceSchedule

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

type NitricServiceVariables

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

type NitricTerraformPluginRepository

type NitricTerraformPluginRepository struct {
}

func NewNitricTerraformPluginRepository

func NewNitricTerraformPluginRepository() *NitricTerraformPluginRepository

func (*NitricTerraformPluginRepository) GetIdentityPlugin

func (r *NitricTerraformPluginRepository) GetIdentityPlugin(name string) (*IdentityPluginManifest, error)

func (*NitricTerraformPluginRepository) GetResourcePlugin

func (r *NitricTerraformPluginRepository) GetResourcePlugin(name string) (*ResourcePluginManifest, error)

type NitricVariables

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

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"`
	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 {
	// var/infra/etc
	Source string
	// simple key for var or path for infra e.g. vpc.arn
	Path []string
}

func SpecReferenceFromToken

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

type TerraformDeployment

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

func NewTerraformDeployment

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

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) (string, 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"`
}

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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