feat(iam): seed standard EKS cluster and node group managed policies (#1216)

EKS cluster creation and managed node groups attach a set of AWS managed
policies that floci did not seed, so GetPolicy / AttachRolePolicy failed with
NoSuchEntity (e.g. AmazonEKSClusterPolicy, AmazonEKSVPCResourceController),
breaking the terraform-aws-modules/eks module and the EKS console flow.

Add the standard set to the seeded catalog (all path "/"):
AmazonEKSClusterPolicy, AmazonEKSServicePolicy, AmazonEKSVPCResourceController,
AmazonEKSWorkerNodePolicy, AmazonEKS_CNI_Policy. Documented in the IAM managed
policy catalog (docs/services/iam.md).

Closes #1092
This commit is contained in:
Ben Younes authored and GitHub committed 2026-06-07 00:41:48 -05:00
1 parent ec8e1cf85e
commit e3c19461db
3 files changed
+44

No files matched your search

@@ -6,6 +6,8 @@ import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
@@ -149,6 +151,32 @@ class IamIntegrationTest {
equalTo("arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"));
}
// The standard EKS managed policies the EKS console/SDK and the
// terraform-aws-modules/eks module attach to cluster and node roles (#1092).
@ParameterizedTest
@Order(6)
@ValueSource(strings = {
"arn:aws:iam::aws:policy/AmazonEKSClusterPolicy",
"arn:aws:iam::aws:policy/AmazonEKSServicePolicy",
"arn:aws:iam::aws:policy/AmazonEKSVPCResourceController",
"arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy",
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy",
})
void getEksManagedPolicy(String arn) {
String expectedName = arn.substring(arn.lastIndexOf('/') + 1);
given()
.formParam("Action", "GetPolicy")
.formParam("PolicyArn", arn)
.header("Authorization",
"AWS4-HMAC-SHA256 Credential=test/20260227/us-east-1/iam/aws4_request")
.when()
.post("/")
.then()
.statusCode(200)
.body("GetPolicyResponse.GetPolicyResult.Policy.PolicyName", equalTo(expectedName))
.body("GetPolicyResponse.GetPolicyResult.Policy.Arn", equalTo(arn));
}
@Test
@Order(35)
void attachManagedPolicyToRole() {