Handling AWS Keys - JeffreyMFarley/hoop GitHub Wiki

Before you or GitHub can run any Terraform commands, you will need to have an AWS token. Here are the needed steps:

Step 1: Get the AWS token

  1. Log in to the AWS console
  2. Go to the IAM Users page
  3. Click on your account or the CI account
  4. Click the Security Credentials tab
  5. Click the Create Access Key button
  6. A new window will show up with an Access Key ID and the Secret Access Key. Record these values somewhere and/or download the CSV file. Once you leave this screen, you will no longer be able to see the Secret Access Key

Step 2, Option 1: Local AWS use

  1. In the root of your project, create a .env file (or use the existing one)
  2. Using your favorite text editor, add the following lines:
    export AWS_ACCESS_KEY_ID=<the key id from step 1>
    export AWS_SECRET_ACCESS_KEY=<the secret key from step 1>
    
  3. Run source .env to set the AWS keys in your environment
  4. Now you are free to run any of the Terraform commands

Step 2, Option 2: GitHub Actions use

  1. In your GitHub project, navigate to the Settings page
  2. Click on the Secrets tab
  3. Make sure the Actions Secrets page is selected
  4. Click New Repository Secret
    1. In the Name field enter AWS_ACCESS_KEY_ID
    2. In the Value field enter the key id from step 1
    3. Click Add Secret
  5. Repeat the above for AWS_SECRET_ACCESS_KEY
  6. Now the GitHub actions will be able to execute Terraform commands