Crossplane EnvironmentConfig & Patch-and-Transform Prompt
Use Crossplane EnvironmentConfigs and patch-and-transform pipelines to inject shared environment data (VPC IDs, region, defaults) into composed resources without hardcoding values per claim.
- Target user
- Platform engineers authoring Crossplane Compositions
- Difficulty
- Intermediate
- Tools
- Claude, Cursor
The prompt
You are a senior Crossplane composition author who builds reusable platform APIs. I will provide: - The XRD/claim API and the managed resources a Composition should create. - The shared environment data to inject (region, network IDs, tag defaults, account map). - Whether values vary by environment (dev/stage/prod) or by region. Your job: 1. **Model EnvironmentConfigs** — design one or more EnvironmentConfig objects holding the shared data and explain selection by label or claim reference. 2. **Wire environment selection** — configure the Composition `environment.environmentConfigs` with selectors so the right config merges in per claim. 3. **Build the patch pipeline** — write `patches` of type `FromEnvironmentFieldPath`, `ToEnvironmentFieldPath`, and `CombineFromEnvironment`, including transforms (map, string fmt, convert). 4. **Default sensibly** — show patch policies (`fromFieldPath: Optional`) and defaults so missing env data fails predictably. 5. **Validate** — recommend `crossplane beta validate` / render to preview composed output before applying. 6. **Avoid drift** — note which fields should be env-driven vs. claim-driven to prevent surprise updates. 7. **Document the API** — summarize what a consumer must supply vs. what the environment provides. Output as: (a) EnvironmentConfig manifests, (b) the Composition with annotated patches, (c) a sample claim, (d) a render/validate command and expected output snippet. Flag any patch that silently produces an empty value when env data is absent.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Crossplane Composition Design Prompt
Design Crossplane XRDs, Compositions, and Composition Functions that expose a clean, opinionated platform API while hiding cloud-provider sprawl from application teams.
-
Crossplane Managed Resource Import & Observe-Only Prompt
Bring existing brownfield cloud resources under Crossplane management using the crossplane.io/external-name annotation and observe-only policies, without recreating or mutating live infrastructure.
-
Crossplane v2 Namespaced XR Migration Prompt
Plan the migration from Crossplane v1 cluster-scoped composite resources and claims to v2 namespaced XRs, updating XRDs, compositions, and RBAC without orphaning managed resources.
-
Crossplane Composition Revision Rollout & Pinning Prompt
Roll out changes to a Crossplane Composition safely across many live claims — using CompositionRevisions, revision pinning, and automatic-vs-manual update policies so a bad composition change cannot ripple into every managed resource at once.
More Infrastructure as Code prompts & error guides
Browse every Infrastructure as Code prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.