Can't use dotenv to share passwords between stages

I’m trying to build a multi stage pipeline in gitlab.com that uses terraform to create an Azure Container Registry and then push a docker image to to the registry. How should I pass the password generated by the ACR to the docker stage that needs to login to the ACR to push images?

I’m trying to use dotenv by using a terraform local-exec provisioner to write the ACR URL, username and password to a build.env file with content similar to this:

DOCKER_REGISTRY=“demo6a36.azurecr.io
DOCKER_USERNAME=“demo6a36”
DOCKER_PASSWORD=“QpasdfrrhqpXUxsvTkOSMh=Yf32lwFn6”

Then uploading this to share the login credentials with subsequent stages in the pipeline using:

artifacts:
reports:
dotenv: build.env

But this generates the error:

WARNING: Uploading artifacts as “dotenv” to coordinator… failed id=1368261673 responseStatus=400 Bad Request status=400 token=jB6S5S_f

I’ve seen similar issue mentioned on the forum that suggest that this is because the dotenv validator doesn’t like values that contain ‘=’ which is the case for the ACR generated password.

In that case how can I pass passwords and tokens generated by terraform jobs that might include a ‘=’ char between stages in a gitlab pipeline?

Thanks