Skip to content

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Jun 3, 2025

This PR fixes issue #128 by switching the aider module to use the coder_env resource instead of recommending inline environment variable configuration.

Changes Made

Aider Module (registry/coder/modules/aider/)

  • Replaced inline environment variable exports with coder_env resource
  • Added coder_env resource to properly set AI provider API keys as environment variables
  • Updated README to document the new environment variable handling approach
  • Updated tests to reflect the new behavior and verify coder_env resource creation

Key Improvements

  1. Reduced cognitive load: Users no longer need to manually configure environment variables on the coder_agent
  2. Better separation of concerns: Environment variables are managed by Terraform resources rather than shell scripts
  3. Improved maintainability: Centralized environment variable management through the module
  4. Follows Terraform best practices: Uses proper resource types for configuration

Technical Details

  • The module now creates a coder_env resource when an API key is provided
  • Removed all inline export API_KEY= statements from shell commands
  • Environment variables are automatically set based on the selected AI provider
  • Tests updated to verify the new behavior and ensure no regressions

Testing

  • All existing tests pass with the new implementation
  • Added verification that coder_env resources are created correctly
  • Confirmed that inline environment variable exports are no longer present

This change maintains backward compatibility while providing a cleaner, more maintainable approach to environment variable management in AI agent modules.

…nt variables

- Replace inline 'export API_KEY=' statements with coder_env resource
- Add coder_env resource to set AI provider API keys as environment variables
- Update README to document the new environment variable handling
- Update tests to reflect the new behavior
- Resolves issue #128

The aider module now properly uses the coder_env resource to set environment
variables instead of exporting them inline in shell commands. This reduces
cognitive load for users and follows Terraform best practices.
@matifali matifali closed this Jun 3, 2025
@matifali matifali deleted the fix/ai-modules-use-coder-env branch June 4, 2025 14:48
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.

1 participant