Use Application Default Credentials to compile to `tf-gcp` target
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 215
- Avg merge
- 2h 9m
- Merged PRs (30d)
- 27
Description
Feature Spec
Currently Wing allows you to compile to tf-gcp target by manually exporting two env variables called GOOGLE_PROJECT_ID and GOOGLE_REGION, which is not ideal. We should instead follow the standard way to interact with the Google Cloud APIs, which is by using Application Default Credentials (ADC). This is also what HashiCorp docs recommend for the google provider.
The way it works is quite similar to AWS. You have two main options to set up credentials for your project:
-
You save a JSON file with your credentials locally and then export the
GOOGLE_APPLICATION_CREDENTIALSenv variable with the path to the file as its value. This is slightly different from AWS where you instead exportAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_DEFAULT_REGIONenv variables. -
You use the gcloud CLI to generate a JSON credentials file using the
gcloud auth application-default logincommand. This file gets stored at~/.config/gcloud/application_default_credentials.json. This is practically identical to what the AWS CLI does when using theaws configurecommand. This would generate a file at the~/.aws/credentialslocation.
ADC searches for credentials in the following order:
- Check if
GOOGLE_APPLICATION_CREDENTIALSenv variable is set. - Check if gcloud CLI credentials file exist at
~/.config/gcloud/application_default_credentials.json.
Use Cases
Follow the standard way to interact with Google Cloud APIs.
Implementation Notes
No response
Component
No response
Community Notes
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the tf-gcp compilation path and the handling of GOOGLE_PROJECT_ID and GOOGLE_REGION. Check the existing tf-gcp tests, if present, and trace how Google Cloud or Terraform provider configuration is assembled. Done means compilation supports GOOGLE_APPLICATION_CREDENTIALS and the gcloud ADC file location instead of requiring the two manual environment variables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, terraform
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100