Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get s3:: modules with AWS SSO #34767

Open
endzyme opened this issue Mar 5, 2024 · 3 comments
Open

Cannot get s3:: modules with AWS SSO #34767

endzyme opened this issue Mar 5, 2024 · 3 comments
Labels
bug new new issue not yet triaged upstream v1.7 Issues (primarily bugs) reported against v1.7 releases

Comments

@endzyme
Copy link

endzyme commented Mar 5, 2024

Terraform Version

Terraform v1.7.4
on linux_amd64

Terraform Configuration Files

module "cluster" {
  source = "s3::https://s3.amazonaws.com/redacted-s3-bucket-name/some-module-name.tar.gz"

  ...
}

module "workers" {
  source = "s3::https://s3.amazonaws.com/redacted-s3-bucket-name/some-module-name.tar.gz"

  ...
}

Debug Output

$> TF_LOG=debug tf get -update
2024-03-04T21:34:57.178-0700 [INFO]  Terraform version: 1.7.4
2024-03-04T21:34:57.178-0700 [DEBUG] using github.com/hashicorp/go-tfe v1.41.0
2024-03-04T21:34:57.178-0700 [DEBUG] using github.com/hashicorp/hcl/v2 v2.19.1
2024-03-04T21:34:57.178-0700 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-03-04T21:34:57.178-0700 [DEBUG] using github.com/zclconf/go-cty v1.14.1
2024-03-04T21:34:57.178-0700 [INFO]  Go runtime version: go1.21.5
2024-03-04T21:34:57.178-0700 [INFO]  CLI args: []string{"/User/someone/path/.tfenv/versions/1.7.4/terraform", "get", "-update"}
2024-03-04T21:34:57.178-0700 [DEBUG] Attempting to open CLI config file: /User/someone/path/.terraformrc
2024-03-04T21:34:57.178-0700 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-03-04T21:34:57.178-0700 [INFO]  Loading CLI configuration from /User/someone/path/.terraform.d/credentials.tfrc.json
2024-03-04T21:34:57.178-0700 [DEBUG] checking for credentials in "/User/someone/path/.terraform.d/plugins"
2024-03-04T21:34:57.178-0700 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-03-04T21:34:57.178-0700 [DEBUG] will search for provider plugins in /User/someone/path/.terraform.d/plugins
2024-03-04T21:34:57.179-0700 [DEBUG] ignoring non-existing provider search directory /User/someone/path/.local/share/terraform/plugins
2024-03-04T21:34:57.179-0700 [DEBUG] ignoring non-existing provider search directory /User/someone/path/.local/share/flatpak/exports/share/terraform/plugins
2024-03-04T21:34:57.179-0700 [DEBUG] ignoring non-existing provider search directory /var/lib/flatpak/exports/share/terraform/plugins
2024-03-04T21:34:57.179-0700 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2024-03-04T21:34:57.179-0700 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2024-03-04T21:34:57.179-0700 [DEBUG] ignoring non-existing provider search directory /var/lib/snapd/desktop/terraform/plugins
2024-03-04T21:34:57.179-0700 [INFO]  CLI command args: []string{"get", "-update"}
2024-03-04T21:34:57.182-0700 [DEBUG] Module installer: begin cluster
Downloading s3::https://s3.amazonaws.com/redacted-s3-bucket-name/some-module-name.tar.gz for cluster...
2024/03/04 21:34:57 ERROR: failed to create session with AWS_SDK_LOAD_CONFIG enabled. Use session.NewSession to handle errors occurring during session creation. Error: profile "REDACTED" is configured to use SSO but is missing required configuration: sso_region, sso_start_url
2024-03-04T21:34:57.184-0700 [DEBUG] Module installer: begin workers
Downloading s3::https://s3.amazonaws.com/redacted-s3-bucket-name/some-module-name.tar.gz for workers...
2024/03/04 21:34:57 ERROR: failed to create session with AWS_SDK_LOAD_CONFIG enabled. Use session.NewSession to handle errors occurring during session creation. Error: profile "REDACTED" is configured to use SSO but is missing required configuration: sso_region, sso_start_url
╷
│ Error: Failed to download module
│
│   on main.tf line 5:
│    5: module "cluster" {
│
│ Could not download module "cluster" (main.tf:5) source code from "s3::https://s3.amazonaws.com/redacted-s3-bucket-name/some-module-name.tar.gz": profile "REDACTED" is
│ configured to use SSO but is missing required configuration: sso_region, sso_start_url
╵

╷
│ Error: Failed to download module
│
│   on main.tf line 25:
│   25: module "workers" {
│
│ Could not download module "workers" (main.tf:25) source code from "s3::https://s3.amazonaws.com/redacted-s3-bucket-name/some-module-name.tar.gz": profile
│ "REDACTED" is configured to use SSO but is missing required configuration: sso_region, sso_start_url

Expected Behavior

Should support profiles configured with: https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html

Actual Behavior

Only supports profiles configured with: https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-legacy.html

Steps to Reproduce

  1. Put a module in s3
  2. Try to download it when using an AWS IAM Identity Center profile configured with refreshable tokens

Additional Context

I believe the issue is similar to #32465

References

No response

@endzyme endzyme added bug new new issue not yet triaged labels Mar 5, 2024
@crw
Copy link
Collaborator

crw commented Mar 5, 2024

As I believe this functionality relies on go-getter, it is likely related to:
hashicorp/go-getter#323

@crw crw added the upstream label Mar 5, 2024
@endzyme
Copy link
Author

endzyme commented Mar 6, 2024

As I believe this functionality relies on go-getter, it is likely related to: hashicorp/go-getter#323

Anything I can help with to get this updated @crw?

@crw
Copy link
Collaborator

crw commented Mar 7, 2024

@endzyme Unfortunately not. go-getter is essentially frozen except in exceptional circumstances. There are a number of open AWS issues (hashicorp/go-getter#467, hashicorp/go-getter#457). I am linking these via this comment on the off chance they can be resolved together, if the SDKv2 issue gets resolved. Thanks!

@apparentlymart apparentlymart added the v1.7 Issues (primarily bugs) reported against v1.7 releases label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug new new issue not yet triaged upstream v1.7 Issues (primarily bugs) reported against v1.7 releases
Projects
None yet
Development

No branches or pull requests

3 participants