lib/terraforming/resource/eip.rb in terraforming-0.13.1 vs lib/terraforming/resource/eip.rb in terraforming-0.13.2
- old
+ new
@@ -22,22 +22,22 @@
def tfstate
eips.inject({}) do |resources, addr|
attributes = {
"association_id" => addr.association_id,
"domain" => addr.domain,
- "id" => addr.allocation_id,
+ "id" => vpc?(addr) ? addr.allocation_id : addr.public_ip,
"instance" => addr.instance_id,
"network_interface" => addr.network_interface_id,
"private_ip" => addr.private_ip_address,
"public_ip" => addr.public_ip,
"vpc" => vpc?(addr).to_s,
}
attributes.delete_if { |_k, v| v.nil? }
resources["aws_eip.#{module_name_of(addr)}"] = {
"type" => "aws_eip",
"primary" => {
- "id" => addr.allocation_id,
+ "id" => vpc?(addr) ? addr.allocation_id : addr.public_ip,
"attributes" => attributes
}
}
resources
@@ -53,10 +53,14 @@
def vpc?(addr)
addr.domain.eql?("vpc")
end
def module_name_of(addr)
- normalize_module_name(addr.allocation_id)
+ if vpc?(addr)
+ normalize_module_name(addr.allocation_id)
+ else
+ normalize_module_name(addr.public_ip)
+ end
end
end
end
end