terraform-provider-linode icon indicating copy to clipboard operation
terraform-provider-linode copied to clipboard

[Feature]: Resolve inconsistency with Linode CLI

Open kordian2k opened this issue 7 months ago • 2 comments

Description

Running linode-cli configure by default creates a file ~/.config/linode-cli which looks like

[DEFAULT]
default-user = username

[username]
token = ...
...

On the other hand, the terraform provider uses the ~/.config/linode as the default. Moreover, the provider ignores the default user setting in the config file which leads to a HTTP 401 error even if the token is present.

If a change to the terraform provider is infeasible the documentation should be enhanced to reflect the inconsistency. The following configuration could be mentioned as a workaround:

provider "linode" {
  config_path = pathexpand("~/.config/linode-cli")
  config_profile = fileexists(pathexpand("~/.config/linode-cli")) ? (
    regex("default-user = (.*)", file(pathexpand("~/.config/linode-cli")))[0]
    ) : (
    "default"
  )
}

New or Affected Terraform Resources

No response

Potential Terraform Configuration

No response

kordian2k avatar Jul 12 '24 09:07 kordian2k