Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save quanghiem/5cbba4cb4028b864703d62b44e183def to your computer and use it in GitHub Desktop.
Save quanghiem/5cbba4cb4028b864703d62b44e183def to your computer and use it in GitHub Desktop.
data "aws_instance" "xxx" {
filter {
name = "tag:Name"
values = ["xxx"]
}
}
resource "aws_security_group" "xxx" {
name = "xxx"
vpc_id = "${var.vpc_id}"
}
resource "aws_security_group_rule" "add_ons" {
type = "ingress"
from_port = "80"
to_port = "80"
protocol = "tcp"
cidr_blocks = [
"${data.aws_instance.public_ip}/32"
]
security_group_id = "${aws.aws_security_group.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment