lib/terraforming/resource/ec2.rb in terraforming-0.0.5 vs lib/terraforming/resource/ec2.rb in terraforming-0.1.0
- old
+ new
@@ -1,27 +1,27 @@
module Terraforming
module Resource
class EC2
include Terraforming::Util
- def self.tf(client = Aws::EC2::Client.new)
+ def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
- def self.tfstate(client = Aws::EC2::Client.new)
- self.new(client).tfstate
+ def self.tfstate(client: Aws::EC2::Client.new, tfstate_base: nil)
+ self.new(client).tfstate(tfstate_base)
end
def initialize(client)
@client = client
end
def tf
apply_template(@client, "tf/ec2")
end
- def tfstate
+ def tfstate(tfstate_base)
resources = instances.inject({}) do |result, instance|
attributes = {
"ami"=> instance.image_id,
"associate_public_ip_address"=> "true",
"availability_zone"=> instance.placement.availability_zone,
@@ -52,10 +52,10 @@
}
result
end
- generate_tfstate(resources)
+ generate_tfstate(resources, tfstate_base)
end
private
def instances