Commit Graph
63 Commits
Author SHA1 Message Date
Louis Ruch 01f8da94e4 feat(host): add catalog attribute to only sync instance primary addresses (#71)
* feat(host): add catalog attribute to only sync instance primary
addresses
2026-05-27 13:12:34 -07:00
aditya2548 241901319d feat: add ListObjects method & relevant e2e tests 2026-05-14 14:55:01 -05:00
hashicorp-copywrite[bot] 5b7b669b41 [COMPLIANCE] Add/Update Copyright Headers (#68)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2026-05-11 22:37:05 -07:00
oss-core-libraries-dashboard[bot]andhashicorp-copywrite[bot] 4758d5d9cd [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 1) (#64)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2026-01-16 15:56:19 -08:00
Emilia 42e2126217 fix: Allow shared credentials in GenerateCredentialChain (#63)
* allow shared creds

* fix non-const printf format strings for go 1.24

* add .env and .envrc to .gitignore
2025-12-04 12:46:02 -05:00
daniandDanielle Miu a75ac95465 Implement NormalizeStorageBucketData and begin normalizing endpoint URLs (#58)
Co-authored-by: Danielle Miu <29378233+DanielleMiu@users.noreply.github.com>
2025-03-14 15:19:20 +00:00
Louis Ruch bdd27e2562 feat(storage): Add s3Client cache (#55)
* feat(storage): Add s3Client cache

* Update awsutil deps
2024-11-25 21:32:37 -08:00
Damian Debkowski 899c62ce06 feat: support dual stack requests for aws clients (#52)
* feat: enable dual stack in aws clients

* refactor: optionally set custom endpoint resolver

* feat: update sts & iam client to utilize dualstack

* update aws dependencies to remove role policy bug
2024-10-28 11:50:18 -07:00
Louis Ruch ce22c1c46a Refactor error messages to include aws error details (#53)
* refactor error messages to include aws error details

* update deps
2024-10-21 09:55:51 -07:00
Hugo 2f9163ad0e docs(host): Add newly supported attributes 2024-10-03 18:19:49 +01:00
Hugo 5f96422fbf chore(credential): Remove required arg from GetCredentialsConfig 2024-09-23 18:07:32 +01:00
Hugo 4dac4498d3 feat(service): Add support for host plugin AssumeRole
This commit also introduces a new dry run validation step when creating
or updating a host catalog. Additionally, it introduces new tests
related to using AssumeRole credentials, as well as more error and
success state cases.

service/host/plugin.go now closely follows service/storage/plugin.go.
This is by design as to bring both "halves" of the AWS plugin into
parity with each other.
2024-09-23 18:07:32 +01:00
hashicorp-copywrite[bot] 9af0110945 [COMPLIANCE] Add Copyright and License Headers (#47)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2024-07-24 11:50:06 -04:00
Elim Tsiagbey c2e7c94f9c fix: Append list error for permission validation (#48)
* fix: Append list error for permission validation

Instead of returning the error right away, append the error when `ListObject` is successful but the key expected if not found. Set the `Read` permission state as `Unknown` if the response from the list calls does not find the expected key.

This can be caused if the credentials do not have `s3:PutObject` but have `s3:ListBucket`. Without `s3:PutObject`, the object will not be written to S3 so other calls to find the object will not be successful even if they have valid permissions.

This prevents us from returning a `write` error on Boundary because the list call will always fail. Without this, the  Permissions are not wrapped and the SBC states are all set to `unknown` even though we know certain permission failed.
2024-07-24 11:48:14 -04:00
daniandDamian Debkowski 5add0a1b53 Worker storage bucket credential state (#46)
* feat: parse generic aws api errors

* feat: parse s3 api errors

* feat: return credential state for all status errors

* fix status codes on certain http error codes and re-enable two tests

* switch code to FailedPrecondition

* update certain error codes

* update go.mod for new sdk version

---------

Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2024-07-17 15:37:27 -04:00
Hugo 88798fb76b fix(plugin): Panic in tests if err variable is nil 2024-07-15 16:27:00 +01:00
Hugo 5626a997c8 fix(plugin): Remove AWS region validation
The check in `PartitionForRegion` was a static check against a list of
known regions. This would cause an error if the SDK was not up-to-date.
2024-07-15 16:27:00 +01:00
Hugo 282935aa79 chore(README): Fix Endpoint URL attribute 2024-02-07 23:18:49 +00:00
dani 050357f367 add DeleteObjects command to plugin (#38) 2023-12-15 19:12:35 +01:00
Damian DebkowskiandHugo fcfe267a3f refactor: switch from awsutil to awsutilv2 (#34)
* fix(storage): Storage Assume Role Support

This commit introduces fixes to enable operators to use AWS dynamic
credentials on the storage side of this plugin, namely validation,
improved credential lifecycle management to allow for storage buckets to
be updated from static to dynamic credentials and vice versa, and a new
way to determine credential types.

It also introduces new tests for dynamic credential usage for the
various functions.

* fix(storage): Static rotated creds being deleted on plugin err

On Storage Bucket update, when we determine if the credentials are to be
updated to new ones, we call `credState.ReplaceCreds`.

This call, if the old credentials were managed by us (rotated at create
time), will delete the old credentials and set the new ones onto
credState.

We called this function without validating if the incoming credentials
are valid. This could get the bucket in a state where where, while we'd
return an update error if the incoming credentials weren't working with
S3 (err in the dry run process that happens at the end of the update),
we'd also silently delete the old credentials the bucket used, rendering
the bucket completely broken.

---------

Co-authored-by: Hugo <hugoamvieira@users.noreply.github.com>
2023-09-22 12:26:08 -07:00
Damian Debkowski 03e5368b71 fix(host): catch dry run validation error (#31) 2023-07-19 10:56:30 -07:00
Damian Debkowski 07f015be28 feat: assume role provider credentials (#28)
* feat: assume role provider credentials

This commit updates the awsutil dependency to its latest version, which
supports the capability of using dynamic credentials. The storage service
was refactored to make static credentials optional. The credentials pkg
was refactored to support several attribute fields used for the assume
role provider. The host service still enforces the use of static
credentials.
2023-07-18 16:33:24 -07:00
Damian Debkowski 334732967d chore: host plugin import aws-sdk-go-v2 (#27) 2023-07-04 11:03:24 -07:00
Damian Debkowski 7bf9fe2ecf chore: fix credential rotation reference in readme (#25) 2023-06-05 09:53:19 -07:00
hashicorp-copywrite[bot] c6687840d5 [COMPLIANCE] Add Copyright and License Headers (#26)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-06-05 09:52:48 -07:00
Louis Ruch 62e885a802 chore: Rename module to drop host element (#24) 2023-06-02 08:55:14 -07:00
Damian Debkowski 010b9df595 feat(plugin): add support for storage service 2023-05-30 15:26:19 -04:00
Damian DebkowskiandMichael Li 46c53fb94a refactor: organize plugin to support multiple services (#1)
Co-authored-by: Michael Li <michael.li@hashicorp.com>
2023-04-30 23:30:08 -07:00
Hugo c235f0a72f feat(plugin): Support extracting AWS instance name (#21) 2023-04-17 11:00:12 +01:00
hashicorp-copywrite[bot] cef41e852e [COMPLIANCE] Add Copyright and License Headers 2023-01-03 22:03:42 +00:00
Jeff Mitchell 54e680e942 Add region into IAM clients as well as EC2 clients (#18) 2022-09-02 14:35:34 -04:00
Jeff Mitchell edc129991f Update option handling in EC2Client and add custom HTTP client (#17) 2022-09-01 15:25:14 -04:00
Jeff Mitchell 7256300997 Update some deps and fix tests; add set attr normalization (#16) 2022-08-19 00:42:19 -04:00
Haotian 5ebf2fa5d0 refactor(errors): update plugin errors to include error codes 2022-03-10 11:00:57 -08:00
Chris Marchesi 7a07ac42c0 add default address/DNS check/add for interface, not just whole instance 2021-12-06 11:40:44 -08:00
Chris Marchesi 13469e3594 plugin: add DNS names
This adds DNS names to the output for host queries.

Hosts are discovered in private, then public order, first at the
top-level, and then through attached network interfaces. This mirrors
the discovery order of IP addresses.
2021-12-03 13:24:48 -08:00
Chris Marchesi 3e2f459f04 Remove unknown field assertion from awsCatalogPersistedStateFromProto 2021-11-22 16:16:24 -08:00
Chris Marchesi f22e129d92 Switch attribute getters to use GetFields/AsInterface from AsMap 2021-11-22 16:11:33 -08:00
Chris Marchesi 5777870592 e2e ListHosts test was working off multiple sets with a single tag 2021-11-18 11:18:32 -08:00
Chris Marchesi 07270a7457 plugin: add unknown attr checks, fix E2E test
This adds checks for unknown attributes through the entire plugin
lifecycle for all attributes, secrets, and persisted state.

It also fixes the E2E test which seems to have drifted.
2021-11-16 17:29:17 -08:00
Chris Marchesi 38bcd34baf plugin: Remove TODO from E2E test covering rotated -> not rotated
...when no new credentials are supplied. This was initially not covered
when the E2E tests were written but was added later once we the mocks
necessary to do unit testing to get error coverage.
2021-11-15 15:26:15 -08:00
Jeff Mitchell 1c7bacafa7 Handle the case where an incoming filter is a string (#4)
Ideally we'd ensure that an incoming filter is a string, but some
clients, such as the CLI, don't have a good way to require this without
it being very onerous to the user.

Eventually we can handle this via allowing the plugin to declare a
schema and perform type validation in the handler, but for now, work
around this within the plugin.
2021-11-12 19:47:46 -05:00
Todd Knight 563a2b9931 Don't return nil, nil but instead return an empty response. 2021-11-10 15:41:23 -07:00
Jeff Mitchell 1de471d9c7 Update filters to new, http.proto-compatible format (#2)
This updates the filtering logic to use the new format that doesn't
clash with http.proto rules for attributes used by grpc-gateway.
2021-11-03 21:21:27 -04:00
Chris Marchesi 9099292d03 Don't ignore non-running instances, rely on filter instead
We now add the instance-state = ["running"] filter to all queries if
instance-state is not explicitly defined beforehand. This should ensure
that all queries return running instances beforehand (saving some
post-processing later too).

As such, I'm removing an artifact of the old code where we were not
doing this, which was basically to skip all running instances.

Additionally, this will allow an operator to include non-running
instances in a filter should this be desired for whatever reason.
2021-10-07 14:15:32 -07:00
Chris Marchesi 9a5e4016fa most of the remaining unit testing added 2021-10-07 12:40:55 -07:00
Chris Marchesi 00907f72cc more error coverage 2021-10-06 16:53:11 -07:00
Chris Marchesi 6d9338d8a0 more error test coverage 2021-10-06 12:47:05 -07:00
Chris Marchesi a7401ef2d5 More unit testing and addins of mocks from awsutil 2021-10-05 16:36:53 -07:00
Chris Marchesi f7c5709046 WIP - more unit testing 2021-09-30 17:05:30 -07:00