Bastion::Inbound = ssh from source company-ip-range ( for example, 172.0.0.0/24)
Bastion::Outbound = ssh to destination SG-Private (private instances allowed)
Private::Inbound = ssh from Source Bastion-SG
Private::Outbound = HTTP to Destination NAT-SG
resource "aws_security_group" "bastion_sg" {
name = "bastion_sg"
description = "SG for Bastion Host"
vpc_id = "${aws_vpc.Test.id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["172.0.0.0/24"]
}
egress {
from_to = 22
to_port = 22
protocol = "tcp"
security_groups = ["${aws_security_group.private_sg.id}"]
}
tags {
Name = "Bastion-SG"
Environment = "${var.vpc_name}"
}
}
resource "aws_security_group" "private_sg" {
name = "private_sg"
description = "SG for Private Subnets"
vpc_id = "${aws_vpc.Test.id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
security_groups = ["${aws_security_group.bastion_sg.id}"]
}
egress {
from_to = 80
to_port = 80
protocol = "tcp"
security_groups = ["${aws_security_group.nat_sg.id}"]
}
egress {
from_to = 443
to_port = 443
protocol = "tcp"
security_groups = ["${aws_security_group.nat_sg.id}"]
}
tags {
Name = "Private-SG"
Environment = "${var.vpc_name}"
}
}
* Cycle: module.test.aws_security_group.nat_sg, module.test.aws_security_group.bastion_sg, module.test.aws_security_group.private_sg
The ingress
block supports:
cidr_blocks
- (Optional) List of CIDR blocks.security_groups
- (Optional) List of security group Group Names if using EC2-Classic, or Group IDs if using a VPC.
- In aws, source refers either to a cidr_block or a security_group. In terraform, should I replace the idea of source of incoming traffic with one of the above (that is cidr_blocks or security_groups)?
cidr_blocks
- (Optional) List of CIDR blocks. Cannot be specified with source_security_group_id
security_group_id
- (Required) The security group to apply this rule to.source_security_group_id
- (Optional) The security group id to allow access to/from, depending on the type
. Cannot be specified with cidr_blocks
.--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/f42ff6db-c21c-4eeb-a0f3-34efe1d43f36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Terraform v0.10.7
* Cycle: module.test.aws_security_group.nat_sg, module.test.aws_security_group.bastion_sg, module.test.aws_security_group.private_sg