I am attempting to use Terraform to download a raw file from a private repo. However I am getting a 404 error.
Logs:
null_resource.manifest: Destroying... [id=8131279658604839368]
null_resource.manifest: Destruction complete after 0s
null_resource.manifest: Creating...
null_resource.manifest: Provisioning with 'local-exec'...
null_resource.manifest (local-exec): Executing: ["/bin/sh" "-c" "curl --location --header 'PRIVATE-TOKEN: REDACTED' -O './.terraform/REDACTED/src/manifest.yml' https://gitlab.com/api/v4/projects/REDACTED/repository/files/src%2Fmanifest.yml/raw?ref=REDACTED"]
null_resource.manifest (local-exec): % Total % Received % Xferd Average Speed Time Time Time Current
null_resource.manifest (local-exec): Dload Upload Total Spent Left Speed
null_resource.manifest (local-exec): 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to port 80: Connection refused
null_resource.manifest (local-exec): 100 32 100 32 0 0 64 0 --:--:-- --:--:-- --:--:-- 64
null_resource.manifest (local-exec): {"message":"404 File Not Found"}
null_resource.manifest: Creation complete after 1s [id=5357322425754425058]
I'm not sure if the 404 is valid, or if the connection refused means I have the wrong endpoint/token/port?
I'm not sure why I'm getting the port 80 connection refused message. The URL is HTTPS and I am using --location
.
Use a lowercase -o
to specify the local file name.
Your uppercase -O
does not take an argument, and specifies that you want to use the remote filename when saving the output.
I presume that curl interprets './.terraform/REDACTED/src/manifest.yml'
as the first url to fetch rather than as a file name.
If you run your curl command with the -v
flag, you may see for yourself.