Class: TerraspacePluginAws::Interfaces::Decorator::AwsSecurityGroup

Inherits:
Base
  • Object
show all
Defined in:
lib/terraspace_plugin_aws/interfaces/decorator/aws_security_group.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from TerraspacePluginAws::Interfaces::Decorator::Base

Instance Method Details

#callObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/terraspace_plugin_aws/interfaces/decorator/aws_security_group.rb', line 3

def call
  ingress = @props[:ingress]
  return @props unless ingress

  @props[:ingress] = [ingress] if ingress.is_a?(Hash)

  # expect Array
  ingress_array!
  @props
end

#ingress_array!Object

json format requires sending all props see: github.com/terraform-providers/terraform-provider-aws/issues/8786



16
17
18
19
20
21
22
23
24
25
# File 'lib/terraspace_plugin_aws/interfaces/decorator/aws_security_group.rb', line 16

def ingress_array!
  @props[:ingress].map! do |i|
    i[:cidr_blocks] ||= nil
    i[:ipv6_cidr_blocks] ||= nil
    i[:prefix_list_ids] ||= nil
    i[:security_groups] ||= nil
    i[:self] ||= nil
    i
  end
end