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

GCL_VARIABLE multiple key/value pairs not working #992

Open
thoefkens opened this issue Sep 22, 2023 · 10 comments
Open

GCL_VARIABLE multiple key/value pairs not working #992

thoefkens opened this issue Sep 22, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@thoefkens
Copy link

thoefkens commented Sep 22, 2023

Minimal .gitlab-ci.yml illustrating the issue

.terraform-format:
  stage: terraform-validate
  script:
    - terraform init
    - terraform fmt -check -diff -recursive

Expected behavior
When I run gitlab-ci-local, Terraform fails to initialise against an AWS S3 backend (bucket).
Normally this works fine when AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set correctly as env vars. (or in Gitlab itself in the CI CD Variables section).
I have tried setting them in GLC_VARIABLES but that has no effect.

Host information
MacOS
gitlab-ci-local 4.43.0

Containerd binary
Docker

BTW
Works fine when I put them into .gitlab-ci-local-variables but would like to use ENV VAR GLC_VARIABLES as I work with dotenv a lot so I would not need to define them in different locations.

@firecow
Copy link
Owner

firecow commented Sep 22, 2023

"I have tried setting them in GLC_VARIABLES but that has no effect"

Show us how you tried using GCL_VARIABLE

@firecow firecow added the elaborate Further elaboration is needed label Sep 22, 2023
@thoefkens
Copy link
Author

thoefkens commented Sep 22, 2023

I use a .envrc file where all environment variables get exported automatically once I go into my folder (where I run gitlab-ci-local).

export AWS_ACCESS_KEY_ID=xxxx
export AWS_SECRET_ACCESS_KEY=xxxx
export GLC_VARIABLES="AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=xxx"

@firecow
Copy link
Owner

firecow commented Sep 22, 2023

gitlab-ci-local --variable

It's called GCL_VARIABLE

@thoefkens
Copy link
Author

Oh my bad... Thank you!

@thoefkens thoefkens reopened this Sep 22, 2023
@thoefkens
Copy link
Author

Actually @firecow , it still does not work. I tried "GCL_VARIABLE" as you said, that does not work. I then tried "GCL_VARIABLES" and when I set that, and run gitlab-ci-local, I get the error:

❯ gitlab-ci-local
Unknown argument: variables

BTW, the documentation in the readme is wrong apparently, that is why I put GLC_VARIABLES in the first place because it is described like that there.
Thanks
Thomas

@ecourreges-orange
Copy link

I have the same problem, it looks to me like GCL_VARIABLE supports only one variable, GCL_VARIABLES doesn't exist, but if it did, it would solve the problem when you have more than one variable and need expansion, such as login + password.
Also one way to avoid all this would be to have variable expansion in .gitlab-ci-local-variables.yml for example
This would allow to have a proper local setup for everyone, overriding only a couple of user/pass/secret which are per user.

@firecow
Copy link
Owner

firecow commented Nov 24, 2023

I've fixed the documentation here e96e0ff

And yes, that needs fixing, sorry about that, will be fixed in a moment, if I can find the bug.
image

I've renamed the issue title, hope thats ok.

@firecow firecow added bug Something isn't working and removed elaborate Further elaboration is needed labels Nov 24, 2023
@firecow firecow changed the title Error initializing Terraform backend GCL_VARIABLE multiple key/value pairs not working Nov 24, 2023
@firecow
Copy link
Owner

firecow commented Nov 24, 2023

Found it, now I just need to come up with a fix.

image

@AbdulRashidReshamwala
Copy link

@firecow can we merge the draft pr

@firecow
Copy link
Owner

firecow commented Aug 1, 2024

@AbdulRashidReshamwala No, its in draft because its not ready yet 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants