Skip to content

TargetDescription.id missing in Resolvable union type in elasticloadbalancingv2/targetgroup.pkl #31

Description

@christiaan-bronkhorst

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

  1. Create a project with the aws plugin:
  mkdir /tmp/formae-bug-repro && cd /tmp/formae-bug-repro
  formae project init --include aws -y
  1. 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
            }
          }
        }
      }
    }
  }
  1. Run:
  formae eval main.pkl
  1. 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions