lib/terraforming/resource/subnet.rb in terraforming-0.1.3 vs lib/terraforming/resource/subnet.rb in terraforming-0.1.4

- old
+ new

@@ -5,43 +5,41 @@ def self.tf(client: Aws::EC2::Client.new) self.new(client).tf end - def self.tfstate(client: Aws::EC2::Client.new, tfstate_base: nil) - self.new(client).tfstate(tfstate_base) + def self.tfstate(client: Aws::EC2::Client.new) + self.new(client).tfstate end def initialize(client) @client = client end def tf apply_template(@client, "tf/subnet") end - def tfstate(tfstate_base) - resources = subnets.inject({}) do |result, subnet| + def tfstate + subnets.inject({}) do |resources, subnet| attributes = { "availability_zone" => subnet.availability_zone, "cidr_block" => subnet.cidr_block, "id" => subnet.subnet_id, "map_public_ip_on_launch" => subnet.map_public_ip_on_launch.to_s, "tags.#" => subnet.tags.length.to_s, "vpc_id" => subnet.vpc_id, } - result["aws_subnet.#{module_name_of(subnet)}"] = { + resources["aws_subnet.#{module_name_of(subnet)}"] = { "type" => "aws_subnet", "primary" => { "id" => subnet.subnet_id, "attributes" => attributes } } - result + resources end - - generate_tfstate(resources, tfstate_base) end private def subnets