Class: Formatron::CloudFormation::Template::VPC::Subnet::NAT

Inherits:
Object
  • Object
show all
Defined in:
lib/formatron/cloud_formation/template/vpc/subnet/nat.rb

Overview

generates CloudFormation Chef Server resources

Constant Summary collapse

ROUTE_TABLE_PREFIX =
'routeTable'
ROUTE_PREFIX =
'route'

Instance Method Summary collapse

Constructor Details

#initialize(nat:, key_pair:, administrator_name:, administrator_password:, availability_zone:, subnet_guid:, hosted_zone_name:, vpc_guid:, vpc_cidr:, kms_key:, private_hosted_zone_id:, public_hosted_zone_id:, bucket:, name:, target:) ⇒ NAT

rubocop:disable Metrics/MethodLength rubocop:disable Metrics/ParameterLists



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/formatron/cloud_formation/template/vpc/subnet/nat.rb', line 15

def initialize(
  nat:,
  key_pair:,
  administrator_name:,
  administrator_password:,
  availability_zone:,
  subnet_guid:,
  hosted_zone_name:,
  vpc_guid:,
  vpc_cidr:,
  kms_key:,
  private_hosted_zone_id:,
  public_hosted_zone_id:,
  bucket:,
  name:,
  target:
)
  @nat = nat
  guid = @nat.guid
  @vpc_cidr = vpc_cidr
  @vpc_id = "#{VPC::VPC_PREFIX}#{vpc_guid}"
  @instance_id = "#{Instance::INSTANCE_PREFIX}#{guid}"
  @route_table_id = "#{ROUTE_TABLE_PREFIX}#{guid}"
  @route_id = "#{ROUTE_PREFIX}#{guid}"
  _set_os
  _add_setup_script
  _set_source_dest_check
  @instance = Instance.new(
    instance: nat,
    key_pair: key_pair,
    administrator_name: administrator_name,
    administrator_password: administrator_password,
    availability_zone: availability_zone,
    subnet_guid: subnet_guid,
    hosted_zone_name: hosted_zone_name,
    vpc_guid: vpc_guid,
    vpc_cidr: @vpc_cidr,
    kms_key: kms_key,
    private_hosted_zone_id: private_hosted_zone_id,
    public_hosted_zone_id: public_hosted_zone_id,
    bucket: bucket,
    name: name,
    target: target
  )
end

Instance Method Details

#merge(resources:, outputs:) ⇒ Object



80
81
82
83
# File 'lib/formatron/cloud_formation/template/vpc/subnet/nat.rb', line 80

def merge(resources:, outputs:)
  _add_route_table resources
  @instance.merge resources: resources, outputs: outputs
end