Documentation
¶
Index ¶
- Variables
- func Apply(ctx context.Context, input cmdtools.CommandInput) error
- func Destroy(ctx context.Context, input cmdtools.CommandInput) error
- func Exec(ctx context.Context, input cmdtools.CommandInput) error
- func Import(ctx context.Context, input cmdtools.CommandInput) error
- func Output(ctx context.Context, input cmdtools.CommandInput) error
- func Plan(ctx context.Context, input cmdtools.CommandInput) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ApplyCmd = &cli.Command{ Name: "apply", Usage: "Creates or updates infrastructure based off the apps and resources defined in app.json", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "silent", Aliases: []string{"s"}, Usage: "Suppress informational output (only show Terraform output)", }, &cli.BoolFlag{ Name: "refresh-only", Usage: "Sync Terraform state with actual infrastructure without making changes (uses 'terraform apply -refresh-only')", }, }, Action: cmdtools.Wrap(Apply), }
View Source
var Command = &cli.Command{ Name: "infra", Usage: "Provision and manage cloud infrastructure", Description: "Commands for planning and applying infrastructure changes defined in app.json", Commands: []*cli.Command{ PlanCmd, ApplyCmd, DestroyCmd, OutputCmd, ImportCmd, ExecCmd, }, Before: func(ctx context.Context, command *cli.Command) (context.Context, error) { _, err := infra.ParseTFEnvironment() if err != nil { return ctx, errors.Wrap(err, "must include infra variables in PATH") } return ctx, nil }, }
Command defines the infra commands for provisioning and managing cloud infrastructure based on app.json definitions.
View Source
var DestroyCmd = &cli.Command{ Name: "destroy", Usage: "Tears down infrastructure defined in app.json", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "silent", Aliases: []string{"s"}, Usage: "Suppress informational output (only show Terraform output)", }, }, Action: cmdtools.Wrap(Destroy), }
View Source
var ExecCmd = &cli.Command{ Name: "exec", Usage: "Execute arbitrary Terraform commands", Description: `Execute any Terraform command with webkit's environment and configuration. Examples: webkit infra exec -- state list webkit infra exec -- state show 'module.apps.peekaping_app.site["blog"]' webkit infra exec -- workspace list webkit infra exec -- show webkit infra exec -- validate`, ArgsUsage: "-- <terraform-command> [args...]", Action: cmdtools.Wrap(Exec), }
View Source
var ImportCmd = &cli.Command{ Name: "import", Usage: "Import existing infrastructure resources or apps into Terraform state", Description: `Import allows you to bring existing cloud resources or apps under Terraform management. This is useful when: - Migrating from manually created infrastructure - Adopting webkit for an existing project - Recovering from state loss Examples: # Import a resource (database, storage, etc.) webkit infra import --resource db --id ca9f591d-f38h-462a-a5c6-5a8a74838081 # Import an app webkit infra import --app web --id a1b2c3d4-e5f6-7890-abcd-ef1234567890 # Import a DigitalOcean project webkit infra import --project --id 12345678-abcd-1234-5678-1234567890ab`, Flags: []cli.Flag{ &cli.StringFlag{ Name: "resource", Aliases: []string{"r"}, Usage: "Name of the resource in app.json to import (mutually exclusive with --app and --project)", Required: false, }, &cli.StringFlag{ Name: "app", Aliases: []string{"a"}, Usage: "Name of the app in app.json to import (mutually exclusive with --resource and --project)", Required: false, }, &cli.BoolFlag{ Name: "project", Aliases: []string{"p"}, Usage: "Import a DigitalOcean project (mutually exclusive with --resource and --app)", Required: false, }, &cli.StringFlag{ Name: "id", Usage: "Provider-specific resource/app ID (e.g., DigitalOcean cluster ID or app ID)", Required: true, }, &cli.StringFlag{ Name: "env", Aliases: []string{"e"}, Usage: "Environment to import into (development, staging, production)", Value: env.Production.String(), }, &cli.BoolFlag{ Name: "silent", Aliases: []string{"s"}, Usage: "Suppress informational output (only show Terraform output)", }, }, Action: cmdtools.Wrap(Import), }
ImportCmd defines the command for importing existing infrastructure into Terraform state.
View Source
var OutputCmd = &cli.Command{ Name: "output", Usage: "Retrieve Terraform outputs from a specific environment", Description: "Fetches infrastructure outputs for resources provisioned by Terraform", Flags: []cli.Flag{ &cli.StringFlag{ Name: "env", Usage: "Environment to fetch outputs from (development, staging, production)", Aliases: []string{"e"}, Required: true, }, &cli.StringFlag{ Name: "resource", Usage: "Filter outputs to a specific resource name", Aliases: []string{"r"}, }, &cli.StringFlag{ Name: "app", Usage: "Filter outputs to a specific app name", Aliases: []string{"a"}, }, &cli.BoolFlag{ Name: "silent", Aliases: []string{"s"}, Usage: "Suppress informational output (only show Terraform output)", }, }, Action: cmdtools.Wrap(Output), }
View Source
var PlanCmd = &cli.Command{ Name: "plan", Usage: "Generates an executive plan from the apps and resources defined in app.json", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "silent", Aliases: []string{"s"}, Usage: "Suppress informational output (only show Terraform output)", }, &cli.BoolFlag{ Name: "refresh-only", Usage: "Show what changes would be made to state by refreshing (without planning infrastructure changes)", }, }, Action: cmdtools.Wrap(Plan), }
Functions ¶
func Exec ¶ added in v0.7.0
func Exec(ctx context.Context, input cmdtools.CommandInput) error
Exec executes arbitrary Terraform commands with webkit's environment.
func Import ¶ added in v0.0.9
func Import(ctx context.Context, input cmdtools.CommandInput) error
Import executes the import operation for the specified resource or app.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.