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

platform default to linux #26

Open
bdelv opened this issue Feb 5, 2020 · 4 comments
Open

platform default to linux #26

bdelv opened this issue Feb 5, 2020 · 4 comments
Labels
enhancement New feature or request P2 high priority issues triaged Scoped and ready for work

Comments

@bdelv
Copy link

bdelv commented Feb 5, 2020

When used indirectly (like when creating a project using terraform-google-project-factory), the platform variable of the gcloud module is not accessible, so its default to linux is problematic if using a mac (yes, docker is better, but still :) ).

some ideas:

  • skip_download could be renamed to something like skip_download_if_gcloud_found and defaulted to true
  • there could be an attempt to detect the OS if the platform is empty (default "") with something like:
if [[ $(uname -s) == "Darwin" ]]; then echo "darwin" ; else echo "linux" ; fi
@morgante
Copy link
Contributor

morgante commented Feb 5, 2020

I think attempting to detect the OS if platform is empty is a good idea. A check like you suggested should work for Darwin and Linux and sounds like a good first step.

@morgante morgante added enhancement New feature or request triaged Scoped and ready for work P2 high priority issues labels Feb 5, 2020
@smathalikunnel
Copy link

any idea when this will be fixed?

@morgante
Copy link
Contributor

morgante commented Jun 2, 2020

@bdelv Were you still planning to finish out #30?

@bdelv
Copy link
Author

bdelv commented Jun 2, 2020

Sorry, I've left that on the side for too long. I got used to use Docker, then I got dragged away from Terraform.
I can probably work on it by the end of the week if it's fine for you.

@smathalikunnel In the meantime, you can bypass the problem by using docker
The way I'm bypassing it when i'm on MAC is to:

  • create a service account with enough rights
  • save it in JSON format
  • define a SERVICE_ACCOUNT_JSON env var like this
    export SERVICE_ACCOUNT_JSON=$(< ~/.credentials/name-of-sa.json)
  • copy the makefile defined in most terraform-google repos into your own repo then
    make docker_run
    you will have access to terraform in a linux env, so the right gcloud SDK will be used

Writing that, I realised that it will be better to fix the issue. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 high priority issues triaged Scoped and ready for work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants