mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(controltower): accept the landing zone id as landingZoneIdentifier (#7298)
The AWS Terraform provider stores the landing zone id (the last ARN segment) and sends it on read, update and delete. Floci only matched the full ARN, so every apply failed after a successful create. Closes #7295
This commit is contained in:
1 parent
b65755da3a
commit
7f4f2377c0
3 files changed
+55
-3
No files matched your search
+17
@@ -72,6 +72,23 @@ class ControlTowerControllerIntegrationTest {
|
||||
.body("operationIdentifier", containsString("-"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLandingZoneAcceptsLandingZoneIdLikeTheTerraformProvider() {
|
||||
String authorization = auth("000000000250", EAST);
|
||||
String arn = listLandingZonesArn(authorization);
|
||||
String id = arn.substring(arn.lastIndexOf('/') + 1);
|
||||
|
||||
given()
|
||||
.contentType("application/json")
|
||||
.header("Authorization", authorization)
|
||||
.body("{\"landingZoneIdentifier\":\"" + id + "\"}")
|
||||
.when()
|
||||
.post("/get-landingzone")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("landingZone.arn", equalTo(arn));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLandingZoneReturnsEveryFieldLzaNonNullAsserts() {
|
||||
String authorization = auth("000000000202", EAST);
|
||||
|
||||
+26
@@ -157,6 +157,32 @@ class ControlTowerServiceTest {
|
||||
assertEquals(404, unknown.getHttpStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLandingZoneAcceptsLandingZoneIdAsIdentifier() throws Exception {
|
||||
LandingZone landingZone = service.getLandingZone(ACCOUNT, REGION,
|
||||
objectMapper.readTree("{\"landingZoneIdentifier\":\"FLOCISEEDEDLZ1\"}"));
|
||||
|
||||
assertEquals(SEEDED_ARN, landingZone.getArn());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLandingZoneRejectsUnknownLandingZoneId() {
|
||||
AwsException unknown = assertThrows(AwsException.class,
|
||||
() -> service.getLandingZone(ACCOUNT, REGION,
|
||||
objectMapper.readTree("{\"landingZoneIdentifier\":\"other\"}")));
|
||||
assertEquals("ResourceNotFoundException", unknown.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteLandingZoneAcceptsLandingZoneIdAsIdentifier() throws Exception {
|
||||
service.getOrSeedLandingZone(ACCOUNT, REGION);
|
||||
|
||||
String opId = service.deleteLandingZone(ACCOUNT, REGION,
|
||||
objectMapper.readTree("{\"landingZoneIdentifier\":\"FLOCISEEDEDLZ1\"}"));
|
||||
|
||||
assertEquals("DELETE", service.getOperationType(ACCOUNT, REGION, opId));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLandingZoneReturnsSeededLandingZoneForMatchingIdentifier() throws Exception {
|
||||
LandingZone landingZone = service.getLandingZone(ACCOUNT, REGION,
|
||||
|
||||
Reference in new issue
Block a user