Class: Convection::Model::Template::Resource::Route53RecordSet

Inherits:
Convection::Model::Template::Resource show all
Defined in:
lib/convection/model/template/resource/aws_route53_recordset.rb

Overview

AWS::EC2::Instance

Constant Summary collapse

TF_ASSUMED_RESOURCE_NAME =
'aws_elastic_load_balancing_load_balancer'.freeze
TF_ACTUAL_RESOURCE_NAME =
'aws_elb'.freeze

Instance Attribute Summary

Attributes inherited from Convection::Model::Template::Resource

#exist, #name, #parent, #properties, #resource_attributes, #template

Instance Method Summary collapse

Methods inherited from Convection::Model::Template::Resource

#as_attribute, attach_method, #deletion_policy, #depends_on, #initialize, properties, property, #property, #reference, #render, type, #type, #with_output

Methods included from Mixin::Conditional

#condition, #render_condition

Methods included from DSL::Template::Resource

#_terraform_module_dir_to_flag, #_terraform_module_flag_to_dir, attach_resource, attach_resource_collection, resource_collection_dsl_methods, resource_dsl_methods

Methods included from DSL::Helpers

#camel_case, included, method_name, #screaming_snake_case, #snake_case

Methods included from DSL::IntrinsicFunctions

#base64, #find_in_map, #fn_and, #fn_equals, #fn_if, #fn_import_value, #fn_not, #fn_or, #fn_ref, #fn_sub, #get_att, #get_azs, included, #join, mixers, #select

Constructor Details

This class inherits a constructor from Convection::Model::Template::Resource

Instance Method Details

#alias_target(tgt = nil, &block) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 32

def alias_target(tgt = nil, &block)
  if tgt
    # Maintain backwards compatability
    alias_tgt tgt
  else
    # Add new resource_property functionality
    a = ResourceProperty::Route53AliasTarget.new(self)
    a.instance_exec(&block) if block
    properties['AliasTarget'].set(a)
  end
end

#alias_tgtObject #alias_tgt(value) ⇒ Object

Overloads:

  • #alias_tgtObject

    Returns the value of the ‘AliasTarget’ CloudFormation property.

  • #alias_tgt(value) ⇒ Object

    Sets the ‘AliasTarget’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘AliasTarget’ CloudFormation property to.



15
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 15

property :alias_tgt, 'AliasTarget'

#commentObject #comment(value) ⇒ Object

Overloads:

  • #commentObject

    Returns the value of the ‘Comment’ CloudFormation property.

  • #comment(value) ⇒ Object

    Sets the ‘Comment’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Comment’ CloudFormation property to.



16
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 16

property :comment, 'Comment'

#failoverObject #failover(value) ⇒ Object

Overloads:

  • #failoverObject

    Returns the value of the ‘Failover’ CloudFormation property.

  • #failover(value) ⇒ Object

    Sets the ‘Failover’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Failover’ CloudFormation property to.



17
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 17

property :failover, 'Failover'

#geo_locObject #geo_loc(value) ⇒ Object

Overloads:

  • #geo_locObject

    Returns the value of the ‘GeoLocation’ CloudFormation property.

  • #geo_loc(value) ⇒ Object

    Sets the ‘GeoLocation’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘GeoLocation’ CloudFormation property to.



18
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 18

property :geo_loc, 'GeoLocation'

#geo_location(geo = nil, &block) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 44

def geo_location(geo = nil, &block)
  if geo
    # Maintain backwards compatability
    geo_loc geo
  else
    # Add new resource_property functionality
    g = ResourceProperty::Route53GeoLocation.new(self)
    g.instance_exec(&block) if block
    properties['GeoLocation'].set(g)
  end
end

#health_check_idObject #health_check_id(value) ⇒ Object

Overloads:

  • #health_check_idObject

    Returns the value of the ‘HealthCheckId’ CloudFormation property.

  • #health_check_id(value) ⇒ Object

    Sets the ‘HealthCheckId’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘HealthCheckId’ CloudFormation property to.



19
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 19

property :health_check_id, 'HealthCheckId'

#hosted_zone_idObject #hosted_zone_id(value) ⇒ Object Also known as: zone

