0
0

terraform init で「Error: failed to get shared config profile」

Posted at

概要

環境:MacOS
以下の様にAWSのssoプロファイルを使ってs3バックエンドを定義

terraform {
  backend "s3" {
    bucket = "sample-bucket"
    key = "terraform.tfstate"
    region = "ap-northeast-1"
    profile = "sso-my-profile"
  }
}

この状態でterraform initすると以下のエラーになった。

Initializing the backend...
╷
│ Error: failed to get shared config profile, sso-my-profile

原因と解決策

いつぞや環境変数に設定していたAWS_CONFIG_FILEが原因だった。

~/.zshrc
export AWS_CONFIG_FILE="~/.aws/config"

デフォルトパスなのでそもそも指定する必要はないのだが...
このパスの「~」がうまく認識されておらず、configファイルをうまく参照できていなかったらしい。
該当の環境変数を消したら無事terraform initが通った。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0