providers/aws: read properly finds the Self
This commit is contained in:
parent
dbc890e401
commit
3b2272c69f
|
@ -272,8 +272,18 @@ func resourceAwsSecurityGroupRead(d *schema.ResourceData, meta interface{}) erro
|
|||
n["cidr_blocks"] = perm.SourceIPs
|
||||
}
|
||||
|
||||
var groups []string
|
||||
if len(perm.SourceGroups) > 0 {
|
||||
n["security_groups"] = flattenSecurityGroups(perm.SourceGroups)
|
||||
groups = flattenSecurityGroups(perm.SourceGroups)
|
||||
}
|
||||
for i, id := range groups {
|
||||
if id == d.Id() {
|
||||
groups[i], groups = groups[len(groups)-1], groups[:len(groups)-1]
|
||||
n["self"] = true
|
||||
}
|
||||
}
|
||||
if len(groups) > 0 {
|
||||
n["security_groups"] = groups
|
||||
}
|
||||
|
||||
ingressRules[i] = n
|
||||
|
|
Loading…
Reference in New Issue