Skip to content

Commit a0f0f2d

Browse files
authored
feat(infra): grant classic-ELB sweep permissions to UAT AWS role (#1617) (#1622)
Signed-off-by: Nathan Hensley <nhensley@nvidia.com>
1 parent 82c752e commit a0f0f2d

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

infra/uat-aws-account/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ terraform apply -var="aws_region=us-west-2"
4444

4545
- **EKS**: `eks:*` — full cluster, node group, addon lifecycle
4646
- **EC2**: `ec2:*` — VPC, subnets, security groups, instances
47+
- **Elastic Load Balancing**: `DescribeLoadBalancers`, `DescribeTags`, `DeleteLoadBalancer` — teardown sweep of the classic ELB the in-tree cloud provider creates for `Service type=LoadBalancer` outside Terraform state ([#1617](https://github.com/NVIDIA/aicr/issues/1617))
4748
- **IAM**: scoped to `aicr-*` roles/profiles/policies; allows EKS service-linked roles under `aws-service-role/*`
4849
- **Auto Scaling, CloudFormation**: `*` (for EKS-managed stacks and node groups)
4950
- **STS**: `GetCallerIdentity`, `AssumeRole`, `TagSession`

infra/uat-aws-account/federation.tf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ data "aws_iam_policy_document" "github_actions_permissions" {
135135
]
136136
}
137137

138+
# Read SSO-provisioned roles so the EKS actuator can resolve the SSO admin
139+
# role and wire it into cluster access (EKS access entries / aws-auth). This
140+
# was previously applied out-of-band to the live policy; codified here so the
141+
# Terraform source is authoritative and `terraform apply` does not revert it.
142+
statement {
143+
sid = "IAMReadSSORoles"
144+
effect = "Allow"
145+
actions = [
146+
"iam:GetRole",
147+
]
148+
resources = [
149+
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/aws-reserved/sso.amazonaws.com/*",
150+
]
151+
}
152+
138153
# Deny privilege escalation paths
139154
statement {
140155
sid = "DenyPrivilegeEscalation"
@@ -181,6 +196,27 @@ data "aws_iam_policy_document" "github_actions_permissions" {
181196
resources = ["*"]
182197
}
183198

199+
# Elastic Load Balancing (classic ELB / ELBv1) — the in-tree Kubernetes AWS
200+
# cloud provider provisions a classic ELB + k8s-elb-* SG for a Service
201+
# type=LoadBalancer OUTSIDE Terraform state. The UAT teardown sweep
202+
# (.github/scripts/uat-aws-cleanup-lb.sh, #1617) reaps that orphaned ELB
203+
# before DeleteVpc so the VPC does not leak. Terraform never manages these, so
204+
# neither the EKS nor the EC2 statement above grants ELB access. Only the
205+
# three actions the sweep calls (aws elb describe-load-balancers /
206+
# describe-tags / delete-load-balancer) are granted. DescribeLoadBalancers and
207+
# DescribeTags do not support resource-level scoping, so this statement uses
208+
# "*" like the EC2/EKS statements above.
209+
statement {
210+
sid = "ELBTeardownSweepPermissions"
211+
effect = "Allow"
212+
actions = [
213+
"elasticloadbalancing:DescribeLoadBalancers",
214+
"elasticloadbalancing:DescribeTags",
215+
"elasticloadbalancing:DeleteLoadBalancer",
216+
]
217+
resources = ["*"]
218+
}
219+
184220
# CloudFormation permissions (EKS uses CloudFormation)
185221
statement {
186222
sid = "CloudFormationPermissions"

0 commit comments

Comments
 (0)