Skip to content

Commit 4deb19f

Browse files
fix(elbv2): stop modeling runtime-managed TG Targets and LoadBalancerArns
Targets is populated at runtime by ECS Services and any other consumer of the register-targets API. LoadBalancerArns is populated when a Listener attaches the target group to an ALB. Neither field is meaningfully user-settable. Tracking these in formae state caused the periodic Synchronizer to write a new resource version on every ECS task placement and every Listener attach. The reconcile drift gate then rejected subsequent applies with the stacks-have-been-modified error even though the user had not changed their forma, forcing operators into force-mode or extract-and-absorb workarounds on every reconcile. Both fields are now dropped from the schema and stripped from the AWS Read response before the result enters formae state. Mirrors the existing pattern for other resource types where a returned field is owned by a sibling resource or external system.
1 parent 7f6b6fa commit 4deb19f

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

pkg/ccx/client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ var IgnoredFields = map[string][]string{
5252
"AWS::EC2::SecurityGroup": {"$.SecurityGroupEgress", "$.SecurityGroupIngress"},
5353
"AWS::IAM::Role": {"$.Policies"},
5454
"AWS::ElasticBeanstalk::ConfigurationTemplate": {"$.OptionSettings"},
55+
// Targets is populated at runtime by ECS Services (and other consumers
56+
// calling register-targets); LoadBalancerArns is populated when a
57+
// Listener attaches the TG to an ALB. Neither is meaningfully
58+
// user-settable, and tracking them in formae state makes the
59+
// Synchronizer write a new resource version on every task placement
60+
// or attach — which then trips the reconcile drift gate on the next
61+
// apply. Strip them in Read so they never enter the stored state.
62+
"AWS::ElasticLoadBalancingV2::TargetGroup": {"$.Targets", "$.LoadBalancerArns"},
5563
}
5664

5765
// normalizeCompositeIdentifier fixes inconsistencies in CloudControl composite

schema/pkl/elasticloadbalancingv2/targetgroup.pkl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ open class Matcher extends formae.SubResource {
1717
httpCode: String?
1818
}
1919

20-
@aws.SubResourceHint
21-
open class TargetDescription extends formae.SubResource {
22-
availabilityZone: aws.AvailabilityZone?
23-
id: String
24-
port: Int?
25-
}
26-
2720
@aws.SubResourceHint
2821
open class TargetGroupAttribute extends formae.SubResource {
2922
key: String?
@@ -41,9 +34,6 @@ open class TargetGroupResolvable extends formae.Resolvable {
4134
hidden arn: TargetGroupResolvable = (this) {
4235
property = "TargetGroupArn"
4336
}
44-
hidden loadBalancerArns: TargetGroupResolvable = (this) {
45-
property = "LoadBalancerArns"
46-
}
4737

4838
hidden targetGroupArn: TargetGroupResolvable = (this) {
4939
property = "TargetGroupArn"
@@ -126,9 +116,6 @@ open class TargetGroup extends formae.Resource {
126116
@aws.FieldHint{createOnly = true}
127117
targetType: String?
128118

129-
@aws.FieldHint{hasProviderDefault = true}
130-
targets: Listing<TargetDescription>?
131-
132119
@aws.FieldHint{hasProviderDefault = true}
133120
unhealthyThresholdCount: Int?
134121

0 commit comments

Comments
 (0)