Class: GeoEngineer::Resources::AwsEip

Inherits:
GeoEngineer::Resource show all
Defined in:
lib/geoengineer/resources/aws_eip.rb

Overview

Currently geo can't create EIPs - only codify existing ones It does this by requiring the '_public_ip' attribute and hard-coding the '_geo_id' to that

Constant Summary

Constants inherited from GeoEngineer::Resource

GeoEngineer::Resource::DEFAULT_PROVIDER

Constants included from HasValidations

HasValidations::MAX_POLICY_LENGTH

Instance Attribute Summary

Attributes inherited from GeoEngineer::Resource

#environment, #id, #project, #template, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GeoEngineer::Resource

_deep_symbolize_keys, #_find_remote_resource, _ignore_remote_resource?, #_json_file, #_normalize_json, _resources_to_ignore, build, #build_individual_remote_resource, clear_remote_resource_cache, #depends_on, #duplicate, #duplicate_resource, #fetch_provider, fetch_remote_resources, #find_remote_as_individual?, #for_resource, #in_project, #initialize, #matched_remote_resource, #merge_parent_tags, #merge_tags, #new?, #remote_resource, #remote_resource_params, #reset, #setup_tags_if_needed, #short_id, #short_name, #short_type, #terraform_name, #to_id_or_ref, #to_ref, #to_s, #to_terraform, #to_terraform_json, #to_terraform_state, type_from_class_name, #validate_has_tag, #validate_required_subresource, #validate_subresource_required_attributes

Methods included from HasLifecycle

#execute_lifecycle, included

Methods included from HasValidations

#errors, included, #validate_at_least_one_present, #validate_cidr_block, #validate_only_one_present, #validate_policy_length, #validate_required_attributes

Methods included from HasSubResources

#assign_block, #attribute_missing, #delete_all_subresources, #delete_subresources_where, #subresources

Methods included from HasAttributes

#[], #[]=, #assign_attribute, #assign_block, #attribute_missing, #attribute_procs, #attributes, #delete, #eager_load_attributes, #method_missing, #reset_attributes, #retrieve_attribute, #terraform_attribute_ref, #terraform_attributes, #timeout

Constructor Details

This class inherits a constructor from GeoEngineer::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HasAttributes

Class Method Details

._fetch_remote_resources(provider) ⇒ Object


36
37
38
39
40
41
42
# File 'lib/geoengineer/resources/aws_eip.rb', line 36

def self._fetch_remote_resources(provider)
  AwsClients.ec2(provider).describe_addresses['addresses'].map(&:to_h).map do |address|
    address[:_terraform_id] = address[:allocation_id]
    address[:_geo_id] = address[:public_ip]
    address
  end
end

Instance Method Details

#support_tags?Boolean


27
28
29
# File 'lib/geoengineer/resources/aws_eip.rb', line 27

def support_tags?
  false
end

#validate_instance_or_network_interfaceObject

Can't associate both an instance and a network interface with an elastic IP


17
18
19
20
21
22
23
24
25
# File 'lib/geoengineer/resources/aws_eip.rb', line 17

def validate_instance_or_network_interface
  errors = []

  unless instance.nil? || network_interface.nil?
    errors << "Must associate and Elastic IP with either and EC2 instance or a network interface"
  end

  errors
end

#vpcObject

Always create within a VPC


32
33
34
# File 'lib/geoengineer/resources/aws_eip.rb', line 32

def vpc
  true
end