Created
July 27, 2022 03:37
-
-
Save lioneltchami/85b14a6798ab42f0761d32c8b10a968c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_security_group" "kubernetes" { | |
| vpc_id = "${aws_vpc.kubernetes.id}" | |
| name = "kubernetes" | |
| # Allow all outbound | |
| egress { | |
| from_port = 0 | |
| to_port = 0 | |
| protocol = "-1" | |
| cidr_blocks = ["0.0.0.0/0"] | |
| } | |
| # Allow all internal | |
| ingress { | |
| from_port = 0 | |
| to_port = 0 | |
| protocol = "-1" | |
| self = true | |
| } | |
| # Allow all traffic from the API ELB | |
| ingress { | |
| from_port = 0 | |
| to_port = 0 | |
| protocol = "-1" | |
| security_groups = ["${aws_security_group.kubernetes_api.id}"] | |
| } | |
| # Allow all traffic from control host IP | |
| ingress { | |
| from_port = 0 | |
| to_port = 0 | |
| protocol = "-1" | |
| cidr_blocks = ["${var.control_cidr}"] | |
| } | |
| } | |
| resource "aws_security_group" "kubernetes_api" { | |
| vpc_id = "${aws_vpc.kubernetes.id}" | |
| name = "kubernetes-api" | |
| # Allow inbound traffic to the port used by Kubernetes API HTTPS | |
| ingress { | |
| from_port = 6443 | |
| to_port = 6443 | |
| protocol = "TCP" | |
| cidr_blocks = ["${var.control_cidr}"] | |
| } | |
| # Allow all outbound traffic | |
| egress { | |
| from_port = 0 | |
| to_port = 0 | |
| protocol = "-1" | |
| cidr_blocks = ["0.0.0.0/0"] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment