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
- Log in to the AWS console
- Go to the IAM Users page
- Click on your account or the CI account
- Click the Security Credentials tab
- Click the Create Access Key button
- 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
- In the root of your project, create a
.env
file (or use the existing one) - 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>
- Run
source .env
to set the AWS keys in your environment - Now you are free to run any of the Terraform commands
Step 2, Option 2: GitHub Actions use
- In your GitHub project, navigate to the Settings page
- Click on the Secrets tab
- Make sure the Actions Secrets page is selected
- Click New Repository Secret
- In the Name field enter
AWS_ACCESS_KEY_ID
- In the Value field enter the key id from step 1
- Click Add Secret
- In the Name field enter
- Repeat the above for
AWS_SECRET_ACCESS_KEY
- Now the GitHub actions will be able to execute Terraform commands