From 3f194c4c4fd777d78ffb153175446a7c0a50a730 Mon Sep 17 00:00:00 2001
From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
Date: Wed, 18 Nov 2026 16:00:15 -0400
Subject: [PATCH] fix(controltower): give resource-tag conditions the tags of
the landing zone or enabled control a request names (#8901)
The generated request resources give Control Tower's LandingZone and
EnabledControl types the aws:ResourceTag/ key, but no service answered
the controltower namespace's stored tags, so a condition on a landing
zone's or an enabled control's tags saw none. A new
ControlTowerStoredResourceArns answers it for the namespace, which two
services hold: a landing zone's tags are read in place under the Region
its ARN names, an enabled control's found by the ARN it records among
the Region's controls, as the tag handlers find it, both in the
request's account and matched on the whole ARN. Tag calls already give
the resource a new map; the tags fields are now volatile.
---
docs/services/iam.md | 4 +-
.../aws/core/common/StoredResourceArns.java | 7 +-
.../ControlTowerControlService.java | 14 ++++
.../controltower/ControlTowerService.java | 15 ++++
.../ControlTowerStoredResourceArns.java | 70 ++++++++++++++++
.../controltower/model/EnabledControl.java | 2 +-
.../controltower/model/LandingZone.java | 2 +-
.../ControlTowerIamIntegrationTest.java | 38 ++++++++-
.../ControlTowerStoredResourceArnsTest.java | 81 +++++++++++++++++++
9 files changed, 223 insertions(+), 10 deletions(-)
create mode 100644 src/main/java/io/floci/aws/services/controltower/ControlTowerStoredResourceArns.java
create mode 100644 src/test/java/io/floci/aws/services/controltower/ControlTowerStoredResourceArnsTest.java
diff --git a/docs/services/iam.md b/docs/services/iam.md
index 02d0350e82..d2ca2d577d 100644
--- a/docs/services/iam.md
+++ b/docs/services/iam.md
@@ -3480,8 +3480,8 @@ floci populates:
custom action types, DataSync for its agents, locations and tasks, Global Accelerator for its accelerators, listeners
and endpoint groups, EMR Serverless for its applications, job runs and sessions, EMR on EKS for its virtual clusters,
job runs, managed endpoints, job templates and security configurations, Cost Explorer for its anomaly monitors and
- subscriptions, and Security Hub for its hubs and configuration policies. Tag keys differing only in case are one
- condition key holding every value.
+ subscriptions, Security Hub for its hubs and configuration policies, and Control Tower for its landing zones and
+ enabled controls. Tag keys differing only in case are one condition key holding every value.
- EC2 resource keys such as a network interface's `ec2:Vpc`, `ec2:Subnet`, `ec2:AvailabilityZone` and
`ec2:NetworkInterfaceID`: for every action on a resource EC2 holds, the members of the resource the
key names, an ARN for a key the Service Reference types as one. `resourceKeys` in
diff --git a/src/main/java/io/floci/aws/core/common/StoredResourceArns.java b/src/main/java/io/floci/aws/core/common/StoredResourceArns.java
index 719af6a8d3..f253f32c9b 100644
--- a/src/main/java/io/floci/aws/core/common/StoredResourceArns.java
+++ b/src/main/java/io/floci/aws/core/common/StoredResourceArns.java
@@ -54,9 +54,10 @@ import java.util.Optional;
* location or a task; Global Accelerator, for the tags of an accelerator, a listener or an endpoint group; EMR
* Serverless, for the tags of an application, a job run or a session; EMR on EKS, for the tags of a virtual cluster, a
* job run, a managed endpoint, a job template or a security configuration; Cost Explorer, for the tags of an anomaly
- * monitor or subscription; Security Hub, for the tags of a hub or a configuration policy); looked up lazily by
- * {@code ResourceArnBuilder} and {@code IamConditionContextResolver} through {@code Instance} for
- * the namespace a request or an ARN is of, so IAM never depends on that service directly.
+ * monitor or subscription; Security Hub, for the tags of a hub or a configuration policy; Control Tower, for the tags
+ * of a landing zone or an enabled control); looked up lazily by {@code ResourceArnBuilder} and
+ * {@code IamConditionContextResolver} through {@code Instance} for the namespace a request or an
+ * ARN is of, so IAM never depends on that service directly.
*
* Each answer is a lookup of what the service holds, asked for by an entry of the generated table ({@code find},
* {@code through}, a default, {@code forwarded}, a type's {@code resourceTagKeys}): never a fact about what an operation acts on, which the table alone
diff --git a/src/main/java/io/floci/aws/services/controltower/ControlTowerControlService.java b/src/main/java/io/floci/aws/services/controltower/ControlTowerControlService.java
index 8098a0153f..0aa71f5258 100644
--- a/src/main/java/io/floci/aws/services/controltower/ControlTowerControlService.java
+++ b/src/main/java/io/floci/aws/services/controltower/ControlTowerControlService.java
@@ -98,6 +98,20 @@ public class ControlTowerControlService {
.orElseThrow(() -> notFound("The request references an enabled control that does not exist."));
}
+ /**
+ * The tags of the enabled control whose ARN is {@code arn} in {@code region}, found as the tag handlers find it, by
+ * the ARN it records among the Region's controls in the request's account. {@link ControlTowerStoredResourceArns}
+ * asks it.
+ */
+ public Map storedTags(String region, String arn) {
+ return controls.scan(key -> key.startsWith(region + "::")).stream()
+ .filter(control -> arn.equals(control.getArn()))
+ .findFirst()
+ .map(EnabledControl::getTags)
+ .