Skip to content

Commit

Permalink
Improve docs on adding Google secrets in AWS Secrets Manager (apache#…
Browse files Browse the repository at this point in the history
…42832)

The [existing documentation](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/secrets-backends/aws-secrets-manager.html#example-of-storing-google-secrets-in-aws-secrets-manager) on how to set up Google secrets in AWS Secrets Manager is out of date. It led me on a merry chase for hours.

I hereby submit this PR to update the doc. I solemnly swear that the content has been verified using DAG code similar to this

```python
gsheet = GSheetsHook(gcp_conn_id=gcp_conn_id)
values = gsheet.get_values(
    spreadsheet_id=spreadsheet_id,
    range_=f"{sheet_name}!B1:B2",
)
`
  • Loading branch information
zachliu authored Oct 8, 2024
1 parent 5a146f7 commit b98c620
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,22 @@ For example, if you want to only lookup connections starting by "m" in AWS Secre
Example of storing Google Secrets in AWS Secrets Manager
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For connecting to a google cloud conn, all the fields must be in the extra field, and their names follow the pattern
``extra_google_cloud_platform__value``. For example:
For connecting to a google cloud connection, all the fields must be in the extra field. For example:

If you are using the key file:

.. code-block:: ini
{'key_path': '/opt/airflow/service_account.json',
'scope': 'https://www.googleapis.com/auth/devstorage.read_only'}
{"extra": {"key_path": "/opt/airflow/service_account.json",
"scope": "https://www.googleapis.com/auth/devstorage.read_only"}}
If you are using the key dictionary.

.. code-block:: ini
{"extra": {"keyfile_dict": "<copy & paste the service account json here>",
"scope": "https://www.googleapis.com/auth/devstorage.read_only"}}
Either way you can edit the ``Key/value`` pairs directly on the UI

.. image:: /img/aws-secrets-manager-gcp.png

0 comments on commit b98c620

Please sign in to comment.