LoginSignup
2
1

More than 3 years have passed since last update.

CircleCIでAWS CLIを利用する時に環境変数(or context)が効かない

Posted at

概要

CircleCIで環境変数やContextsに値を設定しても、AWS CLIが以下のようなエラーで落ちることがあります。

#!/bin/bash -eo pipefail
aws configure set aws_access_key_id \
$AWS_ACCESS_KEY_ID \
--profile default
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: the following arguments are required: value
Exited with code 2

原因

  • GitHubのフォークしたリポジトリからPRを出している
    • そしてCircleCIのAdvanced SettingsPass secrets to builds from forked pull requestsOffになっている

対策

上記の設定をOnにすれば解決するが、脆弱性の懸念が大きいためおすすめできません。(詳しくは設定画面の説明を参照)

Pass secrets to builds from forked pull requests
Run builds for fork pull request changes with this project's configuration, environment variables, and secrets.

There are serious security concerns with this setting (see the documentation for details.) If you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you!

各自でビルドを行わないのであればフォークしない運用とするのが良いと思われます。

2
1
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
2
1