exoscale

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: ISC Imports: 24 Imported by: 0

README

Packer Post-Processor plugin: Exoscale Import

Actions Status

The exoscale-import post-processor plugin can be used with HashiCorp Packer to take an image artifact from the QEMU, Artifice, or File builders and import it to Exoscale as a new Compute instance template.

Installation

Using pre-built releases

You can find pre-built releases of the plugin here. Once you have downloaded the latest archive corresponding to your target OS, uncompress it to retrieve the packer-post-processor-exoscale-import plugin binary file.

From Sources

If you prefer to build the plugin from sources, clone the GitHub repository locally and run the command make build from the root of the sources directory. Upon successful compilation, a packer-post-processor-exoscale-import plugin binary file can be found in the /bin directory.

Configuration

To use the plugin with Packer, please follow the official documentation on [installing a Packer plugin][packerplugindoc].

Here is the list of supported configuration parameters by the post-processor.

Required parameters

There are some configuration options available for the post-processor.

Required:

  • api_key (string) - The API key used to communicate with Exoscale services. This may also be set using the EXOSCALE_API_KEY environmental variable.

  • api_secret (string) - The API secret used to communicate with Exoscale services. This may also be set using the EXOSCALE_API_SECRET environmental variable.

  • image_bucket (string) - The name of the bucket in which to upload the template image to SOS. The bucket must exist when the post-processor is run.

  • template_zone (string) - The Exoscale zone in which to register the template.

  • template_name (string) - The name to be used for registering the template.

Optional parameters
  • api_endpoint (string) - The API endpoint used to communicate with the Exoscale API. Defaults to https://api.exoscale.com/v1.

  • sos_endpoint (string) - The endpoint used to communicate with SOS. Defaults to https://sos-<template_zone>.exo.io.

  • template_description (string) - The description of the registered template.

  • template_username (string) - An optional username to be used to log into Compute instances using this template.

  • template_disable_password (boolean) - Whether the registered template should disable Compute instance password reset. Defaults to false.

  • template_disable_sshkey (boolean) - Whether the registered template should disable SSH key installation during Compute instance creation. Defaults to false.

  • skip_clean (boolean) - Whether we should skip removing the image file uploaded to SOS after the import process has completed. "true" means that we should leave it in the bucket, "false" means deleting it. Defaults to false.

Usage

Here is an example of a simple Packer configuration using the exoscale-import post-processor to upload a disk image artifact generated by the qemu builder:

{
  "variables": {
    "exoscale_api_key": "{{env `EXOSCALE_API_KEY`}}",
    "exoscale_api_secret": "{{env `EXOSCALE_API_SECRET`}}"
  },
  "builders": [{
    "type": "qemu",
    ...
  }],
  "post-processors": [{
    "type": "exoscale-import",
    "api_key": "{{user `exoscale_api_key`}}",
    "api_secret": "{{user `exoscale_api_secret`}}",
    "image_bucket": "my-templates",
    "template_name": "hello",
    "template_description": "My hello application",
    "template_username": "ubuntu"
  }]
}

Documentation

Overview

Code generated by "mapstructure-to-hcl2 -type Config"; DO NOT EDIT.

Index

Constants

View Source
const BuilderId = "packer.post-processor.exoscale-import"

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

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

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (a *Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`
	SkipClean           bool `mapstructure:"skip_clean"`

	SOSEndpoint             string `mapstructure:"sos_endpoint"`
	APIEndpoint             string `mapstructure:"api_endpoint"`
	APIKey                  string `mapstructure:"api_key"`
	APISecret               string `mapstructure:"api_secret"`
	ImageBucket             string `mapstructure:"image_bucket"`
	TemplateZone            string `mapstructure:"template_zone"`
	TemplateName            string `mapstructure:"template_name"`
	TemplateDescription     string `mapstructure:"template_description"`
	TemplateUsername        string `mapstructure:"template_username"`
	TemplateDisablePassword bool   `mapstructure:"template_disable_password"`
	TemplateDisableSSHKey   bool   `mapstructure:"template_disable_sshkey"`
}

func NewConfig

func NewConfig(raws ...interface{}) (*Config, error)

func (*Config) FlatMapstructure

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type FlatConfig

type FlatConfig struct {
	PackerBuildName         *string           `mapstructure:"packer_build_name" cty:"packer_build_name"`
	PackerBuilderType       *string           `mapstructure:"packer_builder_type" cty:"packer_builder_type"`
	PackerDebug             *bool             `mapstructure:"packer_debug" cty:"packer_debug"`
	PackerForce             *bool             `mapstructure:"packer_force" cty:"packer_force"`
	PackerOnError           *string           `mapstructure:"packer_on_error" cty:"packer_on_error"`
	PackerUserVars          map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables"`
	PackerSensitiveVars     []string          `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"`
	SkipClean               *bool             `mapstructure:"skip_clean" cty:"skip_clean"`
	SOSEndpoint             *string           `mapstructure:"sos_endpoint" cty:"sos_endpoint"`
	APIEndpoint             *string           `mapstructure:"api_endpoint" cty:"api_endpoint"`
	APIKey                  *string           `mapstructure:"api_key" cty:"api_key"`
	APISecret               *string           `mapstructure:"api_secret" cty:"api_secret"`
	ImageBucket             *string           `mapstructure:"image_bucket" cty:"image_bucket"`
	TemplateZone            *string           `mapstructure:"template_zone" cty:"template_zone"`
	TemplateName            *string           `mapstructure:"template_name" cty:"template_name"`
	TemplateDescription     *string           `mapstructure:"template_description" cty:"template_description"`
	TemplateUsername        *string           `mapstructure:"template_username" cty:"template_username"`
	TemplateDisablePassword *bool             `mapstructure:"template_disable_password" cty:"template_disable_password"`
	TemplateDisableSSHKey   *bool             `mapstructure:"template_disable_sshkey" cty:"template_disable_sshkey"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

type PostProcessor

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

func (*PostProcessor) ConfigSpec

func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec

ConfigSpec returns HCL object spec

func (*PostProcessor) Configure

func (p *PostProcessor) Configure(raws ...interface{}) error

func (*PostProcessor) PostProcess

func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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