Skip to content

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Aug 26, 2025

This PR updates the coder-login module to use coder_env resources instead of shell scripts for better security, maintainability, and native Terraform integration.

Changes

  • Replaced coder_script with coder_env resources: Uses native Terraform provider resources instead of shell scripts
  • Removed run.sh script: Eliminated the need for external shell scripts
  • Environment variables: Sets CODER_SESSION_TOKEN and CODER_URL using coder_env resources
  • Added comprehensive tests: Includes Terraform tests with mocked data validation
  • Version bump: Updated module version from v1.0.31 to v1.1.0 (minor bump)

Benefits

  • Native Terraform approach: Uses the provider's built-in resources instead of external scripts
  • Better security: Environment variables are set directly by Terraform without shell script interpolation
  • Improved maintainability: Cleaner, more declarative configuration
  • Proper testing: Comprehensive test coverage with mocked data sources
  • Correct environment variables: Uses CODER_SESSION_TOKEN and CODER_URL as per coder CLI documentation

Testing

  • All Terraform tests pass successfully
  • Module validates correctly with terraform validate
  • Proper formatting verified with terraform fmt

@matifali matifali added the version:minor Add to PRs requiring a minor version upgrade label Aug 26, 2025
@matifali matifali requested a review from johnstcn August 26, 2025 08:48
Copy link

❌ Version Bump Validation Failed

Bump Type: minor

Module versions need to be updated but haven't been bumped yet.

Required Actions:

  1. Run the version bump script locally: ./.github/scripts/version-bump.sh minor
  2. Commit the changes: git add . && git commit -m "chore: bump module versions (minor)"
  3. Push the changes: git push

Script Output:

🔍 Detecting modified modules...
Found modules:
registry/coder/modules/coder-login

📦 Processing: coder/coder-login
Found git tag: release/coder/coder-login/v1.0.31 (v1.0.31)
Current version: 1.0.31
New version: 1.1.0
Updating version references for coder/coder-login in registry/coder/modules/coder-login/README.md

🔧 Running formatter to ensure consistent formatting...

📋 Summary:
Bump Type: minor

Modules Updated:

- coder/coder-login: v1.0.31 → v1.1.0

READMEs Updated:

- coder/coder-login

✅ Version bump completed successfully!
📝 README files have been updated with new versions.

Next steps:
1. Review the changes: git diff
2. Commit the changes: git add . && git commit -m 'chore: bump module versions (minor)'
3. Push the changes: git push

Please update the module versions and push the changes to continue.

@matifali matifali self-assigned this Aug 26, 2025
@blink-so blink-so bot force-pushed the blink/update-coder-login-env-vars branch 2 times, most recently from 4128618 to e3ce4b0 Compare August 26, 2025 08:56
@blink-so blink-so bot changed the title Update coder-login module to use environment variables Update coder-login module to use coder_env resources Aug 26, 2025
@matifali matifali marked this pull request as ready for review August 26, 2025 08:57
@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 08:57
@matifali matifali removed the version:minor Add to PRs requiring a minor version upgrade label Aug 26, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the coder-login module by replacing shell script-based authentication with native Terraform coder_env resources for setting environment variables.

  • Replaced coder_script resource with two coder_env resources for CODER_SESSION_TOKEN and CODER_URL
  • Removed the external run.sh shell script dependency
  • Added comprehensive Terraform tests with mocked data validation

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
registry/coder/modules/coder-login/run.sh Removed shell script that handled coder CLI authentication
registry/coder/modules/coder-login/main.tf Replaced coder_script with coder_env resources for environment variables
registry/coder/modules/coder-login/main.tftest.hcl Added comprehensive test suite with mocked data sources
registry/coder/modules/coder-login/README.md Updated version reference from v1.0.31 to v1.1.0

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Replaced coder_script resource with coder_env resources for CODER_SESSION_TOKEN and CODER_URL
- Removed run.sh script file in favor of native Terraform provider resources
- Added comprehensive Terraform tests with mocked data validation
- Uses correct environment variable names as per coder CLI documentation
- Cleaner approach using native Terraform provider resources

Co-authored-by: Atif Ali <atif@coder.com>
@blink-so blink-so bot force-pushed the blink/update-coder-login-env-vars branch from e3ce4b0 to df5f65e Compare August 26, 2025 08:58
Copy link
Contributor

@DevelopmentCats DevelopmentCats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this out just to make sure it works alright with just setting the env, and it works perfectly.

@DevelopmentCats DevelopmentCats merged commit a9b0150 into main Aug 27, 2025
4 checks passed
@DevelopmentCats DevelopmentCats deleted the blink/update-coder-login-env-vars branch August 27, 2025 02:33
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.

3 participants