Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 9a1a40d

Browse files
Harvey Lowndesowainlewis
authored andcommitted
Skip defaulting when using instance principals (#136)
1 parent 71cd111 commit 9a1a40d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/oci/client/config.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ func NewConfig(r io.Reader) (*Config, error) {
7878

7979
c.metadata = instancemeta.New()
8080

81-
if err := c.setDefaults(); err != nil {
82-
return nil, err
81+
if !c.UseInstancePrincipals {
82+
if err := c.setDefaults(); err != nil {
83+
return nil, err
84+
}
8385
}
8486

8587
if err := c.validate(); err != nil {
@@ -168,6 +170,9 @@ func validateAuthConfig(c *Config, fldPath *field.Path) field.ErrorList {
168170
if c.Auth.Region != "" {
169171
errList = append(errList, field.Forbidden(fldPath.Child("region"), "cannot be used when useInstancePrincipals is enabled"))
170172
}
173+
if c.Auth.CompartmentOCID != "" {
174+
errList = append(errList, field.Forbidden(fldPath.Child("compartment"), "cannot be used when useInstancePrincipals is enabled"))
175+
}
171176
if c.Auth.TenancyOCID != "" {
172177
errList = append(errList, field.Forbidden(fldPath.Child("tenancy"), "cannot be used when useInstancePrincipals is enabled"))
173178
}

0 commit comments

Comments
 (0)