Can I use S3 modules with Terraform Cloud?

I’m trying to use an S3 module with Terraform Cloud and I’m running into some issues. Is this use case supported? I don’t want to spend any time debugging if not…

It should work Paul. Can you give us a little more context about the issues you’re running into now? I’d be happy to try to replicate.

Yes, I get this error:

Could not download module "prod_account" (accounts.tf:30) source code from
"s3://my-modules/v1.0.0/account.zip": RequestError: send request
failed
caused by: Get https://my-modules/v1.0.0/account.zip: dial tcp:
lookup my-modules on 127.0.0.53:53: server misbehaving

Is this a community module Paul?

While I can’t reproduce with what you’ve supplied it looks like the module’s source is local and so TFC doesn’t have the ability to retrieve it in order to use it.

Hey Paul, so I made a mistake here; TF doesn’t support using s3:// urls directly.

From @apparentlymart: (who kindly pointed me in the right direction)

We require a full URL that includes the regional hostname so we can request directly from the region where the data is stored, as described in https://www.terraform.io/docs/modules/sources.html#s3-bucke

Ah, I didn’t read the docs closely enough. Thanks

Hi,
After following the documentation properly I have put the following url:

s3::https://s3-us-west-2.amazonaws.com.terraformmoduleforreandeploy/aws_vpc/aws_vpc.zip

but still it is showing error:
Error downloading modules: Error loading modules: URL is not a valid S3 URL
my bucket name is terraformmoduleforreandeploy, and aws_vpc is a folder inside the bucket in which I have put my zip file.
It is unable to create even the .terraform folder.

other URLs I have tried are:
s3::https://s3.us-west-2.amazonaws.com.terraformmoduleforreandeploy/aws_vpc/aws_vpc.zip
s3::http://s3.us-west-2.amazonaws.com.terraformmoduleforreandeploy/aws_vpc/aws_vpc.zip
s3::http://s3-us-west-2.amazonaws.com.terraformmoduleforreandeploy/aws_vpc/aws_vpc.zip

I have exported the following input variables:
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY.
Using terraform version v0.11.6.