Overloads:

  • #hosted_zone_idObject

    Returns the value of the ‘HostedZoneId’ CloudFormation property.

  • #hosted_zone_id(value) ⇒ Object

    Sets the ‘HostedZoneId’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘HostedZoneId’ CloudFormation property to.



20
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 20

property :hosted_zone_id, 'HostedZoneId'

#hosted_zone_nameObject #hosted_zone_name(value) ⇒ Object Also known as: zone_name

Overloads:

  • #hosted_zone_nameObject

    Returns the value of the ‘HostedZoneName’ CloudFormation property.

  • #hosted_zone_name(value) ⇒ Object

    Sets the ‘HostedZoneName’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘HostedZoneName’ CloudFormation property to.



22
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 22

property :hosted_zone_name, 'HostedZoneName'

#recordObject #record(value) ⇒ Object

Overloads:

  • #recordObject

    Returns the value of the ‘ResourceRecords’ CloudFormation property.

  • #record(value) ⇒ Object

    Sets the ‘ResourceRecords’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘ResourceRecords’ CloudFormation property to.



26
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 26

property :record, 'ResourceRecords', :array

#record_nameObject #record_name(value) ⇒ Object

Overloads:

  • #record_nameObject

    Returns the value of the ‘Name’ CloudFormation property.

  • #record_name(value) ⇒ Object

    Sets the ‘Name’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Name’ CloudFormation property to.



24
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 24

property :record_name, 'Name'

#record_typeObject #record_type(value) ⇒ Object

Overloads:

  • #record_typeObject

    Returns the value of the ‘Type’ CloudFormation property.

  • #record_type(value) ⇒ Object

    Sets the ‘Type’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Type’ CloudFormation property to.



29
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 29

property :record_type, 'Type'

#regionObject #region(value) ⇒ Object

Overloads:

  • #regionObject

    Returns the value of the ‘Region’ CloudFormation property.

  • #region(value) ⇒ Object

    Sets the ‘Region’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Region’ CloudFormation property to.



25
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 25

property :region, 'Region'

#set_identifierObject #set_identifier(value) ⇒ Object

Overloads:

  • #set_identifierObject

    Returns the value of the ‘SetIdentifier’ CloudFormation property.

  • #set_identifier(value) ⇒ Object

    Sets the ‘SetIdentifier’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘SetIdentifier’ CloudFormation property to.



27
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 27

property :set_identifier, 'SetIdentifier'

#terraform_import_commands(module_path: 'root') ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 56

def terraform_import_commands(module_path: 'root')
  commands = []
  commands << '# Import the Route53 record:'
  tf_set_id = "_#{set_identifier}" if set_identifier
  prefix = "#{module_path}." unless module_path == 'root'
  tf_record_name = record_name.sub(/\.$/, '')
  commands << "terraform import #{prefix}aws_route53_record.#{name.underscore} #{hosted_zone_id}_#{tf_record_name}_#{record_type}#{tf_set_id}"

  commands.map { |cmd| cmd.gsub(stack.region, stack._original_region).gsub(stack.cloud, stack._original_cloud) }
end

#to_hcl_jsonObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 67

def to_hcl_json(*)
  tf_record_attrs = {
    zone_id: hosted_zone_id,
    name: record_name,
    type: record_type,
    ttl: ttl,
    records: tf_records,
    set_identifier: set_identifier
  }
  tf_record_attrs.reject! { |_k, v| v.nil? }

  tf_record = {
    aws_route53_record: {
      name.underscore => tf_record_attrs
    }
  }

  { resource: [tf_record] }.to_json
end

#ttlObject #ttl(value) ⇒ Object

Overloads:

  • #ttlObject

    Returns the value of the ‘TTL’ CloudFormation property.

  • #ttl(value) ⇒ Object

    Sets the ‘TTL’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘TTL’ CloudFormation property to.



28
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 28

property :ttl, 'TTL'

#weightObject #weight(value) ⇒ Object

Overloads:

  • #weightObject

    Returns the value of the ‘Weight’ CloudFormation property.

  • #weight(value) ⇒ Object

    Sets the ‘Weight’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Weight’ CloudFormation property to.



30
# File 'lib/convection/model/template/resource/aws_route53_recordset.rb', line 30

property :weight, 'Weight'