class MU::Cloud::CloudFormation::VPC::Subnet

Subnets are almost a first-class resource. So let's kinda sorta treat them like one. This should only be invoked on objects that already exists in the cloud layer.

Attributes

cfm_name[R]
cfm_template[R]
cloud_id[R]
ip_block[R]
mu_name[R]
name[R]

Public Class Methods

new(parent, config) click to toggle source

@param parent [MU::Cloud::CloudFormation::VPC]: The parent VPC of this subnet. @param config [Hash<String>]:

# File modules/mu/providers/cloudformation/vpc.rb, line 257
def initialize(parent, config)
  @parent = parent
  @config = config
  @cloud_id = config['cloud_id']
  if @parent.config['scrub_mu_isms']
    @mu_name = @config['name']
  else
    @mu_name = config['mu_name']
  end
  @name = config['name']
  @deploydata = config # This is a dummy for the sake of describe()

  @cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase("subnet", self, tags: @config['tags'], scrub_mu_isms: @parent.config['scrub_mu_isms'])
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "VpcId", { "Ref" => parent.cfm_name })
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "DependsOn", parent.cfm_name)
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "CidrBlock", config['ip_block'])
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "MapPublicIpOnLaunch", config['map_public_ips'])
  if config['availability_zone']
    MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "AvailabilityZone", config['availability_zone'])
  end
end

Public Instance Methods

private?() click to toggle source

Is this subnet privately-routable only, or public? @return [Boolean]

# File modules/mu/providers/cloudformation/vpc.rb, line 281
def private?
  (!@config['is_public'])
end