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

- old
+ new

@@ -5,24 +5,24 @@ def self.tf(client: Aws::RDS::Client.new) self.new(client).tf end - def self.tfstate(client: Aws::RDS::Client.new, tfstate_base: nil) - self.new(client).tfstate(tfstate_base) + def self.tfstate(client: Aws::RDS::Client.new) + self.new(client).tfstate end def initialize(client) @client = client end def tf apply_template(@client, "tf/rds") end - def tfstate(tfstate_base) - resources = db_instances.inject({}) do |result, instance| + def tfstate + db_instances.inject({}) do |resources, instance| attributes = { "address" => instance.endpoint.address, "allocated_storage" => instance.allocated_storage.to_s, "availability_zone" => instance.availability_zone, "backup_retention_period" => instance.backup_retention_period.to_s, @@ -46,21 +46,19 @@ "status" => instance.db_instance_status, "storage_type" => instance.storage_type, "username" => instance.master_username, "vpc_security_group_ids.#" => instance.vpc_security_groups.length.to_s, } - result["aws_db_instance.#{module_name_of(instance)}"] = { + resources["aws_db_instance.#{module_name_of(instance)}"] = { "type" => "aws_db_instance", "primary" => { "id" => instance.db_instance_identifier, "attributes" => attributes } } - result + resources end - - generate_tfstate(resources, tfstate_base) end private def db_instances