Open
Conversation
Signed-off-by: Peter Hrvola <peter.hrvola@gmail.com>
Contributor
|
Related: #1226 |
b-dean
reviewed
Sep 25, 2025
|
|
||
| func (key *MasterKey) newKMSClient() (*kms.KmsCryptoClient, error) { | ||
| // Right now only implements authentication using default profile | ||
| configProvider := common.DefaultConfigProvider() |
Contributor
There was a problem hiding this comment.
I'd rather not have this just be the default config provider. Here's some reasons:
- It doesn't work with any sort of standard environment variables. The
TF_VAR_*stuff is in there, but noOCI_*orOCI_CLI_* - It doesn't work with the
security_tokenauth that you get when you use SSO / SAML / Federation stuff. - It requires you always create a
~/.oci/configwhich is a pain when you're running somewhere temporary, like in a container, and might not have proper users, etc.
I've written a small library that could help: https://github.com/ontariosystems/oci-cli-env-provider
It uses the semi-standard OCI_CLI_* environment variables used by the oci cli.
So what I'd do here is change it get the provider that way, and include the instance identity provider so we can run it on compute instances too (which I definitely need sops to be able to do).
import "github.com/ontariosystems/oci-cli-env-provider"
func (key *MasterKey) newKMSClient() (*kms.KmsCryptoClient, error) {
configProvider, err := configurationProvider()
if err != nil {
return nil, err
}
// ...
}
func configurationProvider() (common.ConfigurationProvider, error) {
var providers []common.ConfigurationProvider
providers = append(providers, ocep.DefaultConfigProvider())
ip, err := auth.InstancePrincipalConfigurationProvider()
if err != nil {
return nil, err
}
providers = append(providers, ip)
return common.ComposingConfigurationProvider(providers)
}I've added a similar comment on #1226
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add functionality for Oracle Cloud (OCI) and it's KMS.
Implements authentication using DEFAULT profile which is read from ~/.oci/config file