Hi everyone, I’m getting an access token error whe...
# general
q
Hi everyone, I’m getting an access token error when running pulumi—but only within github actions
Copy code
error: PULUMI_ACCESS_TOKEN must be set for login during non-interactive CLI sessions
We’re using an S3 bucket for state, so it shouldn’t need the access token. According to the docs, pulumi “automatically perform a
pulumi login
command” when running in a CI service—I think this is what’s failing. However, we’re not using pulumi cloud—we’re using an S3 backend, listed in Pulumi.yaml:
Copy code
backend:
  url: '<s3://pulumi-state.swmdigital.io>'
I’ve tried adding a
pulumi login
command to the workflow, but that fails with the same error
Copy code
pulumi login --cloud-url <s3://pulumi-state.swmdigital.io>
Can anyone see what I’m doing wrong?
welp, I fixed it, but I’m not sure how Previously I was using xargs to target specific resources:
Copy code
pulumi stack export | jq -r '.deployment.resources[] | select(.type == "pulumi:providers:azuread") | .urn' | xargs printf -- "--target '%s'\n" | xargs pulumi up --refresh --yes --non-interactive
(I’m trying to automate the workaround for this) I changed it to use a for loop instead, and suddenly it works as expected:
Copy code
for URN in $(pulumi stack export | jq -r '.deployment.resources[] | select(.type == "pulumi:providers:azuread") | .urn' ); do
  pulumi up --refresh --yes --non-interactive --target "${URN}"
done
not sure why xargs would make a difference; I’ve probably just made a mistake I can’t see—the for loop is easier to understand
🤷
1009 Views