configure-aws-credentials icon indicating copy to clipboard operation
configure-aws-credentials copied to clipboard

aws-region does not work with secrets

Open salatielosorno opened this issue 2 years ago • 7 comments

Why can not aws-region use a secret?

I tried this but it does not work:

aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

This works:

aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

salatielosorno avatar Mar 09 '22 19:03 salatielosorno

@salatielosorno I ran into the same issue until I discovered that I had used ${ secrets.AWS_REGION } instead of ${{ secrets.AWS_REGION } for interpolation.

awendt avatar Mar 10 '22 08:03 awendt

@awendt This is not the case. I mean I used ${{ secrets.AWS_REGION }} with double brackets and it does not work yet.

salatielosorno avatar Mar 15 '22 00:03 salatielosorno

Then I don't know. It works for me, so it must be specific to your use case. Can you elaborate on your workflow? When is it triggered? Who triggers it?

awendt avatar Mar 16 '22 10:03 awendt

@awendt It is a simple workflow that is triggered when a branch is pushed. I have all secrets at the organizational level. I think this is a GitHub problem because I changed my workflow to be a reusable one and it works!! I am not sure yet what is happening.

salatielosorno avatar Mar 29 '22 15:03 salatielosorno

Ran into same issue. @salatielosorno how did you fix it?

blurredpixel avatar Apr 21 '22 20:04 blurredpixel

@RaviVaderaIntel @salatielosorno Not sure if this the the same problem, but I was getting the same error, I changed the secret from US-EAST-1 to us-east-1. Error went away and the step was able to complete.

cnichols avatar May 08 '22 13:05 cnichols

My problem was related to secrets not being loaded properly. I was able to fix it by just making sure that the secrets were being loaded properly.

blurredpixel avatar Jun 02 '22 12:06 blurredpixel

If anyone is running into this issue, please specify what exactly you mean by "not working". What error message are you seeing, when are you seeing the error message?

peterwoodworth avatar Oct 05 '22 20:10 peterwoodworth

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Oct 11 '22 00:10 github-actions[bot]

I ran into the same error. This is what I see in the logs

Run aws-actions/configure-aws-credentials@v1
Error: Input required and not supplied: aws-region

Detailed debug logs:

##[debug]Evaluating condition for step: 'Configure AWS credentials'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Configure AWS credentials
##[debug]Register post job cleanup for action: aws-actions/configure-aws-credentials@v1
##[debug]Loading inputs
##[debug]Evaluating: secrets.AWS_ACCESS_KEY_ID
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'AWS_ACCESS_KEY_ID'
##[debug]=> null
##[debug]Result: null
##[debug]Evaluating: secrets.AWS_SECRET_ACCESS_KEY
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'AWS_SECRET_ACCESS_KEY'
##[debug]=> null
##[debug]Result: null
##[debug]Evaluating: secrets.AWS_REGION
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'AWS_REGION'
##[debug]=> null
##[debug]Result: null
##[debug]Loading env
Run aws-actions/configure-aws-credentials@v1
Error: Input required and not supplied: aws-region
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Configure AWS credentials

Shiti avatar Oct 11 '22 10:10 Shiti

It doesn't look like your secret is loading properly @Shiti, please ensure you've set your secret appropriately and that you've defined it properly in your action.yml file

peterwoodworth avatar Oct 11 '22 17:10 peterwoodworth

I defined it just as mentioned here https://github.com/aws-actions/configure-aws-credentials/issues/402#issue-1164357718 and also configured them in the repo secrets. I was able to get it working by changing the secret name i.e. instead of ${{ secrets.AWS_REGION }}, I used ${{ secrets.MY_APP_AWS_REGION }}. This got me wondering if the specific name AWS_REGION is conflicting somewhere.

Shiti avatar Oct 11 '22 17:10 Shiti

I'm able to name it AWS_REGION, so it's interesting that fixed it for you. If you didn't have anything misconfigured (which could be a large number of things), I wonder what might've been the cause. Regardless, I'm glad you got it working! I wonder if this would help anyone else who runs into this down the line, if so I'd be interested to hear if renaming the secret worked for you.

peterwoodworth avatar Oct 11 '22 21:10 peterwoodworth

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Oct 17 '22 00:10 github-actions[bot]

Ran into the same problem today with AWS_REGION, renamed the secret and the reference in the workflow - worked for some reason.

sypste avatar Sep 18 '23 14:09 sypste

one small thing, always check your repo visibility, if it's public then it will not be able to access private secrets

ahmed-lotfy avatar Feb 11 '24 14:02 ahmed-lotfy

I faced same issue. But found the problem. It is my environment which I didn't pass.. haha

fahadbs23 avatar Jun 14 '24 05:06 fahadbs23