hene

hene.dev

Failed to get the data key required to decrypt the SOPS file. の対応

Failed to get the data key required to decrypt the SOPS file. の対応

Terraform で、sops を利用してクレデンシャルな情報を管理している。 別プロジェクトで、クレデンシャルな情報を見ようとしたときに下記エラーが発生した。

エラー

$ sops -d secrets.yaml
Failed to get the data key required to decrypt the SOPS file.

Group 0: FAILED
  arn:aws:kms:ap-northeast-1:000000000000:key/xxxxxxxx-yyyy-0000-1111-222222222222: FAILED
    - | Error creating AWS session: CredentialRequiresARNError:
      | credential type source_profile requires role_arn, profile
      | default

Recovery failed because no master key was able to decrypt the file. In
order for SOPS to recover the file, at least one key has to be successful,
but none were.

対応

profiledefault を設定しているのがよくなさそうなので、~/.aws/config[default] をコメントアウトすると解決した。

before

[default]
region = ap-northeast-1
source_profile = hogehoge

after

; [default]
; region = ap-northeast-1
; source_profile = hogehoge

関連記事