lib/terraforming/resource/vpc.rb in terraforming-0.1.3 vs lib/terraforming/resource/vpc.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/vpc")
end
- def tfstate(tfstate_base)
- resources = vpcs.inject({}) do |result, vpc|
+ def tfstate
+ vpcs.inject({}) do |resources, vpc|
attributes = {
"cidr_block" => vpc.cidr_block,
"enable_dns_hostnames" => enable_dns_hostnames?(vpc).to_s,
"enable_dns_support" => enable_dns_support?(vpc).to_s,
"id" => vpc.vpc_id,
"instance_tenancy" => vpc.instance_tenancy,
"tags.#" => vpc.tags.length.to_s,
}
- result["aws_vpc.#{module_name_of(vpc)}"] = {
+ resources["aws_vpc.#{module_name_of(vpc)}"] = {
"type" => "aws_vpc",
"primary" => {
"id" => vpc.vpc_id,
"attributes" => attributes
}
}
- result
+ resources
end
-
- generate_tfstate(resources, tfstate_base)
end
private
def enable_dns_hostnames?(vpc)