feat: Connect Terraform and Bicep Settings to the Environment resource#11172
feat: Connect Terraform and Bicep Settings to the Environment resource#11172vishwahiremat wants to merge 2 commits intofeatures/terraform-bicep-settingsfrom
Conversation
Signed-off-by: ytimocin <ytimocin@microsoft.com>
pkg/recipes/terraform/execute.go
Outdated
| // 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
Show autofix suggestion
Hide autofix suggestion
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.
| @@ -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) | ||
| } |
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Description
Test plan
Type of change
Fixes: #issue_number
Contributor checklist
Please verify that the PR meets the following requirements, where applicable: