ansible-collections / ansible-collections/google.cloud
Native type of authentication
- Dominant language
- Python
- Stars
- 105
- Forks
- 144
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 4
Description
##### SUMMARY
Case:
The same scripts are used in two different environments:
- in CI/CD environment
- locally on the developers' laptops
Service accounts in the CI/CD environment are used for authorization. This is now supported.
For local use, it is better to use `gcloud auth login`, because such access is easier to revoke.
Service account management is very expensive to issue to developers.
The suggestion is to use the capabilities of method `google.auth.default()` by default.
File `~/.config/gcloud/application_default_credentials.json` will be used by default.
We can also pass the path to the service account in the environment variable `GOOGLE_APPLICATION_CREDENTIALS`.
##### ISSUE TYPE
- Feature Idea
##### COMPONENT NAME
- gcp_utils.py
##### ADDITIONAL INFORMATION
Example with `auth_kind: native`.
The path to the Service Account JSON file is taken from `GOOGLE_APPLICATION_CREDENTIALS` in a CI/CD environment.
Or a user account via a web-based authorization flow is used for local run.
```yaml
- name: create a object
google.cloud.gcp_storage_object:
action: download
bucket: ansible-bucket
src: modules.zip
dest: "~/modules.zip"
project: test_project
auth_kind: native
```
Contributor guide
Research direction
Start by reading gcp_utils.py and the existing authentication handling around the Google client. Check how google.auth.default() resolves local credentials and GOOGLE_APPLICATION_CREDENTIALS, then compare that with the auth_kind: native example. Done means native authentication works for both local user credentials and CI/CD service-account credentials.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible, google-cloud, python
- Domain
- authentication, cloud, devops
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100