providers/aws: fix order of ingress rules on security group

This commit is contained in:
Jack Pearkes 2014-07-29 12:45:57 -04:00
parent dbe6b74884
commit 6653542466
2 changed files with 8 additions and 6 deletions

View File

@ -49,8 +49,8 @@ func resource_aws_security_group_create(
// Wait for the security group to truly exist
log.Printf(
"[DEBUG] Waiting for SG (%s) to exist",
s.ID)
"[DEBUG] Waiting for Security Group (%s) to exist",
rs.ID)
stateConf := &resource.StateChangeConf{
Pending: []string{""},
Target: "exists",
@ -59,7 +59,7 @@ func resource_aws_security_group_create(
}
if _, err := stateConf.WaitForState(); err != nil {
return s, fmt.Errorf(
"Error waiting for SG (%s) to become available: %s",
"Error waiting for Security Group (%s) to become available: %s",
rs.ID, err)
}
@ -175,7 +175,9 @@ func resource_aws_security_group_update_state(
n["security_groups"] = flattenSecurityGroups(perm.SourceGroups)
}
ingressRules = append(ingressRules, n)
// Reverse the order, as Amazon sorts it the reverse of how we created
// it.
ingressRules = append([]map[string]interface{}{n}, ingressRules...)
}
toFlatten["ingress"] = ingressRules

View File

@ -262,8 +262,8 @@ resource "aws_security_group" "web" {
ingress {
protocol = "tcp"
from_port = 80
to_port = 8000
from_port = 22
to_port = 22
cidr_blocks = ["10.0.0.0/8"]
}