Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't deploy because of Secrets issue #5752

Open
apassy opened this issue Apr 3, 2024 · 8 comments
Open

[Bug]: Can't deploy because of Secrets issue #5752

apassy opened this issue Apr 3, 2024 · 8 comments
Labels
guidance Issue requesting guidance or information about usage pending/question Further information is requested.

Comments

@apassy
Copy link

apassy commented Apr 3, 2024

Other Closed Issues related to tagging.

Description:

I'm trying to deploy a service that I previously deployed just fine, but I added a secrets section to the manifest, and now it's failing.

Details:

Copilot ver: 1.33.1
running on Windows 11
Load-balanced web app

Additional manifest lines:

secrets:                      
  adc_reader:
    secretsmanager: 'ReportWriter_ADC_DB'

Error:

  - [a7438eb0]: ResourceInitializationError: unable to pull secrets or reg
    istry auth: execution resource retrieval failed: unable to retrieve se
    cret from asm: service call has been retried 1 time(s): failed to fetc
    h secret arn:aws:secretsmanager:us-east-1:<ID REDACTED>:secret:ReportWr
    iter_ADC_DB from secrets manager: AccessDeniedException: User: arn:aws
    :sts::<ID REDACTED>:assumed-role/streamlit-sample-test-front-end-Execut
    ionRole-qXmoAXceH13T/a7438eb04296469cbb925934135fa489 is not authorize
    d to perform: secretsmanager:GetSecretValue on resource: arn:aws:secre
    tsmanager:us-east-1:<ID REDACTED>:secret:ReportWriter_ADC_DB because no
     identity-based policy allows the secretsmanager:GetSecretValue action
     status code: 400, request id: 53f8285a-ebbf-4208-8358-c011a9c0a9fc

Secrets are tagged with the copilot-application and copilot-environment and those match what I'm using.

Expected result:

expected successful deployment

@apassy apassy added the type/bug Issues that are bugs. label Apr 3, 2024
@al-dpopowich
Copy link

This has been reported in #5732. You need to give the full ARN of the secret, not just its name.

@apassy
Copy link
Author

apassy commented Apr 4, 2024

Same error when using the full ARN.

@Lou1415926
Copy link
Contributor

hey @apassy , please see my response here and see if it help clarify anything for you. In the meantime, can you try specifying the secret arn instead of just the name?

@Lou1415926 Lou1415926 added pending/question Further information is requested. guidance Issue requesting guidance or information about usage labels Apr 5, 2024
@apassy
Copy link
Author

apassy commented Apr 8, 2024

Tried with full ARN

secrets:                      # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
  adc_reader:
    secretsmanager: 'arn:aws:secretsmanager:us-east-1:<acct>:secret:ReportWriter_ADC_DB-<random>'
  dropbox_writer:
    secretsmanager: 'arn:aws:secretsmanager:us-east-1:<acct>:secret:DropboxReportWriter-<random>'
  infra_reader:
    secretsmanager: 'arn:aws:secretsmanager:us-east-1:<acct>:secret:ReportWriter_Infrastructure_DB-<random>'

    ✘ Latest 2 tasks stopped reason
      - [955086cd,9b359892]: ResourceInitializationError: unable to pull secre
        ts or registry auth: execution resource retrieval failed: unable to re
        trieve secret from asm: service call has been retried 1 time(s): secre
        ts manager: failed to retrieve secret from arn:aws:secretsmanager:us-e
        ast-1:<acct>:secret:arn:aws:secretsmanager:us-east-1:49115046704
        7:secret:ReportWriter_ADC_DB-<random>: unexpected ARN format with parame
        ters when trying to retrieve ASM secret

@h5aaimtron
Copy link

@apassy remove the _ and any - in the last segment of your secret.

@Lou1415926 we just had this issue where our copilot services could not access secrets where the last segment had a hyphen.
Example that didn't work: common/data/lookup-id
Example that did work common/data/lookupid

It appears if the hyphen is in a previous segment, but not the ending segment, it's fine such as:
Works fine: api-common/lookupid

No matter what you'll get an error about accessing the secret.

@dannyrandall dannyrandall removed the type/bug Issues that are bugs. label Apr 29, 2024
@ssyberg
Copy link

ssyberg commented May 8, 2024

I think this is still a bug, all my secrets are working fine in my first environment but now I'm seeing this error when trying to deploy to a new environment

@iamhopaul123
Copy link
Contributor

@ssyberg can you check if the secrets are properly tagged with copilot-application etc.? Are you using the same secrets for both envs?

@ssyberg
Copy link

ssyberg commented May 10, 2024

@ssyberg can you check if the secrets are properly tagged with copilot-application etc.? Are you using the same secrets for both envs?

It was totally the tagging, I missed that sentence in the docs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Issue requesting guidance or information about usage pending/question Further information is requested.
Projects
None yet
Development

No branches or pull requests

7 participants