hashicorp / hashicorp/terraform-getting-started-gcp-cloud-shell

Error during the tutorial setup

Open
#12 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Dockerfile
Stars
24
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Right from the very start it does not work. :(

```bash
-bash: [[: /etc/profile.d/customize_environment.sh: syntax error: operand expected (error token is "/etc/profile.d/customize_environment.sh")
Welcome to Cloud Shell! Type "help" to get started.
To set your Cloud Platform project in this session use “gcloud config set project [PROJECT_ID]”
i@cloudshell:~$ cloudshell_open --repo_url "https://github.com/hashicorp/terraform-getting-started-gcp-cloud-shell" --dir "tutorial/" --page "editor" --tutorial "./cloudshell_tutorial.md" --open_in_editor "./main.tf" --git_branch "main" --force_new_clone
2022/08/25 17:47:13 Cloning https://github.com/hashicorp/terraform-getting-started-gcp-cloud-shell into /home/i/cloudshell_open/terraform-getting-started-gcp-cloud-shell
Cloning into '/home/i/cloudshell_open/terraform-getting-started-gcp-cloud-shell'...
fatal: Remote branch main not found in upstream origin
2022/08/25 17:47:14 failed to resolve path '/home/i/cloudshell_open/terraform-getting-started-gcp-cloud-shell': No such file or directory
Error occured
```

File `/etc/profile.d/customize_environment.sh`:
```bash
#!/bin/bash
if [[ ! "$USER" -eq "root" ]]; then
return
fi

if [[ -f "/google/devshell/customize_environment_start" ]]; then
return
fi

function reportEvent {
if [[ -z "$USER_EMAIL" ]]; then
return
fi
curl -s -o /dev/null "https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/log?key=AIzaSyBTrp02tPmZTE55uVehXtbFKUGnoUcmsbM" --header "Content-Type: application/json" --request POST --data "{
client_info: {
client_type: 'DESKTOP'
},
log_source: 'CONCORD',
log_event: {
event_time_ms: `date +%s%N | cut -b1-13`,
source_extension_json_proto3: \"{
'client_email': \\"$USER_EMAIL\\",
'console_type': 'HEKATE_DEVSHELL',
'event_name': \\"$1\\",
}\"
},
}"
}

if [[ -f "$HOME/.customize_environment" ]]; then
sudo touch /var/log/customize_environment
reportEvent "customizeEnvironment" &
sudo chmod a+rw /var/log/customize_environment
sudo touch /google/devshell/customize_environment_start
sudo chmod a+r /google/devshell/customize_environment_start
(((sudo bash $HOME/.customize_environment &> /var/log/customize_environment) && (sudo touch /google/devshell/customize_environment_done && sudo chmod a+r /google/devshell/customize_environment_done && reportEvent "customizeEnvironmentDone")) || true) &
fi
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the cloudshell_open command shown in the issue, then inspect /etc/profile.d/customize_environment.sh and the repository branches used by the command. Determine whether the tutorial setup can complete without the shell syntax error and fatal main-branch error; done means the clone succeeds and the tutorial opens as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, google-cloud, terraform
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.