Skip to content

Commit 21c517d

Browse files
authored
docs: clarify provider auth configuration (#8)
* docs: clarify provider auth configuration Signed-off-by: Avi Miller <me@dje.li>
1 parent 1646341 commit 21c517d

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,37 @@ This package implements:
1414

1515
## Authentication
1616

17-
The provider currently keeps OCI auth intentionally simple:
17+
OCI SDKs support several authentication methods. This provider supports the two
18+
primary methods: API keys, for authentication outside OCI, and
19+
`instance_principal`, for authentication from instances within OCI.
1820

19-
- explicit API key fields on `oraclecloud.Provider`
20-
- OCI config file credentials
21-
- Oracle CLI environment variables
21+
All OCI SDKs support some or all of Oracle's standard environment variables for
22+
authentication configuration, so this provider does too.
23+
24+
The recommended and most prominently documented configuration style is the
25+
standard OCI config file, usually `~/.oci/config`, because it matches Oracle's
26+
preferred user workflow and works cleanly with existing OCI tooling.
27+
28+
See the OCI Developer Guide for more on the [Authentication Methods](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdk_authentication_methods.htm) and [Environment Variables](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/clienvironmentvariables.htm).
2229

2330
Supported `Auth` values:
2431

2532
- `""` or `auto`
2633
- `api_key`
2734
- `config_file`
2835
- `environment`
36+
- `instance_principal`
37+
38+
The `api_key`, `config_file`, and `environment` values are all API-key authentication;
39+
they only differ in where the credentials come from.
40+
41+
`resource_principal` and token-based authentication are not currently supported.
42+
43+
If you set `Auth` to `auto` or `config_file` with a valid `~/.oci/config` file available, or set `Auth` to `instance_principal` on an OCI instance with the appropriate policies applied, no further configuration is required to manage public DNS zones. However, both of these methods require `ViewID` to be configured to manage private zones by name.
2944

30-
`instance_principal` is also wired through, but the package is primarily aimed at API-key based usage for now.
45+
For `environment`, or when populating the provider fields directly, the minimum required values are `TenancyOCID`, `UserOCID`, `Fingerprint`, `Region`, and either `PrivateKeyPath` or inline `PrivateKey`. `PrivateKeyPassphrase` is only needed when the private key is passphrase-protected.
3146

32-
If you use `Auth: "config_file"` with `ConfigFile: "~/.oci/config"`, you do not also need to provide
33-
`TenancyOCID`, `UserOCID`, `Fingerprint`, `Region`, or `PrivateKey*` fields. `ConfigProfile` is optional
34-
and defaults to `DEFAULT` (or `OCI_CLI_PROFILE` if set).
47+
`CompartmentID` is required to List Zones.
3548

3649
## Provider Fields
3750

provider.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,35 @@ const (
4040
//
4141
// The provider is safe for concurrent use.
4242
type Provider struct {
43+
// Auth selects how the provider obtains OCI credentials: auto, api_key,
44+
// config_file, environment, or instance_principal.
4345
Auth string `json:"auth,omitempty"`
4446

47+
// ConfigFile is the path to the OCI config file, usually ~/.oci/config.
4548
ConfigFile string `json:"config_file,omitempty"`
49+
// ConfigProfile is the profile name within ConfigFile to use.
4650
ConfigProfile string `json:"config_profile,omitempty"`
4751

52+
// PrivateKey is the PEM-encoded API signing key content.
4853
PrivateKey string `json:"private_key,omitempty"`
54+
// PrivateKeyPath is the path to the PEM-encoded API signing key file.
4955
PrivateKeyPath string `json:"private_key_path,omitempty"`
56+
// PrivateKeyPassphrase is the passphrase for the API signing key, if any.
5057
PrivateKeyPassphrase string `json:"private_key_passphrase,omitempty"`
58+
// TenancyOCID is the OCID of the tenancy that owns the credentials.
5159
TenancyOCID string `json:"tenancy_ocid,omitempty"`
60+
// UserOCID is the OCID of the OCI user for API key authentication.
5261
UserOCID string `json:"user_ocid,omitempty"`
62+
// Fingerprint is the fingerprint of the registered OCI API signing key.
5363
Fingerprint string `json:"fingerprint,omitempty"`
64+
// Region is the OCI region used for DNS API requests.
5465
Region string `json:"region,omitempty"`
5566

67+
// Scope selects the DNS zone scope: GLOBAL or PRIVATE.
5668
Scope string `json:"scope,omitempty"`
69+
// ViewID identifies the private DNS view when operating on private zones by name.
5770
ViewID string `json:"view_id,omitempty"`
71+
// CompartmentID identifies the compartment to search when listing zones.
5872
CompartmentID string `json:"compartment_id,omitempty"`
5973

6074
mu sync.Mutex `json:"-"`

0 commit comments

Comments
 (0)