Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coder_agent.metadata includes stderr #208

Open
NiklasRosenstein opened this issue Apr 10, 2024 · 0 comments
Open

coder_agent.metadata includes stderr #208

NiklasRosenstein opened this issue Apr 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@NiklasRosenstein
Copy link

This is more of an unfortunate circumstance, but one where I don't think there is a workaround.

Terraform Version

Terraform v1.7.5
+ provider registry.terraform.io/coder/coder v0.20.1

Affected Resource(s)

  • coder_agent

Terraform Configuration Files

resource "coder_agent" "this" {
  os   = "linux"
  arch = "amd64"
  dir  = "/home/coder"

  metadata {
    display_name = "CPU Usage"
    key          = "cpu_usage"
    script       = "coder stat cpu"
    interval     = 10
    timeout      = 1
    order        = 1
  }

  metadata {
    display_name = "RAM Usage"
    key          = "ram_usage"
    script       = "coder stat mem"
    interval     = 10
    timeout      = 1
    order        = 2
  }

  metadata {
    display_name = "Disk Usage"
    key          = "disk_usage"
    script       = "coder stat disk"
    interval     = 10
    timeout      = 1
    order        = 3
  }

  metadata {
    display_name = "Uptime"
    key          = "uptime"
    script       = "uptime -p"
    interval     = 10
    timeout      = 1
    order        = 4
  }

  order = 1
}

Expected Behavior

The metadata contains the expected output.

Actual Behavior

If the ~/.bashrc prints a message, for example an error message to stderr, that message is included in the metadata. This is unexpected because it isn't strictly expected IMO that ~/.bashrc is even sourced for the script invokation.

As far as I can tell there's no workaround other than to fix the ~/.bashrc, which is unfortunate for administrators of the Coder template who have no control over the user's rc-file.

image

@coder-labeler coder-labeler bot added the bug Something isn't working label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant