Skip to content

feat: Connect Terraform and Bicep Settings to the Environment resource#11172

Open
vishwahiremat wants to merge 2 commits intofeatures/terraform-bicep-settingsfrom
vishwahiremat/connectEnvResource
Open

feat: Connect Terraform and Bicep Settings to the Environment resource#11172
vishwahiremat wants to merge 2 commits intofeatures/terraform-bicep-settingsfrom
vishwahiremat/connectEnvResource

Conversation

@vishwahiremat
Copy link
Contributor

@vishwahiremat vishwahiremat commented Feb 4, 2026

Description

  • Connects TerraformSettings and BicepSettings resources to the Environment resource
  • Adds validation during environment create/update to verify referenced settings exist
  • Implements delete filters to prevent deletion of settings that are in use by environments
  • Updates recipe config loaders and drivers to use settings from linked resources

Test plan

  • Verify environment creation fails if referencing non-existent settings
  • Verify settings cannot be deleted while referenced by an environment
  • Verify recipes correctly load configuration from linked settings resources

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).
  • This pull request adds or changes features of Radius and has an approved issue (issue link required).
  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional).

Fixes: #issue_number

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
    • Yes
    • Not applicable
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
    • Yes
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Yes
    • Not applicable
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
    • Yes
    • Not applicable
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
    • Yes
    • Not applicable
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.
    • Yes
    • Not applicable

Signed-off-by: ytimocin <ytimocin@microsoft.com>
@vishwahiremat vishwahiremat temporarily deployed to external-contributor-approval February 4, 2026 19:30 — with GitHub Actions Inactive
@vishwahiremat vishwahiremat changed the base branch from main to features/terraform-bicep-settings February 4, 2026 19:31
@vishwahiremat vishwahiremat changed the title Vishwahiremat/connect env resource feat: Connect Terraform and Bicep Settings to the Environment resource Feb 4, 2026
// Use custom backend from TerraformSettings
customBackend := options.EnvConfig.TerraformSettings.Backend
logger.Info(fmt.Sprintf("Using custom backend type: %s", customBackend.Type))
backendConfig, err = tfConfig.AddCustomBackend(customBackend.Type, customBackend.Config)

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of backendConfig is never used.

Copilot Autofix

AI 5 days ago

In general, to fix useless local assignments, either remove the assignment or, if the return value is intentionally ignored, assign it to the blank identifier _. Here, we do want to keep the call to tfConfig.AddCustomBackend for its side effects, but we do not use its returned configuration when the custom backend is in use.

The best targeted fix is: in the custom backend branch (lines 331–338), stop assigning the return value of AddCustomBackend to backendConfig. Instead, assign it to the blank identifier _ while still capturing err. This leaves the Kubernetes backend branch unchanged, where backendConfig is legitimately used, and retains all existing functionality and error handling.

Concretely, in pkg/recipes/terraform/execute.go, within generateConfig, replace line 335:

backendConfig, err = tfConfig.AddCustomBackend(customBackend.Type, customBackend.Config)

with:

_, err = tfConfig.AddCustomBackend(customBackend.Type, customBackend.Config)

No new imports, methods, or definitions are required.

Suggested changeset 1
pkg/recipes/terraform/execute.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/pkg/recipes/terraform/execute.go b/pkg/recipes/terraform/execute.go
--- a/pkg/recipes/terraform/execute.go
+++ b/pkg/recipes/terraform/execute.go
@@ -332,7 +332,7 @@
 		// Use custom backend from TerraformSettings
 		customBackend := options.EnvConfig.TerraformSettings.Backend
 		logger.Info(fmt.Sprintf("Using custom backend type: %s", customBackend.Type))
-		backendConfig, err = tfConfig.AddCustomBackend(customBackend.Type, customBackend.Config)
+		_, err = tfConfig.AddCustomBackend(customBackend.Type, customBackend.Config)
 		if err != nil {
 			return generateConfigResult{}, fmt.Errorf("error adding custom backend: %w", err)
 		}
EOF
@@ -332,7 +332,7 @@
// Use custom backend from TerraformSettings
customBackend := options.EnvConfig.TerraformSettings.Backend
logger.Info(fmt.Sprintf("Using custom backend type: %s", customBackend.Type))
backendConfig, err = tfConfig.AddCustomBackend(customBackend.Type, customBackend.Config)
_, err = tfConfig.AddCustomBackend(customBackend.Type, customBackend.Config)
if err != nil {
return generateConfigResult{}, fmt.Errorf("error adding custom backend: %w", err)
}
Copilot is powered by AI and may make mistakes. Always verify output.
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
@vishwahiremat vishwahiremat temporarily deployed to external-contributor-approval February 4, 2026 22:39 — with GitHub Actions Inactive
@radius-functional-tests
Copy link

radius-functional-tests bot commented Feb 4, 2026

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository radius-project/radius
Commit ref e42f310
Unique ID funcbf02176d79
Image tag pr-funcbf02176d79
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-funcbf02176d79
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-funcbf02176d79
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcbf02176d79
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcbf02176d79
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcbf02176d79
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@vishwahiremat vishwahiremat marked this pull request as ready for review February 4, 2026 23:28
@vishwahiremat vishwahiremat requested review from a team as code owners February 4, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants