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

GCP auth and Terraform Cloud #73

Open
azhurbilo opened this issue Mar 23, 2023 · 1 comment
Open

GCP auth and Terraform Cloud #73

azhurbilo opened this issue Mar 23, 2023 · 1 comment

Comments

@azhurbilo
Copy link

Thnx for your provider, locally it works great for Google Cloud SQL instances using IAM auth 👍

locally it works because it uses https://cloud.google.com/docs/authentication/application-default-credentials#personal

but in Terraform Cloud it's not possible to pass files as credentials, only environment variables

problem that GOOGLE_APPLICATION_CREDENTIALS requires path to file (not a content of file)

You can use the GOOGLE_APPLICATION_CREDENTIALS environment variable to provide the location of a credential JSON file.

GOOGLE_CREDENTIALS env vars is possible to set in Terraform cloud but this provider doesn't handle it

Maybe you have idea how we can pass credentials as ENV var to this provider (not credentials as file)?

Terraform Version

1.3.6

Affected Resource(s)

Please list the resources as a list, for example:

  • provider "mysql" itself

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

provider "mysql" {
  endpoint = "cloudsql://***"
  username = "***"
  password = "***"
}

Expected Behavior

Ability to use "mysql" provider in Terraform Cloud

Actual Behavior

Error: failed to register driver failed to create token source: google: error getting credentials using GOOGLE_APPLICATION_CREDENTIALS environment variable: open *****: no such file or directory

Steps to Reproduce

Use "mysql" provider in environment where it's not possible to use files, only environment variables

@petoju
Copy link
Owner

petoju commented Mar 25, 2023

This is technically possible by providing some defaults to cloudsql.RegisterDriver when they are given (possibly by environment variables or provider configuration).

Would you write a pull request? That would work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants