Sha256: 7cd17c53a446615160d2216005e8f01a3475ee9a71bb5bc5f1f9c5f6b8e57446

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

module CFM
  class TwoAzTwoPublicSubnetAndPrivateSubnetVpc < Vpc
    def initialize
      super
      template_file = @config.get_template_file(CFM::Vpc::TYPE.fetch(7))
      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


    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

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

  class TwoAzTwoPublicSubnetAndPrivateSubnetVpcStub < VpcStub
    def get_subnet_info
      info = {}
      info[:subnet_id] = 'DUMMY_SUBNET_ID'
      info[:az] = 'DUMMY_AZ'
      info
    end

    def get_subnet_infos
      infos = []
      infos << get_subnet_info
      infos << get_subnet_info
      infos
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
etude_for_aws-0.7.10 lib/etude_for_aws/cfm/vpc/two_az_two_public_subnet_and_private_subnet_vpc.rb
etude_for_aws-0.7.9 lib/etude_for_aws/cfm/vpc/two_az_two_public_subnet_and_private_subnet_vpc.rb
etude_for_aws-0.7.8 lib/etude_for_aws/cfm/vpc/two_az_two_public_subnet_and_private_subnet_vpc.rb
etude_for_aws-0.7.7 lib/etude_for_aws/cfm/vpc/two_az_two_public_subnet_and_private_subnet_vpc.rb
etude_for_aws-0.7.6 lib/etude_for_aws/cfm/vpc/two_az_two_public_subnet_and_private_subnet_vpc.rb