The documentation says "you cannot use a Security Group with in-line rules in conjunction with any Security Group Rule resources. Doing so will cause a conflict of rule settings and will overwrite rules."
The following seems to work for me, the console shows that the nat-server-sg has both cidr block rules inbound rules and the security group based inbound ssh rule.
resource "aws_security_group" "access-nat-server-sg" {
...
inline cidr based rules to allow ingress from private subnets and egress to internet
...
}
resource "aws_security_group" "access-bastion-server-sg" {
...
inline cidr rules to allow ingress from external places
...
}resource "aws_security_group_rule" "ssh-bastion-to-nat" {
type = "ingress"
from_port = 22
to_port = 22
protocol = "tcp"
}
Given the statement from the doco outlined above, I had expected that the security group would have or the other set of rules, but not both.
Is the documentation just out of date? Happy to raise an issue if so.
Or is something going to break further down the line when I start churning security groups around?
Or is it just that it happens to work in this version, but the doco is there to stop me using it because it may stop working in future versions?
Using AWS provider with TF 0.6.8.