Repository navigation
Direct module support for Recipes - #11876
Conversation
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11876 +/- ##
==========================================
+ Coverage 51.47% 51.69% +0.21%
==========================================
Files 699 725 +26
Lines 44130 45595 +1465
==========================================
+ Hits 22718 23572 +854
- Misses 19251 19798 +547
- Partials 2161 2225 +64 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request adds a new design note under eng/design-notes/recipes/ describing the proposed “Direct Recipe Modules” feature, which would allow Radius recipe packs to reference standard Terraform/Bicep modules directly (without Radius-specific wrapper modules), including proposed parameter expression resolution and output mapping behavior.
Changes:
- Adds a comprehensive design note for “Direct Recipe Modules” (motivation, scenarios, risks, UX, and examples).
- Introduces proposed concepts for parameter expression resolution (
{{context.*}}) and module output-to-resource-property mapping (outputs). - Includes multiple end-to-end Bicep examples for recipe packs, environments, and output/secrets handling.
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Reshma Abdul Rahim <61033581+Reshrahim@users.noreply.github.com> Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <61033581+Reshrahim@users.noreply.github.com> Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
88e80e2 to
71bc0d3
Compare
# Description Implements **Direct Module Support for Recipes** (design: radius-project#11876). Today every Bicep/Terraform module used as a Radius Recipe must be wrapped to add a `context` input variable and a structured `result` output. This blocks direct use of community modules (Terraform Registry, Azure Verified Modules) and adds maintenance overhead. This PR lets a platform engineer point a recipe's `source` directly at a standard module — Radius resolves parameters (including `{{context.*}}` expressions), executes the module via the existing driver, and maps the module's outputs back to resource-type properties via a new `outputs` field. Existing wrapped recipes are unchanged. ## What's included - **Parameter expression resolution** — new `pkg/recipes/paramresolver` resolves `{{context.*}}` expressions (and single-level ternaries) in recipe parameters. - **`outputs` mapping** — new `outputs` field on `Radius.Core/recipePacks` recipe definitions maps module output names onto resource property names (TypeSpec → swagger → generated models → datamodel → conversion → bicep types). Precedence: `outputs` mapping > `result` output > flat passthrough. - **Bicep + Terraform drivers** — direct-module detection and execution. Terraform mapped outputs preserve per-output `sensitive` so secret outputs still route to Secrets rather than Values. - **Parameter merge** — `ShallowMergeParameters` (environment-wins) in `pkg/recipes/util`. - **Terraform registry versioning** — registry modules aren't URLs and need a separate `version` argument, so RecipePacks use a `<source>:<version>` convention in the recipe's `source` field (e.g. `terraform-aws-modules/rds/aws:6.1.0`), mirroring how Bicep/OCI recipes embed the version in the image tag (per [radius-project#12086](radius-project#12086)), parsed into the module source + version. The split is collision-safe: only a colon in the final path segment is a version, so a registry `host:port` (e.g. `my.registry.com:8443/ns/name/aws`) and `://` URL sources are left untouched. Verified end-to-end: a Radius-shaped `main.tf.json` with split `source` + `version` resolves the module from `registry.terraform.io`, whereas an un-split `source:version` is rejected by Terraform. - **dynamic-rp hardening** — non-string secret values are stringified instead of panicking. ## Testing - Unit tests across all touched packages (paramresolver, util, bicep/terraform drivers, terraform config/execute/module, configloader, conversion, dynamic-rp processor). - Noncloud functional test `Test_DirectModule_Terraform` deploying a non-wrapped Terraform module fixture (`test/testrecipes/test-terraform-recipes/direct-kubernetes`), validating `{{context.*}}` resolution, module execution, and outputs mapping end-to-end. ## Known limitations / hard to test in CI - Terraform **registry** module download + version resolution can't run in noncloud CI (needs a live registry). The `<source>:<version>` parsing is unit-tested, but end-to-end registry resolution is manual/cloud-only. - Private registry / Git / OCI auth, cloud-backed modules (AVM Bicep, AWS RDS Terraform), and `x-radius-sensitive` encryption-at-rest are validated at unit boundaries only. - Link-time source-reachability validation is out of scope (proposed as follow-up). ## Type of change - This pull request adds or changes features of Radius and has an approved issue (issue link required). Design: radius-project#11876 Closes radius-project#12086 ## Contributor checklist - A PR for [resource-types-contrib](https://github.com/radius-project/resource-types-contrib/) — _follow-up if recipes/types are affected._ - A PR for the [documentation repository](https://github.com/radius-project/docs) — _follow-up: the new `outputs` field and the `<source>:<version>` Terraform registry convention are user-facing._ > Synced with `main`: this branch now builds on the recipe-pack `kind`/`source` field naming (radius-project#11879). The `outputs` field and direct-module logic sit alongside it. Issue link and docs/resource-types-contrib follow-ups to be finalized. --------- Signed-off-by: willdavsmith <willdavsmith@gmail.com>
# Description Implements **Direct Module Support for Recipes** (design: #11876). Today every Bicep/Terraform module used as a Radius Recipe must be wrapped to add a `context` input variable and a structured `result` output. This blocks direct use of community modules (Terraform Registry, Azure Verified Modules) and adds maintenance overhead. This PR lets a platform engineer point a recipe's `source` directly at a standard module — Radius resolves parameters (including `{{context.*}}` expressions), executes the module via the existing driver, and maps the module's outputs back to resource-type properties via a new `outputs` field. Existing wrapped recipes are unchanged. ## What's included - **Parameter expression resolution** — new `pkg/recipes/paramresolver` resolves `{{context.*}}` expressions (and single-level ternaries) in recipe parameters. - **`outputs` mapping** — new `outputs` field on `Radius.Core/recipePacks` recipe definitions maps module output names onto resource property names (TypeSpec → swagger → generated models → datamodel → conversion → bicep types). Precedence: `outputs` mapping > `result` output > flat passthrough. - **Bicep + Terraform drivers** — direct-module detection and execution. Terraform mapped outputs preserve per-output `sensitive` so secret outputs still route to Secrets rather than Values. - **Parameter merge** — `ShallowMergeParameters` (environment-wins) in `pkg/recipes/util`. - **Terraform registry versioning** — registry modules aren't URLs and need a separate `version` argument, so RecipePacks use a `<source>:<version>` convention in the recipe's `source` field (e.g. `terraform-aws-modules/rds/aws:6.1.0`), mirroring how Bicep/OCI recipes embed the version in the image tag (per [#12086](#12086)), parsed into the module source + version. The split is collision-safe: only a colon in the final path segment is a version, so a registry `host:port` (e.g. `my.registry.com:8443/ns/name/aws`) and `://` URL sources are left untouched. Verified end-to-end: a Radius-shaped `main.tf.json` with split `source` + `version` resolves the module from `registry.terraform.io`, whereas an un-split `source:version` is rejected by Terraform. - **dynamic-rp hardening** — non-string secret values are stringified instead of panicking. ## Testing - Unit tests across all touched packages (paramresolver, util, bicep/terraform drivers, terraform config/execute/module, configloader, conversion, dynamic-rp processor). - Noncloud functional test `Test_DirectModule_Terraform` deploying a non-wrapped Terraform module fixture (`test/testrecipes/test-terraform-recipes/direct-kubernetes`), validating `{{context.*}}` resolution, module execution, and outputs mapping end-to-end. ## Known limitations / hard to test in CI - Terraform **registry** module download + version resolution can't run in noncloud CI (needs a live registry). The `<source>:<version>` parsing is unit-tested, but end-to-end registry resolution is manual/cloud-only. - Private registry / Git / OCI auth, cloud-backed modules (AVM Bicep, AWS RDS Terraform), and `x-radius-sensitive` encryption-at-rest are validated at unit boundaries only. - Link-time source-reachability validation is out of scope (proposed as follow-up). ## Type of change - This pull request adds or changes features of Radius and has an approved issue (issue link required). Design: #11876 Closes #12086 ## Contributor checklist - A PR for [resource-types-contrib](https://github.com/radius-project/resource-types-contrib/) — _follow-up if recipes/types are affected._ - A PR for the [documentation repository](https://github.com/radius-project/docs) — _follow-up: the new `outputs` field and the `<source>:<version>` Terraform registry convention are user-facing._ > Synced with `main`: this branch now builds on the recipe-pack `kind`/`source` field naming (#11879). The `outputs` field and direct-module logic sit alongside it. Issue link and docs/resource-types-contrib follow-ups to be finalized. --------- Signed-off-by: willdavsmith <willdavsmith@gmail.com> Signed-off-by: sk593 <shruthikumar@microsoft.com>
This pull request adds a comprehensive design note describing the "Direct Recipe Modules" feature for Radius. The document outlines how platform engineers can use standard Bicep or Terraform modules directly as Radius Recipes, removing the need for custom wrappers and reducing maintenance overhead. It covers user personas, challenges, desired outcomes, implementation details, and usage examples.
Key documentation additions:
Feature overview and motivation
locationfield of a recipe, eliminating the need for Radius-specific wrappers and simplifying adoption and maintenance.Core features and scenarios
Risks, dependencies, and limitations
User experience and implementation details
Please explain the changes you've made.
Type of change
Fixes: #issue_number
Contributor checklist
Please verify that the PR meets the following requirements, where applicable:
eng/design-notes/in this repository, if new APIs are being introduced.