fix(ec2): AssociateRouteTable associationState, RouteTable association filters, DescribeTags filters (#706)

- Include <associationState> in AssociateRouteTable response so Terraform
  v6 waiters can confirm association without timing out
- Add association.route-table-association-id, association.subnet-id,
  association.gateway-id, and association.main filter support to
  DescribeRouteTables
- Apply resource-id, resource-type, key, and value filters in DescribeTags
  (previously all filters were ignored, returning every tag)
- Add RouteTableAssociation.gatewayId field for gateway-id filter support
- Add integration tests covering new filters and associationState assertion
- Add VPC networking resources to compat-terraform and compat-opentofu
  suites (IGW, subnet, route table + association, security group)
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-05-05 00:11:51 -05:00
1 parent 7900cdbcb2
commit d620c18534
6 files changed
+263 -4

No files matched your search

@@ -508,6 +508,7 @@ class Ec2IntegrationTest {
.then()
.statusCode(200)
.body("AssociateRouteTableResponse.associationId", startsWith("rtbassoc-"))
.body("AssociateRouteTableResponse.associationState.state", equalTo("associated"))
.extract().path("AssociateRouteTableResponse.associationId");
}
@@ -525,6 +526,38 @@ class Ec2IntegrationTest {
.body("DescribeRouteTablesResponse.routeTableSet.item.routeTableId", equalTo(routeTableId));
}
@Test
@Order(64)
void describeRouteTablesByAssociationId() {
given()
.formParam("Action", "DescribeRouteTables")
.formParam("Filter.1.Name", "association.route-table-association-id")
.formParam("Filter.1.Value.1", rtbAssocId)
.header("Authorization", AUTH_HEADER)
.when()
.post("/")
.then()
.statusCode(200)
.body("DescribeRouteTablesResponse.routeTableSet.item.routeTableId", equalTo(routeTableId))
.body("DescribeRouteTablesResponse.routeTableSet.item.associationSet.item[0].routeTableAssociationId",
equalTo(rtbAssocId));
}
@Test
@Order(65)
void describeRouteTablesBySubnetId() {
given()
.formParam("Action", "DescribeRouteTables")
.formParam("Filter.1.Name", "association.subnet-id")
.formParam("Filter.1.Value.1", subnetId)
.header("Authorization", AUTH_HEADER)
.when()
.post("/")
.then()
.statusCode(200)
.body("DescribeRouteTablesResponse.routeTableSet.item.routeTableId", equalTo(routeTableId));
}
// =========================================================================
// Elastic IPs
// =========================================================================
@@ -729,6 +762,52 @@ class Ec2IntegrationTest {
.body("DescribeTagsResponse.tagSet.item.value", equalTo("test-instance"));
}
@Test
@Order(92)
void describeTagsFilterByResourceId() {
given()
.formParam("Action", "DescribeTags")
.formParam("Filter.1.Name", "resource-id")
.formParam("Filter.1.Value.1", instanceId)
.header("Authorization", AUTH_HEADER)
.when()
.post("/")
.then()
.statusCode(200)
.body("DescribeTagsResponse.tagSet.item.resourceId", equalTo(instanceId))
.body("DescribeTagsResponse.tagSet.item.key", equalTo("Name"));
}
@Test
@Order(92)
void describeTagsFilterByKey() {
given()
.formParam("Action", "DescribeTags")
.formParam("Filter.1.Name", "key")
.formParam("Filter.1.Value.1", "Name")
.header("Authorization", AUTH_HEADER)
.when()
.post("/")
.then()
.statusCode(200)
.body("DescribeTagsResponse.tagSet.item.key", equalTo("Name"));
}
@Test
@Order(92)
void describeTagsFilterByKeyNoMatch() {
given()
.formParam("Action", "DescribeTags")
.formParam("Filter.1.Name", "key")
.formParam("Filter.1.Value.1", "NonExistentKey")
.header("Authorization", AUTH_HEADER)
.when()
.post("/")
.then()
.statusCode(200)
.body("DescribeTagsResponse.tagSet.item.size()", equalTo(0));
}
// =========================================================================
// Volumes
// =========================================================================