Setting container Build action buildargs to local....
# 🌱|help-and-getting-started
p
I'm getting an error when trying to pass some local environment variables to buildargs This works, passing in the actual username and key:
Copy code
buildArgs: {
    GITHUB_API_USER: username,
    GITHUB_API_KEY: api_key
  }
None of the combinations I'm trying work, eg:
Copy code
buildArgs:
    - GITHUB_API_USER: ${local.env.GITHUB_API_USER}
    - GITHUB_API_KEY: ${local.env.GITHUB_API_KEY}
this results in the error:
Copy code
Error validating spec for Build type=container name=policies: key .buildArgs must be of type object. Available keys: localId, publishId, targetStage, buildArgs, extraFlags, dockerfile, hotReload)
I'm not sure how I create an object that can be passed to buildargs using local env vars?
q
Hi @proud-river-11384 this looks like a formatting error. Try,
Copy code
yaml
buildArgs:
  GITHUB_API_USER: ${local.env.GITHUB_API_USER}
  GITHUB_API_KEY: ${local.env.GITHUB_API_KEY}
p
Yep that's the one. Thanks
q
Thanks for marking as resolved. I think that's the first time an end-user has done it for me. Appreciated 😄