What is a target?
A target uniquely identifies a deployment location for your infrastructure. Think of it as “where” your resources live:- For AWS: a region like
us-east-1 - For Kubernetes: a cluster endpoint
- For SFTP: a server URL like
sftp://files.example.com:22
Target vs credentials
Target configuration in requests
Every request to your plugin includes aTargetConfig field:
Define the target config type
For our SFTP plugin, the target is just the server URL. Add this tosftp.go:
Update sftp.go
Add the target configuration and credentials code. Update the imports and add the helper functions:Config field mutability
You can annotate target config fields to tell formae which fields can be changed in place and which require a full target replace. Add@formae.ConfigFieldHint annotations to your PKL Config class:
createOnly = true: immutable, triggers target replace (default for unannotated fields)createOnly = false: mutable, allows in-place update
createOnly = false lets users switch credentials without recreating resources.
See the schema annotations reference for full details.
Verify
To verify that the target configuration code compiles correctly:Next: 04 - Plugin configuration
See also: advanced target patterns
For Target Config patterns beyond this introduction:- Cross-plugin Target Resolvables (Target Config field accepting upstream resolvable from another plugin’s resource): see the Grafana plugin’s Target Config, which references AWS/Compose resolvables.
- Collection Resolvables (
Mapping<String, formae.Resolvable>and similar): see the Compose plugin’s Target Config. - Polymorphic Target auth (abstract auth class plus KubeconfigAuth/EKSAuth/GKEAuth/… discriminated by
hidden fixed type): see the Kubernetes plugin’s Target Config.

