-
Notifications
You must be signed in to change notification settings - Fork 104
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
[WIP] New Feature: assume_role
connection config
#1845
[WIP] New Feature: assume_role
connection config
#1845
Conversation
@brittandeyoung Thanks for trying out Steampipe! As you are still working on it, please check the following docs for your reference
|
… role arn, duration, external_id, and session_name
assume_role
connection configassume_role
connection config
@rajlearner17 There have been more details in the issue around the reason for these suggested changes. The biggest reason is that it would be nice to avoid having to both manage the I have updated the PR with setting these configurations at the root config, but am looking at some suggestions on how we can make this a config block. |
assume_role
connection configassume_role
connection config
For awareness, I have the assume role configuration working. The last piece is the optional items under the |
aws/service.go
Outdated
@@ -1708,7 +1709,7 @@ func getBaseClientForAccount(ctx context.Context, d *plugin.QueryData) (*aws.Con | |||
// If we expire the cache regularly we are causing SSO sessions to end | |||
// prematurely, and causing the AWS SDK to refresh credentials more often | |||
// using the IDMS service etc. | |||
var getBaseClientForAccountCached = plugin.HydrateFunc(getBaseClientForAccountUncached).Memoize(memoize.WithTtl(time.Hour * 24 * 30)) | |||
var getBaseClientForAccountCached = plugin.HydrateFunc(getBaseClientForAccountUncached).Memoize(memoize.WithTtl(time.Second * 10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brittandeyoung Is there a reason you shortened the cache time, was this used just for testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbruno10 Yes this change was made for testing, I have reverted this change.
@@ -27,6 +27,14 @@ connection "aws" { | |||
# from an AWS credential file with the `profile` argument: | |||
#profile = "myprofile" | |||
|
|||
# If no credentials are specified, the plugin will use the AWS credentials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this example still correct, or does it follow the nested structure now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbruno10 Thank you, I had forgot to update the example after changing to a map for configuration. The example has now been updated.
IgnoreErrorCodes []string `cty:"ignore_error_codes"` | ||
EndpointUrl *string `cty:"endpoint_url"` | ||
S3ForcePathStyle *bool `cty:"s3_force_path_style"` | ||
Regions []string `hcl:"regions,optional"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brittandeyoung Referencing your most recent issue comment #1844 (comment), you mention using cty
, but here in the code I see all fields using hcl
instead.
How does the code currently behave? Does it not work in some scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbruno10 In the current state, the role_arn
loads in properly and assuming the role works as expected as it has the cty
tag.
Currently the remainder of the fields to not have the cty
tag. Without this tag, these items DO NOT load in from the config. This means these values are nil
.
If I add the cty
tag, the values do load in, but then are no longer optional and must be provided. If you do not provide them all, steampipe crashes and fails to load. If i attempt to add the optional
tag, steampipe crashes when attempting to load the config.
Any tips on direction from here is appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were able to reproduce the above issue -
Error: failed to start plugin 'hub.steampipe.io/plugins/turbot/aws@latest': failed to start 'hub.steampipe.io/plugins/turbot/aws@latest': failed to parse connection config for connection 'aws':
Unsuitable value type: Unsuitable value: attribute "external_id" is required
This could be an HCL parsing error - https://github.com/turbot/steampipe-plugin-sdk/blob/main/plugin/connection_config_schema.go#L88
I have raised a Steampipe SDK issue for the same with the details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brittandeyoung, please let us know if you are getting any other issues than the above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigdatasourav Great thanks! That was the only issue i was running into. I will keep an eye on this issue.
@brittandeyoung could you please tell me how you replace aws plugin on your local version to run? |
@opsanatoliy Using the
|
} | ||
|
||
var ConfigSchema = map[string]*schema.Attribute{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brittandeyoung Why did you remove this along with Schema: ConfigSchema,
in plugin.go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbruno10 This was done in order to support the map for assume_role
as the schema does not support map objects. The idea was to use tagging to dynamically pull in the settings.
I had this working with root level configurations instead of a map and utilizing the defined schema. Would this pull request be better to be reverted to using root level configurations instead of a map configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for highlighting this; I have raised a Steampipe SDK issue to track.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigdatasourav Great! This getting added to the SDK will likely enable me to complete this PR with working code. I will be sure to follow this issue.
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Closing the PR for now, since it is waiting on the resolution of the following SDK issues - |
I am new to contributing to this project so some guidance to make sure I follow the correct procedures would be appreciated. This pull request is currently a Work In Progress. I am attempting to add the ability to use the
assume_role
in the connection configuration in order to leverage role assumption when configuring a connection to an AWS account instead of having to provide aprofile
or a static set of credentials.I did not see any integration tests related to the creating and testing of the AWS connection itself for me to run.
Closes: #1844
Example config:
I was able to use this config to run successful queries