Class: Packer::Builder::Amazon

Inherits:
Packer::Builder show all
Defined in:
lib/packer/builders/amazon.rb

Direct Known Subclasses

EBS, Instance

Defined Under Namespace

Classes: EBS, Instance

Constant Summary

Constants inherited from Packer::Builder

AMAZON_EBS, AMAZON_INSTANCE, DOCKER, NULL, VALID_BUILDER_TYPES, VIRTUALBOX_ISO, VMWARE_ISO, VMWARE_VMX

Instance Attribute Summary

Attributes inherited from Packer::Builder

#communicators

Attributes inherited from DataObject

#data, #key_dependencies, #required

Instance Method Summary collapse

Methods inherited from Packer::Builder

#communicator, get_builder, #name, #ssh_bastion_host, #ssh_bastion_password, #ssh_bastion_private_key_file, #ssh_bastion_username, #ssh_disable_agent, #ssh_handshake_attempts, #ssh_host, #ssh_password, #ssh_port, #ssh_private_key_file, #ssh_pty, #ssh_timeout, #ssh_username, types, #winrm_host, #winrm_password, #winrm_port, #winrm_timeout, #winrm_username

Methods inherited from DataObject

#__add_array_of_array_of_strings, #__add_array_of_hashes, #__add_array_of_ints, #__add_array_of_strings, #__add_boolean, #__add_hash, #__add_integer, #__add_json, #__add_string, #__exclusive_key_error, #add_key_dependencies, #add_required, #deep_copy, #validate, #validate_key_dependencies, #validate_required

Constructor Details

#initializeAmazon

Returns a new instance of Amazon.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/packer/builders/amazon.rb', line 8

def initialize
  super
  self.add_required(
    'ami_name',
    'instance_type',
    'region',
    'source_ami',
    'communicator'
  )
  self.communicators = %w(none ssh winrm)
end

Instance Method Details

#access_key(key) ⇒ Object



20
21
22
# File 'lib/packer/builders/amazon.rb', line 20

def access_key(key)
  self.__add_string('access_key', key)
end

#ami_block_device_mappings(mappings) ⇒ Object



44
45
46
# File 'lib/packer/builders/amazon.rb', line 44

def ami_block_device_mappings(mappings)
  self.__add_array_of_hashes('ami_block_device_mappings', mappings)
end

#ami_description(description) ⇒ Object



48
49
50
# File 'lib/packer/builders/amazon.rb', line 48

def ami_description(description)
  self.__add_string('ami_description', description)
end

#ami_groups(groups) ⇒ Object



52
53
54
# File 'lib/packer/builders/amazon.rb', line 52

def ami_groups(groups)
  self.__add_array_of_strings('ami_groups', groups)
end

#ami_name(name) ⇒ Object



24
25
26
# File 'lib/packer/builders/amazon.rb', line 24

def ami_name(name)
  self.__add_string('ami_name', name)
end

#ami_product_codes(codes) ⇒ Object



56
57
58
# File 'lib/packer/builders/amazon.rb', line 56

def ami_product_codes(codes)
  self.__add_array_of_strings('ami_product_codes', codes)
end

#ami_regions(regions) ⇒ Object



60
61
62
# File 'lib/packer/builders/amazon.rb', line 60

def ami_regions(regions)
  self.__add_array_of_strings('ami_regions', regions)
end

#ami_users(users) ⇒ Object



64
65
66
# File 'lib/packer/builders/amazon.rb', line 64

def ami_users(users)
  self.__add_array_of_strings('ami_users', users)
end

#ami_virtualization_type(type) ⇒ Object



68
69
70
# File 'lib/packer/builders/amazon.rb', line 68

def ami_virtualization_type(type)
  self.__add_string('ami_virtualization_type', type)
end

#associate_public_ip_address(bool) ⇒ Object



72
73
74
# File 'lib/packer/builders/amazon.rb', line 72

def associate_public_ip_address(bool)
  self.__add_boolean('associate_public_ip_address', bool)
end

#availability_zone(zone) ⇒ Object



76
77
78
# File 'lib/packer/builders/amazon.rb', line 76

def availability_zone(zone)
  self.__add_string('availability_zone', zone)
end

#enhanced_networking(bool) ⇒ Object



80
81
82
# File 'lib/packer/builders/amazon.rb', line 80

def enhanced_networking(bool)
  self.__add_boolean('enhanced_networking', bool)
end

#iam_instance_profile(profile) ⇒ Object



84
85
86
# File 'lib/packer/builders/amazon.rb', line 84

def iam_instance_profile(profile)
  self.__add_string('iam_instance_profile', profile)
end

#instance_type(type) ⇒ Object



28
29
30
# File 'lib/packer/builders/amazon.rb', line 28

def instance_type(type)
  self.__add_string('instance_type', type)
end

#launch_block_device_mappings(mappings) ⇒ Object



88
89
90
# File 'lib/packer/builders/amazon.rb', line 88

def launch_block_device_mappings(mappings)
  self.__add_array_of_hashes('launch_block_device_mappings', mappings)
end

#region(name) ⇒ Object



32
33
34
# File 'lib/packer/builders/amazon.rb', line 32

def region(name)
  self.__add_string('region', name)
end

#run_tags(tags) ⇒ Object



92
93
94
# File 'lib/packer/builders/amazon.rb', line 92

def run_tags(tags)
  self.__add_hash('run_tags', tags)
end

#secret_key(key) ⇒ Object



40
41
42
# File 'lib/packer/builders/amazon.rb', line 40

def secret_key(key)
  self.__add_string('secret_key', key)
end

#security_group_id(id) ⇒ Object



96
97
98
# File 'lib/packer/builders/amazon.rb', line 96

def security_group_id(id)
  self.__add_string('security_group_id', id, %w[security_group_ids])
end

#security_group_ids(ids) ⇒ Object



100
101
102
# File 'lib/packer/builders/amazon.rb', line 100

def security_group_ids(ids)
  self.__add_array_of_strings('security_group_ids', ids, %w[security_group_id])
end

#source_ami(name) ⇒ Object



36
37
38
# File 'lib/packer/builders/amazon.rb', line 36

def source_ami(name)
  self.__add_string('source_ami', name)
end

#subnet_id(id) ⇒ Object



104
105
106
# File 'lib/packer/builders/amazon.rb', line 104

def subnet_id(id)
  self.__add_string('subnet_id', id)
end

#tags(tags) ⇒ Object



108
109
110
# File 'lib/packer/builders/amazon.rb', line 108

def tags(tags)
  self.__add_hash('tags', tags)
end

#temporary_key_pair_name(name) ⇒ Object



112
113
114
# File 'lib/packer/builders/amazon.rb', line 112

def temporary_key_pair_name(name)
  self.__add_string('temporary_key_pair_name', name)
end

#user_data(data) ⇒ Object



116
117
118
# File 'lib/packer/builders/amazon.rb', line 116

def user_data(data)
  self.__add_string('user_data', data)
end

#user_data_file(file) ⇒ Object



120
121
122
# File 'lib/packer/builders/amazon.rb', line 120

def user_data_file(file)
  self.__add_string('user_data_file', file)
end

#vpc_id(id) ⇒ Object



124
125
126
# File 'lib/packer/builders/amazon.rb', line 124

def vpc_id(id)
  self.__add_string('vpc_id', id)
end