22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/terraforming/resource/route53_record.rb', line 22
def tfstate
records.inject({}) do |resources, r|
record, zone_id = r[:record], r[:zone_id]
counter = r[:counter]
record_id = record_id_of(record, zone_id)
attributes = {
"id" => record_id,
"name" => name_of(record.name.gsub(/\\052/, '*')),
"type" => record.type,
"zone_id" => zone_id,
}
attributes["alias.#"] = "1" if record.alias_target
attributes["records.#"] = record.resource_records.length.to_s unless record.resource_records.empty?
attributes["ttl"] = record.ttl.to_s if record.ttl
attributes["weight"] = record.weight ? record.weight.to_s : "-1"
attributes["region"] = record.region if record.region
if record.geo_location
attributes["continent"] = record.geo_location.continent_code if record.geo_location.continent_code
attributes["country"] = record.geo_location.country_code if record.geo_location.country_code
attributes["subdivision"] = record.geo_location.subdivision_code if record.geo_location.subdivision_code
end
attributes["set_identifier"] = record.set_identifier if record.set_identifier
resources["aws_route53_record.#{module_name_of(record, counter)}"] = {
"type" => "aws_route53_record",
"primary" => {
"id" => record_id,
"attributes" => attributes,
}
}
resources
end
end
|