我正在尝试使用 Terraform 从私有存储库下载原始文件。但是我收到了 404 错误。
日志:
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]
我不确定 404 是否有效,或者连接被拒绝是否意味着我有错误的端点/令牌/端口?
我不知道为什么会收到端口 80 连接被拒绝的消息。 URL 是 HTTPS,我使用的是 --location
。
答案 0 :(得分:0)
使用小写的 -o
指定本地文件名。
您的大写 -O
不带参数,并指定您在保存输出时要使用远程文件名。
我认为 curl 将 './.terraform/REDACTED/src/manifest.yml'
解释为要获取的第一个 url 而不是文件名。
如果您使用 -v
标志运行 curl 命令,您可能会亲眼看到。