Skip to content

s3 module source does not support AWS_PROFILE authentication #38638

@matt-mercer

Description

@matt-mercer

Terraform Version

Terraform v1.12.2
on linux_amd64

Terraform Configuration Files

module "aws-metrics" {
  source = "s3::https://my-bucket/some-module-v1.0.21.zip"
}

Debug Output

 Error: Failed to download module
│ 
│   on main.tf line 255:
│  255: module "aws-metrics" {
│ 
│ Could not download module "aws-metrics" (main.tf:255) source code from
│ "s3::https://my-bucket/some-module-v1.0.21.zip": NoCredentialProviders: no valid
│ providers in chain
│ caused by: EnvAccessKeyNotFound: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment
│ SharedCredsLoad: failed to get profile
│ EC2RoleRequestError: no EC2 instance role found
│ caused by: RequestError: send request failed
│ caused by: Get "http://169.254.169.254/latest/meta-data/iam/security-credentials/": context deadline exceeded (Client.Timeout exceeded while
│ awaiting headers)

Expected Behavior

Creddentials provided using AWS_PROFILE environment variable should be used in authentication against s3 for module retrieval

Actual Behavior

Module source does not respect AWS_PROFILE

Steps to Reproduce

  1. terraform init

Additional Context

No response

References

No response

Generative AI / LLM assisted development?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions