forked from cloudposse/terraform-aws-eks-node-group
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for remote access and lifecycle issues (cloudposse#30)
- Loading branch information
Showing
7 changed files
with
85 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# https://docs.aws.amazon.com/eks/latest/APIReference/API_RemoteAccessConfig.html | ||
|
||
resource "aws_security_group" "remote_access" { | ||
count = local.need_remote_access_sg ? 1 : 0 | ||
name = format("%v%v%v", module.label.id, module.label.delimiter, "remoteAccess") | ||
description = "Allow SSH access to all nodes in the nodeGroup" | ||
vpc_id = data.aws_eks_cluster.this[0].vpc_config[0].vpc_id | ||
tags = module.label.tags | ||
} | ||
|
||
resource "aws_security_group_rule" "remote_access_public_ssh" { | ||
count = local.need_remote_access_sg && length(var.source_security_group_ids) == 0 ? 1 : 0 | ||
description = "Allow SSH access to nodes from anywhere" | ||
type = "ingress" | ||
protocol = "tcp" | ||
from_port = 22 | ||
to_port = 22 | ||
cidr_blocks = ["0.0.0.0/0"] | ||
|
||
security_group_id = join("", aws_security_group.remote_access.*.id) | ||
} | ||
|
||
resource "aws_security_group_rule" "remote_access_source_sgs_ssh" { | ||
for_each = local.need_remote_access_sg ? toset(var.source_security_group_ids) : [] | ||
description = "Allow SSH access to nodes from security group" | ||
type = "ingress" | ||
protocol = "tcp" | ||
from_port = 22 | ||
to_port = 22 | ||
|
||
security_group_id = aws_security_group.remote_access[0].id | ||
source_security_group_id = each.value | ||
} |
This file contains 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
This file contains 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