- Newest
- Most votes
- Most comments
CodeArtifact doesn't have native support for Terraform modules. However, you likely can store these in CodeArtifact.
Looking at the Terraform docs, Terraform can load tar.gz files from arbitrary URLs. You could push your .tar.gz to CodeArtifact as a Maven asset (see Publishing with curl), then put the CodeArtifact URL for the asset into the source =
line. You would also have to arrange for Terraform to pass a CodeArtifact authentication token which is likely possible using .netrc:
If an HTTP/HTTPS URL requires authentication credentials, use a .netrc file to configure the credentials. By default, Terraform searches for the .netrc file in your HOME directory. However, you can override the default filesystem location by setting the NETRC environment variable. For information on the .netrc format, refer to the documentation for using it in curl.
Another option would be to store the .tar.gz as a generic asset, use the AWS CLI to download it before you run Terrafom, and reference it as a local module, but not sure this is any better than putting the module in S3.
I haven't tried either option, so consider these as suggestions not working solutions.
Relevant content
- asked a year ago
- asked 2 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
I can get the *.tar.gz file into CodeArtifact just fine as part of a CodeBuild/CodePipeline process but I cannot seem to reference that generic *.tar.gz file that sits in CodeArtifact through a URL. In this case, the *.tar.gz happens to be a zipped Terraform module but it could be anything zipped up as a *.tar.gz. But, it does not seem like you can reference packages/resources that reside in CodeArtifact through a URL. Rather than CodeArtifact, you would have to rely on S3 if you wanted to stay within the AWS Ecosphere.
How did you publish the .tar.gz to CodeArtifact?