Sha256: 931cf4deab665c65f3b92b418e6707bcf3d01b8139a1dde7c1382411879b170a
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
module Terraforming::Resource class SecurityGroup include Terraforming::Util 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 end def initialize(client) @client = client end def tf apply_template(@client, "tf/security_group") end def tfstate resources = security_groups.inject({}) do |result, security_group| attributes = { "description" => security_group.description, "egress.#" => security_group.ip_permissions_egress.length.to_s, "id" => security_group.group_id, "ingress.#" => security_group.ip_permissions.length.to_s, "name" => security_group.group_name, "owner_id" => security_group.owner_id, "vpc_id" => security_group.vpc_id || "", } result["aws_security_group.#{module_name_of(security_group)}"] = { "type" => "aws_security_group", "primary" => { "id" => security_group.group_id, "attributes" => attributes } } result end generate_tfstate(resources) end private def module_name_of(security_group) normalize_module_name(security_group.group_name) end def security_groups @client.describe_security_groups.security_groups end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
terraforming-0.0.1 | lib/terraforming/resource/security_group.rb |