Error when run Rover on Ubuntu and error 404 when checking Terraform Cloud Agent exist
- Dominant language
- Shell
- Stars
- 176
- Forks
- 147
- PR merge metrics
- No merged PRs in 30d
Description
### 1. An error occur when I run Rover on Ubuntu 20.04
in [tfcloud.sh#539](https://github.com/aztfmod/rover/blob/1ab78b3001263b623acdf7fa852726afa0dd1dbe/scripts/tfcloud/tfcloud.sh#L539) file, function **process_curl_response()** has 2 lines to curl the TFE with token and redirect to STDERR by `2> >(tee /dev/stderr)`
```shell
command="curl -sS -L -w '%{http_code}' --header 'Authorization: Bearer xxxxxx' --header 'Content-Type: application/vnd.api+json' $options -- '"${url}"' 2> >(tee /dev/stderr)";
debug "$(echo "Running command: $command")" >&2
command="curl -sS -L -w '%{http_code}' --header 'Authorization: Bearer "$REMOTE_ORG_TOKEN"' --header 'Content-Type: application/vnd.api+json' $options -- '"${url}"' 2> >(tee /dev/stderr)";
```
When I try to do the migration to Terraform Cloud, below is the error I'm face with
```
tee: /dev/stderr: No such device or address
Error /tf/rover/tfcloud/tfcloud.sh on or near line 543; exiting with status 1
```
I have made some changes to remove the `2> >(tee /dev/stderr)` out of tfcloud.sh and rerun the migration, it's worked.
So I need some help to remove the `2> >(tee /dev/stderr)` in the code, or are there any other solution for it?
### 2. Terraform Cloud Agent Check failure
in [tfcloud.sh#43](https://github.com/aztfmod/rover/blob/1ab78b3001263b623acdf7fa852726afa0dd1dbe/scripts/tfcloud/tfcloud.sh#L43), the function **check_terraform_cloud_agent_exist()** check if the tfcloud agent exist via url
```shell
url="https://${TF_VAR_tf_cloud_hostname}/api/v2/organizations/${TF_VAR_tf_cloud_organization}/agent-pools";
```
or
```shell
url="https://${TF_VAR_tf_cloud_hostname}/api/v2/organizations/${TF_VAR_tf_cloud_organization}/agent-pools/${gitops_agent_pool_id}";
```
When I run the Terraform Cloud migrate/plan/apply with **agent mode**, it throw this error:
```
Gracefully continue on error: HTTP status code is 404 for https://*****.com/api/v2/organizations/*****/agent-pools/apool-*****
apool-*****
```
Base on the latest [api-docs](https://developer.hashicorp.com/terraform/cloud-docs/api-docs/agents#list-agents) from Harshicorp to list agent, the valid format of the url must not have the suffix `/organizations/${TF_VAR_tf_cloud_organization}`. It has pass from my testing also.
I need some help to fix it for latest run.
---
**Review Note (2026-01-12)**: Multiple critical bugs affecting Terraform Cloud integration. Needs immediate attention for users using TF Cloud backend.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in scripts/tfcloud/tfcloud.sh at process_curl_response() near line 539 and check_terraform_cloud_agent_exist() near line 43. Reproduce the Ubuntu migration error and the agent-mode 404, then verify that Terraform Cloud requests work without the reported /dev/stderr failure and that agent checks use the documented URL format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell, terraform
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100