Documentation
¶
Index ¶
- Constants
- type AmiCopy
- type AmiCopyImpl
- func (ac *AmiCopyImpl) Copy(ui *packer.Ui) (err error)
- func (ac *AmiCopyImpl) Input() *ec2.CopyImageInput
- func (ac *AmiCopyImpl) Output() *ec2.CopyImageOutput
- func (ac *AmiCopyImpl) SetInput(input *ec2.CopyImageInput)
- func (ac *AmiCopyImpl) SetTargetAccountID(id string)
- func (ac *AmiCopyImpl) Tag(ui *packer.Ui) (err error)
- func (ac *AmiCopyImpl) TargetAccountID() string
- type AmiManifest
- type Config
- type FlatConfig
- type FlatTarget
- type PostProcessor
- type Target
Constants ¶
const BuilderId = "packer.post-processor.ami-copy"
BuilderId is the ID of this post processor. nolint: golint
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmiCopy ¶ added in v1.9.13
type AmiCopy interface {
Copy(ui *packer.Ui) error
Input() *ec2.CopyImageInput
Output() *ec2.CopyImageOutput
Tag(ui *packer.Ui) error
TargetAccountID() string
}
AmiCopy defines the interface to copy images
type AmiCopyImpl ¶ added in v1.9.13
type AmiCopyImpl struct {
EC2 *ec2.EC2
SourceImage *ec2.Image
EnsureAvailable bool
KeepArtifact bool
TagsOnly bool
Tags map[string]string
// contains filtered or unexported fields
}
AmiCopyImpl holds data and methods related to copying an image.
func (*AmiCopyImpl) Copy ¶ added in v1.9.13
func (ac *AmiCopyImpl) Copy(ui *packer.Ui) (err error)
Copy will perform an EC2 copy based on the `Input` field. It will also call Tag to copy the source tags, if any.
func (*AmiCopyImpl) Input ¶ added in v1.9.13
func (ac *AmiCopyImpl) Input() *ec2.CopyImageInput
func (*AmiCopyImpl) Output ¶ added in v1.9.13
func (ac *AmiCopyImpl) Output() *ec2.CopyImageOutput
func (*AmiCopyImpl) SetInput ¶ added in v1.9.13
func (ac *AmiCopyImpl) SetInput(input *ec2.CopyImageInput)
func (*AmiCopyImpl) SetTargetAccountID ¶ added in v1.9.13
func (ac *AmiCopyImpl) SetTargetAccountID(id string)
func (*AmiCopyImpl) Tag ¶ added in v1.9.13
func (ac *AmiCopyImpl) Tag(ui *packer.Ui) (err error)
Tag will copy tags from the source image to the target (if any).
func (*AmiCopyImpl) TargetAccountID ¶ added in v1.9.13
func (ac *AmiCopyImpl) TargetAccountID() string
type AmiManifest ¶ added in v1.9.13
type AmiManifest struct {
AccountID string `json:"account_id"`
Region string `json:"region"`
ImageID string `json:"image_id"`
}
AmiManifest holds the data about the resulting copied image
type Config ¶
type Config struct {
common.PackerConfig `mapstructure:",squash"`
awscommon.AccessConfig `mapstructure:",squash"`
awscommon.AMIConfig `mapstructure:",squash"`
// Variables specific to this post-processor
RoleName string `mapstructure:"role_name"`
CopyConcurrency int `mapstructure:"copy_concurrency"`
EnsureAvailable bool `mapstructure:"ensure_available"`
KeepArtifact string `mapstructure:"keep_artifact"`
ManifestOutput string `mapstructure:"manifest_output"`
TagsOnly bool `mapstructure:"tags_only"`
Targets []Target `mapstructure:"targets"`
// contains filtered or unexported fields
}
Config is the post-processor configuration with interpolation supported. See https://www.packer.io/docs/builders/amazon.html for details.
type FlatConfig ¶
type FlatConfig struct {
PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"`
PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"`
PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"`
PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"`
PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"`
PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"`
PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"`
PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"`
AccessKey *string `mapstructure:"access_key" required:"true" cty:"access_key" hcl:"access_key"`
AssumeRole *common.FlatAssumeRoleConfig `mapstructure:"assume_role" required:"false" cty:"assume_role" hcl:"assume_role"`
CustomEndpointEc2 *string `mapstructure:"custom_endpoint_ec2" required:"false" cty:"custom_endpoint_ec2" hcl:"custom_endpoint_ec2"`
CredsFilename *string `mapstructure:"shared_credentials_file" required:"false" cty:"shared_credentials_file" hcl:"shared_credentials_file"`
DecodeAuthZMessages *bool `` /* 133-byte string literal not displayed */
InsecureSkipTLSVerify *bool `mapstructure:"insecure_skip_tls_verify" required:"false" cty:"insecure_skip_tls_verify" hcl:"insecure_skip_tls_verify"`
MaxRetries *int `mapstructure:"max_retries" required:"false" cty:"max_retries" hcl:"max_retries"`
MFACode *string `mapstructure:"mfa_code" required:"false" cty:"mfa_code" hcl:"mfa_code"`
ProfileName *string `mapstructure:"profile" required:"false" cty:"profile" hcl:"profile"`
RawRegion *string `mapstructure:"region" required:"true" cty:"region" hcl:"region"`
SecretKey *string `mapstructure:"secret_key" required:"true" cty:"secret_key" hcl:"secret_key"`
SkipMetadataApiCheck *bool `mapstructure:"skip_metadata_api_check" cty:"skip_metadata_api_check" hcl:"skip_metadata_api_check"`
SkipCredsValidation *bool `mapstructure:"skip_credential_validation" cty:"skip_credential_validation" hcl:"skip_credential_validation"`
Token *string `mapstructure:"token" required:"false" cty:"token" hcl:"token"`
VaultAWSEngine *common.FlatVaultAWSEngineOptions `mapstructure:"vault_aws_engine" required:"false" cty:"vault_aws_engine" hcl:"vault_aws_engine"`
PollingConfig *common.FlatAWSPollingConfig `mapstructure:"aws_polling" required:"false" cty:"aws_polling" hcl:"aws_polling"`
AMIName *string `mapstructure:"ami_name" required:"true" cty:"ami_name" hcl:"ami_name"`
AMIDescription *string `mapstructure:"ami_description" required:"false" cty:"ami_description" hcl:"ami_description"`
AMIVirtType *string `mapstructure:"ami_virtualization_type" required:"false" cty:"ami_virtualization_type" hcl:"ami_virtualization_type"`
AMIUsers []string `mapstructure:"ami_users" required:"false" cty:"ami_users" hcl:"ami_users"`
AMIGroups []string `mapstructure:"ami_groups" required:"false" cty:"ami_groups" hcl:"ami_groups"`
AMIOrgArns []string `mapstructure:"ami_org_arns" required:"false" cty:"ami_org_arns" hcl:"ami_org_arns"`
AMIOuArns []string `mapstructure:"ami_ou_arns" required:"false" cty:"ami_ou_arns" hcl:"ami_ou_arns"`
AMIProductCodes []string `mapstructure:"ami_product_codes" required:"false" cty:"ami_product_codes" hcl:"ami_product_codes"`
AMIRegions []string `mapstructure:"ami_regions" required:"false" cty:"ami_regions" hcl:"ami_regions"`
AMISkipRegionValidation *bool `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation" hcl:"skip_region_validation"`
AMITags map[string]string `mapstructure:"tags" required:"false" cty:"tags" hcl:"tags"`
AMITag []config.FlatKeyValue `mapstructure:"tag" required:"false" cty:"tag" hcl:"tag"`
AMIENASupport *bool `mapstructure:"ena_support" required:"false" cty:"ena_support" hcl:"ena_support"`
AMISriovNetSupport *bool `mapstructure:"sriov_support" required:"false" cty:"sriov_support" hcl:"sriov_support"`
AMIForceDeregister *bool `mapstructure:"force_deregister" required:"false" cty:"force_deregister" hcl:"force_deregister"`
AMIForceDeleteSnapshot *bool `mapstructure:"force_delete_snapshot" required:"false" cty:"force_delete_snapshot" hcl:"force_delete_snapshot"`
AMIEncryptBootVolume *bool `mapstructure:"encrypt_boot" required:"false" cty:"encrypt_boot" hcl:"encrypt_boot"`
AMIKmsKeyId *string `mapstructure:"kms_key_id" required:"false" cty:"kms_key_id" hcl:"kms_key_id"`
AMIRegionKMSKeyIDs map[string]string `mapstructure:"region_kms_key_ids" required:"false" cty:"region_kms_key_ids" hcl:"region_kms_key_ids"`
AMISkipBuildRegion *bool `mapstructure:"skip_save_build_region" cty:"skip_save_build_region" hcl:"skip_save_build_region"`
AMISnapshotCopyDurationMinutes *int64 `` /* 136-byte string literal not displayed */
AMIIMDSSupport *string `mapstructure:"imds_support" required:"false" cty:"imds_support" hcl:"imds_support"`
DeprecationTime *string `mapstructure:"deprecate_at" cty:"deprecate_at" hcl:"deprecate_at"`
SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false" cty:"snapshot_tags" hcl:"snapshot_tags"`
SnapshotTag []config.FlatKeyValue `mapstructure:"snapshot_tag" required:"false" cty:"snapshot_tag" hcl:"snapshot_tag"`
SnapshotUsers []string `mapstructure:"snapshot_users" required:"false" cty:"snapshot_users" hcl:"snapshot_users"`
SnapshotGroups []string `mapstructure:"snapshot_groups" required:"false" cty:"snapshot_groups" hcl:"snapshot_groups"`
DeregistrationProtection *common.FlatDeregistrationProtectionOptions `mapstructure:"deregistration_protection" required:"false" cty:"deregistration_protection" hcl:"deregistration_protection"`
RoleName *string `mapstructure:"role_name" cty:"role_name" hcl:"role_name"`
CopyConcurrency *int `mapstructure:"copy_concurrency" cty:"copy_concurrency" hcl:"copy_concurrency"`
EnsureAvailable *bool `mapstructure:"ensure_available" cty:"ensure_available" hcl:"ensure_available"`
KeepArtifact *string `mapstructure:"keep_artifact" cty:"keep_artifact" hcl:"keep_artifact"`
ManifestOutput *string `mapstructure:"manifest_output" cty:"manifest_output" hcl:"manifest_output"`
TagsOnly *bool `mapstructure:"tags_only" cty:"tags_only" hcl:"tags_only"`
Targets []FlatTarget `mapstructure:"targets" cty:"targets" hcl:"targets"`
}
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatTarget ¶ added in v1.9.12
type FlatTarget struct {
AccessKey *string `mapstructure:"access_key" required:"true" cty:"access_key" hcl:"access_key"`
AssumeRole *common.FlatAssumeRoleConfig `mapstructure:"assume_role" required:"false" cty:"assume_role" hcl:"assume_role"`
CustomEndpointEc2 *string `mapstructure:"custom_endpoint_ec2" required:"false" cty:"custom_endpoint_ec2" hcl:"custom_endpoint_ec2"`
CredsFilename *string `mapstructure:"shared_credentials_file" required:"false" cty:"shared_credentials_file" hcl:"shared_credentials_file"`
DecodeAuthZMessages *bool `` /* 133-byte string literal not displayed */
InsecureSkipTLSVerify *bool `mapstructure:"insecure_skip_tls_verify" required:"false" cty:"insecure_skip_tls_verify" hcl:"insecure_skip_tls_verify"`
MaxRetries *int `mapstructure:"max_retries" required:"false" cty:"max_retries" hcl:"max_retries"`
MFACode *string `mapstructure:"mfa_code" required:"false" cty:"mfa_code" hcl:"mfa_code"`
ProfileName *string `mapstructure:"profile" required:"false" cty:"profile" hcl:"profile"`
RawRegion *string `mapstructure:"region" required:"true" cty:"region" hcl:"region"`
SecretKey *string `mapstructure:"secret_key" required:"true" cty:"secret_key" hcl:"secret_key"`
SkipMetadataApiCheck *bool `mapstructure:"skip_metadata_api_check" cty:"skip_metadata_api_check" hcl:"skip_metadata_api_check"`
SkipCredsValidation *bool `mapstructure:"skip_credential_validation" cty:"skip_credential_validation" hcl:"skip_credential_validation"`
Token *string `mapstructure:"token" required:"false" cty:"token" hcl:"token"`
VaultAWSEngine *common.FlatVaultAWSEngineOptions `mapstructure:"vault_aws_engine" required:"false" cty:"vault_aws_engine" hcl:"vault_aws_engine"`
PollingConfig *common.FlatAWSPollingConfig `mapstructure:"aws_polling" required:"false" cty:"aws_polling" hcl:"aws_polling"`
Name *string `mapstructure:"name" cty:"name" hcl:"name"`
}
FlatTarget is an auto-generated flat version of Target. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type PostProcessor ¶
type PostProcessor struct {
// contains filtered or unexported fields
}
PostProcessor implements Packer's PostProcessor interface.
func (*PostProcessor) ConfigSpec ¶
func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec
func (*PostProcessor) Configure ¶
func (p *PostProcessor) Configure(raws ...interface{}) error
Configure interpolates and validates requisite vars for the PostProcessor.
func (*PostProcessor) PostProcess ¶
func (p *PostProcessor) PostProcess( ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error)
PostProcess will copy the source AMI to each of the target accounts as designated by the mandatory `ami_users` variable. It will optionally encrypt the copied AMIs (`encrypt_boot`) with `kms_key_id` if set, or the default EBS KMS key if unset. Tags will be copied with the image.
Copies are executed concurrently. This concurrency is unlimited unless controller by `copy_concurrency`.
type Target ¶ added in v1.9.12
type Target struct {
awscommon.AccessConfig `mapstructure:",squash"`
Name string `mapstructure:"name"`
}
func (*Target) FlatMapstructure ¶ added in v1.9.12
FlatMapstructure returns a new FlatTarget. FlatTarget is an auto-generated flat version of Target. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.