joao-miranda opened a new issue, #31496:
URL: https://github.com/apache/airflow/issues/31496

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### What happened
   
   Airflow 2.5.1
   
   I've followed the instructions I found online, for example 
https://blog.beachgeek.co.uk/working-with-parameters-and-variables-in-amazon-managed-workflows-for-apache-airflow/
   I'm storing a variable encrypted by KMS in SecretsManager with name 
**airflow/variables/AAA.**
   
    
   This configuration is present in the Airflow Environment:
   ```
   secrets.backend | 
airflow.providers.amazon.aws.secrets.secrets_manager.SecretsManagerBackend
   secrets.backend_kwargs | { "connections_prefix": "airflow/connections", 
"variables_prefix": "airflow/variables" }
   ```
   
   Airflow IAM user has full KMS and SecretsManager permissions.
   
   Trying to get the value from the code like this is not working:
   ```
   AAA = Variable.get('AAA')
   ```
   
   The DAG import fails with this error:
   ```
   Broken DAG: [/usr/local/airflow/dags/pipeline.py] Traceback (most recent 
call last):
     File "/usr/local/airflow/dags/pipeline.py", line 14, in <module>
       AAA = Variable.get('AAA')
     File 
"/usr/local/airflow/.local/lib/python3.10/site-packages/airflow/models/variable.py",
 line 141, in get
       raise KeyError(f"Variable {key} does not exist")
   KeyError: 'Variable AAA does not exist'
   ```
   
   ### What you think should happen instead
   
   Value should be retrieved from Secrets Manager
   
   ### How to reproduce
   
   The above code in MWAA should replicate the same behaviour.
   
   ### Operating System
   
   AWS
   
   ### Versions of Apache Airflow Providers
   
   AWS MWAA (Apache Airflow 2.5.1)
   
   ### Deployment
   
   Amazon (AWS) MWAA
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to