func (a Provider) ResourceInOutNodes(id, rs string, cfgs map[string]map[string]interface{}) ([]string, []string, []string) {
	var ins, outs, nodes []string
	cfg := cfgs[id]
	if rs == "aws_security_group" {
		ingress, inok := cfg["ingress"]
		if inok {
			for _, in := range ingress.([]interface{}) {
				min := in.(map[string]interface{})
				if sgs, ok := min["security_groups"].([]interface{}); ok {
					for _, sg := range sgs {
						ins = append(ins, sg.(string))
					}
				}
				if cidrs, ok := min["cidr_blocks"].([]interface{}); ok {
					for _, ci := range cidrs {
						sci := ci.(string)
						if sci == "0.0.0.0/0" {
							nodes = append(nodes, fmt.Sprintf("im_out.%v/%v->%v", min["protocol"], min["from_port"], min["to_port"]))
						}
					}
				}
			}
		}
		egress, egok := cfg["egress"]
		if egok {
			for _, eg := range egress.([]interface{}) {
				if sgs, ok := eg.(map[string]interface{})["security_groups"].([]interface{}); ok {
					for _, sg := range sgs {
						outs = append(outs, sg.(string))
					}
				}
			}
		}
	} else if rs == "aws_security_group_rule" {
		in, ok := cfg["source_security_group_id"]
		if ok && in != nil {
			ins = append(ins, in.(string))
		}
		out, ok := cfg["security_group_id"]
		if ok && in != nil {
			outs = append(outs, out.(string))
		}
	}
	return ins, outs, nodes
}
ResourceInOutNodes returns the In, Out and Nodes of the rs based on the cfg
package aws
import (
	"fmt"
	"github.com/cycloidio/inframap/errcode"
	"github.com/cycloidio/inframap/provider"
	tfdocAWS "github.com/cycloidio/tfdocs/providers/aws"
	"github.com/cycloidio/tfdocs/resource"
)
type Provider struct {
	provider.NopProvider
}
var (
	usedAttributes = []string{
		"id",
		"egress",
		"ingress",
		"source_security_group_id",
		"security_group_id",
	}
)
func (a Provider) Type() provider.Type { return provider.AWS }
func (a Provider) IsNode(resource string) bool {
	_, ok := nodeTypes[resource]
	return ok
}
func (a Provider) IsEdge(resource string) bool {
	_, ok := edgeTypes[resource]
	return ok
}
func (a Provider) Resource(resource string) (*resource.Resource, error) {
	r, err := tfdocAWS.GetResource(resource)
	if err != nil {
		return nil, fmt.Errorf("could not get resource %q: %w", resource, errcode.ErrProviderNotFoundResource)
	}
	return r, nil
}
func (a Provider) DataSource(resource string) (*resource.Resource, error) {
	r, err := tfdocAWS.GetDataSource(resource)
	if err != nil {
		return nil, fmt.Errorf("could not get resource %q: %w", resource, errcode.ErrProviderNotFoundDataSource)
	}
	return r, nil
}