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

Add SSO configuration support to Terratest #1460

Open
kkrav3ts opened this issue Nov 1, 2024 · 3 comments
Open

Add SSO configuration support to Terratest #1460

kkrav3ts opened this issue Nov 1, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@kkrav3ts
Copy link

kkrav3ts commented Nov 1, 2024

Describe the solution you'd like
In order to run tests in CLI, I need to be logged in first. I use IAM Identity Center (SSO, not Legacy):

[default]
sso_session = gw-sso
sso_account_id = 123456789012
sso_role_name = AdminRole
region = us-east-1
output = json

[sso-session gw-sso]
sso_region = us-east-1
sso_start_url = https://company-abc.awsapps.com/start

Being successfully logged in, I run tests and get:

TestNetworkFirewall 2024-11-01T21:03:29+02:00 region.go:109: Looking up all AWS regions available in this account
--- FAIL: TestNetworkFirewall (0.00s)
    region.go:66: profile "default" is configured to use SSO but is missing required configuration: sso_region, sso_start_url
FAIL
FAIL    github.com/gruntwork-io/terraform-aws-vpc/test/vpc-app-natgw-eips       0.061s
FAIL

Basically, I'd wanted to ask to implement support for new implementation of IAM Identity Center (SSO) login: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html

Describe alternatives you've considered
With using Legacy IAM Identity Center, everything works fine:

[default]
sso_start_url = https://company-abc.awsapps.com/start
sso_region = us-east-1
sso_account_id = 123456789012
sso_role_name = AdminRole
region = us-east-1
output = json

Additional context
None

@kkrav3ts kkrav3ts added the enhancement New feature or request label Nov 1, 2024
@kkrav3ts kkrav3ts changed the title Add SSO configuration support Add SSO configuration support to Terratest Nov 1, 2024
@kkrav3ts
Copy link
Author

@ZachGoldberg alas I am not able to do it myself as it requires better Go understanding and Terratest structure. So I created this ticket to request assistance. Is it possible to re-assign it to someone who is good with Go and Terratest?

@wakeful
Copy link
Contributor

wakeful commented Nov 12, 2024

Hey,

It seems the issue you're facing is related to the underlying AWS SDK used by Terratest.

I was able to reproduce your issue on the master branch using my configuration.

[profile FullAdmin-1234567890]
sso_session = shadow
sso_account_id = 1234567890
sso_role_name = FullAdmin
region = eu-west-1
output = json

[sso-session shadow]
sso_start_url = https://1234567890.awsapps.com/start
sso_region = eu-west-1
sso_registration_scopes = sso:account:access

On the master branch, it fails, but it works fine in my fork with SDK v2.

Could I ask you to try run a test with the AWS SDK v2 branch?
We are currently working on merging and upgrading the AWS SDK to v2 in this PR #1451

You can point to my fork for now.

go mod init github.com/your-org/new-project
go mod edit -replace github.com/gruntwork-io/[email protected]=github.com/wakeful/[email protected]
go get github.com/gruntwork-io/terratest/modules/[email protected]

@kkrav3ts
Copy link
Author

@wakeful yes, it works as expected. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants