Summary
In the aws@0.1.1 plugin package, TargetDescription.id in elasticloadbalancingv2/targetgroup.pkl is typed as String instead of (String|formae.Resolvable). This prevents using cross-resource references (e.g., EC2
instance IDs) as target group targets — a fundamental use case for load balancers.
Affected Version
- Plugin: aws@0.1.1 (package://hub.platform.engineering/plugins/aws/schema/pkl/aws/aws@0.1.1)
- formae: 0.82.1
How to Reproduce
- Create a project with the aws plugin:
mkdir /tmp/formae-bug-repro && cd /tmp/formae-bug-repro
formae project init --include aws -y
- Replace main.pkl with a minimal reproducer:
amends "@formae/forma.pkl"
import "@formae/formae.pkl"
import "@aws/ec2/instance.pkl"
import "@aws/elasticloadbalancingv2/targetgroup.pkl"
import "@aws/aws.pkl"
stacks {
new formae.Stack {
label = "repro-stack"
description = "Bug reproducer"
target = new aws.Target {
label = "repro-target"
region = "af-south-1"
profile = "default"
}
resources {
// An EC2 instance
new instance.Instance {
label = "my-instance"
imageId = "ami-12345678"
instanceType = "t3.small"
}
// A target group referencing the instance ID (a Resolvable)
local myInstance = new instance.Instance {
label = "my-instance"
}
new targetgroup.TargetGroup {
label = "my-tg"
port = 6443
protocol = "TCP"
targetType = "instance"
targets {
new targetgroup.TargetDescription {
id = myInstance.res.instanceId // <-- THIS FAILS: InstanceResolvable assigned to String
port = 6443
}
}
}
}
}
}
- Run:
- Observe the error:
–– Pkl Error ––
Expected value of type `String`, but got type `aws.ec2.instance#InstanceResolvable`.
23 | id: String
^^^^^^
at aws.elasticloadbalancingv2.targetgroup#TargetDescription.id
Expected Behaviour
TargetDescription.id should accept (String|formae.Resolvable), allowing cross-resource references. This is the standard pattern used throughout the entire plugin. For example:
| Field |
File |
Type |
Listener.loadBalancerArn |
elasticloadbalancingv2/listener.pkl |
String|formae.Resolvable |
Action.targetGroupArn |
elasticloadbalancingv2/listener.pkl |
(String|formae.Resolvable)? |
TargetGroup.vpcId |
elasticloadbalancingv2/targetgroup.pkl |
(String|formae.Resolvable)? |
Volume.volumeId |
ec2/instance.pkl |
String|formae.Resolvable |
Instance.subnetId |
ec2/instance.pkl |
(String|formae.Resolvable)? |
Instance.securityGroupIds |
ec2/instance.pkl |
Listing<String|formae.Resolvable>? |
TargetDescription.id |
elasticloadbalancingv2/targetgroup.pkl |
String ← should be (String|formae.Resolvable) |
Summary
In the aws@0.1.1 plugin package, TargetDescription.id in elasticloadbalancingv2/targetgroup.pkl is typed as String instead of (String|formae.Resolvable). This prevents using cross-resource references (e.g., EC2
instance IDs) as target group targets — a fundamental use case for load balancers.
Affected Version
How to Reproduce
formae eval main.pklExpected Behaviour
TargetDescription.id should accept (String|formae.Resolvable), allowing cross-resource references. This is the standard pattern used throughout the entire plugin. For example:
Listener.loadBalancerArnelasticloadbalancingv2/listener.pklString|formae.ResolvableAction.targetGroupArnelasticloadbalancingv2/listener.pkl(String|formae.Resolvable)?TargetGroup.vpcIdelasticloadbalancingv2/targetgroup.pkl(String|formae.Resolvable)?Volume.volumeIdec2/instance.pklString|formae.ResolvableInstance.subnetIdec2/instance.pkl(String|formae.Resolvable)?Instance.securityGroupIdsec2/instance.pklListing<String|formae.Resolvable>?TargetDescription.idelasticloadbalancingv2/targetgroup.pklString← should be(String|formae.Resolvable)