Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add OCI KMS as provider#1865

Open
hrvolapeter wants to merge 1 commit intogetsops:mainfrom
hrvolapeter:main
Open

Add OCI KMS as provider#1865
hrvolapeter wants to merge 1 commit intogetsops:mainfrom
hrvolapeter:main

Conversation

Copy link

hrvolapeter commented Jun 1, 2025

Add functionality for Oracle Cloud (OCI) and it's KMS.

Implements authentication using DEFAULT profile which is read from ~/.oci/config file

hrvolapeter force-pushed the main branch from 89d3c1b to 5b76b03 Compare June 1, 2025 16:14
Signed-off-by: Peter Hrvola
hrvolapeter force-pushed the main branch from 5b76b03 to 4ccd27a Compare June 1, 2025 16:16
Copy link
Contributor

felixfontein commented Jun 1, 2025

Related: #1226

hrvolapeter reacted with thumbs up emoji

b-dean mentioned this pull request Sep 25, 2025
b-dean reviewed Sep 25, 2025

func (key *MasterKey) newKMSClient() (*kms.KmsCryptoClient, error) {
// Right now only implements authentication using default profile
configProvider := common.DefaultConfigProvider()
Copy link
Contributor

b-dean Sep 25, 2025

Choose a reason for hiding this comment

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

I'd rather not have this just be the default config provider. Here's some reasons:

  1. It doesn't work with any sort of standard environment variables. The TF_VAR_* stuff is in there, but no OCI_* or OCI_CLI_*
  2. It doesn't work with the security_token auth that you get when you use SSO / SAML / Federation stuff.
  3. It requires you always create a ~/.oci/config which 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

b-dean b-dean left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants