Class: CFM::OneAzOnePublicSubnetVpc

Inherits:
Vpc
  • Object
show all
Defined in:
lib/etude_for_aws/cfm/vpc/one_az_one_public_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

#initializeOneAzOnePublicSubnetVpc

Returns a new instance of OneAzOnePublicSubnetVpc.



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/etude_for_aws/cfm/vpc/one_az_one_public_subnet_vpc.rb', line 3

def initialize
  super
  template_file = @config.get_template_file(CFM::Vpc::TYPE.fetch(1))
  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,
      },
  ]
end

Instance Method Details

#get_subnet_info(logical_resource_id) ⇒ Object



17
18
19
20
21
22
# File 'lib/etude_for_aws/cfm/vpc/one_az_one_public_subnet_vpc.rb', line 17

def get_subnet_info(logical_resource_id)
  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] = @config.azs[0]
  info
end

#get_subnet_infosObject



24
25
26
27
28
# File 'lib/etude_for_aws/cfm/vpc/one_az_one_public_subnet_vpc.rb', line 24

def get_subnet_infos
  infos = []
  infos << get_subnet_info('Subnet')
  infos
end