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

aws secrets provider #153

Merged
merged 7 commits into from
Feb 16, 2024
Merged

aws secrets provider #153

merged 7 commits into from
Feb 16, 2024

Conversation

salamonpavel
Copy link
Collaborator

@salamonpavel salamonpavel commented Feb 2, 2024

Reads credentials from AWS Secrets Manager.
Closes #107

Copy link

github-actions bot commented Feb 2, 2024

JaCoCo agent module code coverage report - spark:2 - scala 2.12.18

Overall Project NaN% NaN% 🍏

There is no coverage information present for the Files changed

Copy link

github-actions bot commented Feb 2, 2024

JaCoCo server module code coverage report - scala 2.13.11

Overall Project 65.14% -23.26%
Files changed 35.31%

File Coverage
AwsConfig.scala 100% -1961.54%
AwsSecretsProviderImpl.scala 86.67% -153.33%
TransactorProvider.scala 0% -850%
Main.scala 0% 🍏

val layer: ZLayer[Any, Config.Error, AwsSecretsProviderImpl] = ZLayer {
for {
awsConfig <- ZIO.config[AwsConfig](AwsConfig.config)
} yield new AwsSecretsProviderImpl(SecretsManagerClient.builder().region(Region.of(awsConfig.region)).build())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the fact that you used the region from the config file, very awesome!!!

# Conflicts:
#	project/Dependencies.scala
#	server/src/main/resources/reference.conf
#	server/src/main/scala/za/co/absa/atum/server/Main.scala
Copy link

JaCoCo agent module code coverage report - scala 2.12.18

Overall Project NaN% NaN% 🍏

There is no coverage information present for the Files changed

Copy link

JaCoCo model module code coverage report - scala 2.12.18

Overall Project NaN% NaN% 🍏

There is no coverage information present for the Files changed

@@ -10,6 +10,10 @@
# maximum number of connections that HikariCP will keep in the pool, including both idle and in-use connections
maxPoolSize=10
}
aws {
region = "af-south-1"
serviceUserSecretKey = "serviceUserSecretKey"
Copy link
Collaborator

@lsulak lsulak Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would definitely mention DB here. This is for secret for accessing database

Suggested change
serviceUserSecretKey = "serviceUserSecretKey"
secretNameForDBServiceUserPwd = "changeme"

or something like that..or

Suggested change
serviceUserSecretKey = "serviceUserSecretKey"
postgresPwdSecretName = "changeme"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually not entirely sure I like this to be here, as I think that it's closer to the DB. But I understand that we might have more AWS stuff and it can belong close to each other for having better visibility of what's used from AWS...but hmm on the other hand, if working with the DB, such config-using code would be using other unrelated things, such as config for SSM or so...

I guess I'm fine with this currently

Copy link
Collaborator Author

@salamonpavel salamonpavel Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it wasn't obvious it's related to a database. And as you mentioned, it's difficult to foresee how things will evolve, what sort of AWS services we will be using. And even then we will face the dilemma of whether to group it by aws service or by technology. Anyway I have changed the parameter to dbPasswordSecretName as I think it makes it clear and still isn't crazy long. Hope that's acceptable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is, thanks it looks better :)

Copy link
Collaborator

@lsulak lsulak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the config name for the DB's PWD in AWS Secrets Manager, it looks really good and fully functional.

  • code reviewed
  • pulled
  • built
  • ran tests
  • ran on localhost with real configuration, created partitioning against local server and checked DEV DB - it all worked very nicely end to end

Copy link
Collaborator

@lsulak lsulak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go!

@salamonpavel salamonpavel merged commit b366d9b into master Feb 16, 2024
9 of 10 checks passed
@salamonpavel salamonpavel deleted the feature/credentials branch February 16, 2024 08:19
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

Successfully merging this pull request may close these issues.

Server -> DB: Add pulling DB login credentials via AWS Secrets
3 participants