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

Error when using profile + assume role #8

Closed
gregory-lecomte opened this issue Sep 29, 2023 · 2 comments
Closed

Error when using profile + assume role #8

gregory-lecomte opened this issue Sep 29, 2023 · 2 comments

Comments

@gregory-lecomte
Copy link

Hello,

I can't use the module when I want to use a profile + an assume role. The console return the following error :

╷
│ Error: External Program Execution Failed
│ 
│   with module.proxy_protocol_v2_https.data.external.awscli_program,
│   on .terraform/modules/proxy_protocol_v2_https/main.tf line 22, in data "external" "awscli_program":
│   22:   program = [format("%s/scripts/awsWithAssumeRole.sh", path.module)]
│ 
│ The data source received an unexpected error while attempting to execute the program.
│ 
│ Program: .terraform/modules/proxy_protocol_v2_https/scripts/awsWithAssumeRole.sh
│ Error Message: .terraform/modules/proxy_protocol_v2_https/scripts/awsWithAssumeRole.sh: 27: [-n: not found
│ 
│ Unable to locate credentials. You can configure credentials by running "aws configure".
│ 
│ Unable to locate credentials. You can configure credentials by running "aws configure".
│ 
│ State: exit status 1

Additionally, as you can see in the return message, there is an error line 27, some spaces are missing around brackets.

To fix temporary my issue, I had to add in the bash script the option "--profile" in sts assume command line to fix my issue with a variable "profile" in the variable.tf file.

But I think you can do better to take in consideration the option --profile when it's set or not.

Regards,

@rquadling
Copy link
Member

You can add --profile to the list of arguments you want to run. Slightly messy maybe, but as profile is part of the command line call, adding it makes sense.

e.g.

aws_cli_commands   = ["s3api", "list-objects", "--profile", "your-profile-name-here", "--bucket", "ryft-public-sample-data", "--no-sign-request"]

I can certainly add the option of using a profile argument.

And I'll also fix the lack of white space (VERY sorry about that!!!).

@rquadling
Copy link
Member

I've also added support for --region. Final testing and releasing shortly.

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

No branches or pull requests

2 participants