Class: CFM::TwoAzOnePublicSubnetAndPrivateSubnetVpc

Inherits:
Vpc
  • Object
show all
Defined in:
lib/etude_for_aws/cfm/vpc/two_az_one_public_subnet_and_private_subnet_vpc.rb

Constant Summary

Constants inherited from Vpc

Vpc::TYPE

Instance Attribute Summary

Attributes inherited from Vpc

#config

Instance Method Summary collapse

Methods inherited from Vpc

#create, #destroy, #get_vpc_id

Methods included from EC2::VpcInterface

#get_vpc_id

Constructor Details

#initializeTwoAzOnePublicSubnetAndPrivateSubnetVpc

Returns a new instance of TwoAzOnePublicSubnetAndPrivateSubnetVpc.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/etude_for_aws/cfm/vpc/two_az_one_public_subnet_and_private_subnet_vpc.rb', line 3

def initialize
  super
  template_file = @config.get_template_file(CFM::Vpc::TYPE.fetch(6))
  file = get_template_full_path(template_file)
  @config.template = File.read(file)
  @config.parameters = [
      {
          parameter_key: "AZ1",
          parameter_value: @config.azs[0],
          use_previous_value: false,
      },
      {
          parameter_key: "AZ2",
          parameter_value: @config.azs[1],
          use_previous_value: false,
      },
  ]
end

Instance Method Details

#get_subnet_info(logical_resource_id, az) ⇒ Object



22
23
24
25
26
27
# File 'lib/etude_for_aws/cfm/vpc/two_az_one_public_subnet_and_private_subnet_vpc.rb', line 22

def get_subnet_info(logical_resource_id,az)
  info = {}
  info[:subnet_id] = @cfm.describe_stack_resource({stack_name: @config.stack_name, logical_resource_id: logical_resource_id}).stack_resource_detail.physical_resource_id
  info[:az] = az
  info
end

#get_subnet_infosObject



29
30
31
32
33
34
# File 'lib/etude_for_aws/cfm/vpc/two_az_one_public_subnet_and_private_subnet_vpc.rb', line 29

def get_subnet_infos
  infos = []
  infos << get_subnet_info('PublicSubnet1a',@config.azs[0])
  infos << get_subnet_info('PrivateSubnet1c',@config.azs[1])
  infos
end