Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to add support for custom S3 endpoints and improve testing capabilities. The most important changes include updates to the workflow configuration, the main application logic, and the S3 state reading functionality.
Workflow Configuration:
.github/workflows/test.yml
: Updated the Go version matrix to include1.23
and added MinIO service configuration for local S3 testing. Environment variables for MinIO are also set for the build and test steps. [1] [2]Application Logic:
cmd/tfstate-lookup/main.go
: Added a new command-line flags3-endpoint-url
to specify a custom S3 endpoint URL. Set the corresponding environment variable if the flag is provided. [1] [2]S3 State Reading:
tfstate/lookup.go
: Modified thereadS3
function to accept and use a custom S3 endpoint URL from the environment variable. Updated theS3Option
struct to includeEndpoint
.tfstate/remote_s3.go
: Refactored the S3 option handling to includeAccessKey
,SecretKey
, andEndpoint
. Added support for static credentials and custom endpoints in the S3 client configuration. [1] [2] [3]Testing:
tfstate/remote_s3_test.go
: Added a new testTestReadS3
to verify reading from an S3 bucket using a custom endpoint. [1] [2]