scaleway-cli icon indicating copy to clipboard operation
scaleway-cli copied to clipboard

Scw init conflit with SCW_ACCESS_KEY variable

Open camlafit opened this issue 4 years ago • 3 comments

Command attempted

export SCW_ACCESS_KEY=/home/user/.config/scw/orga01.yaml scw init

Expected Behavior

Config should be created in orga01.yaml or default config without any error.

Actual Behavior

Do you want to override the current config? (Y/n): 

Enter a valid secret-key or an email: xyc4e5e9-xxxx-xxxx-xxxx-xxxxxxxxxxxx

To improve this tool we rely on diagnostic and usage data.
Sending such data is optional and can be disabled at any time by running "scw config set send-telemetry=false".
Do you want to send usage statistics and diagnostics? (Y/n): n

To fully enjoy Scaleway CLI we recommend you install autocomplete support in your shell.
Do you want to install autocomplete? (Y/n): 
Config saved at /home/user/.config/scw/config.yaml:
access_key: SCWVXYZMQGA00A8NF4K9
secret_key: xyc4e5e9-xxxx-xxxx-xxxx-xxxxxxxxxxxx
default_organization_id: xyzyzyz-269d-xuzyezye-afd8-b3e4f3d9a39b
default_project_id: erezrez-269d-tytrytry-afd8-b3e4f3d9a39b
default_region: fr-par
default_zone: fr-par-1

Scaleway-sdk-go: invalid access key format '/home/user/.config/scw/orga01.yaml', expected SCWXXXXXXXXXXXXXXXXX format

More info

On debian buster amd64

scw version
Version    2.3.0
BuildDate  2021-03-10T04:34:49
GoVersion  go1.16
GitBranch  new-release
GitCommit  0011be36
GoArch     amd64
GoOS       linux

camlafit avatar May 18 '21 13:05 camlafit

To complete if SCW_ACCESS_KEY is unset then no more error.

camlafit avatar May 18 '21 13:05 camlafit

The export SCW_ACCESS_KEY=/home/user/.config/scw/orga01.yaml is probably at fault here. The format expected for access key is following a pattern such as SCWXXXXXXXXXXXXXXXXX it is not a file path, it is a piece of credential information provided when the token is created. It is useful for instance for performing operations with S3.

remyleone avatar May 18 '21 15:05 remyleone

Hello

Thanks a lot. Ok understood was a misconception about use variable. Looks better to use profile context with SCW_PROFILE or scw config profile activate.

In this case could be interesting to improve https://github.com/scaleway/scaleway-cli/blob/master/docs/commands/config.md about this concept And explain "default" profile as reserved profile.

camlafit avatar May 18 '21 15:05 camlafit