Skip to content

Commit b211cdd

Browse files
committed
feat: Use OS_TENANT_ID env variable to define public cloud project to use
Signed-off-by: Arthur Amstutz <arthur.amstutz@corp.ovh.com>
1 parent 49fa000 commit b211cdd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/services/cloud/cloud_project.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,17 @@ func getConfiguredCloudProject() (string, error) {
6767
return url.PathEscape(projectID), nil
6868
}
6969

70+
// Use OpenStack standard environment variable if set
71+
if projectID := os.Getenv("OS_TENANT_ID"); projectID != "" {
72+
return url.PathEscape(projectID), nil
73+
}
74+
7075
projectID, err := config.GetConfigValue(flags.CliConfig, "", "default_cloud_project")
7176
if err != nil {
7277
return "", fmt.Errorf("failed to fetch default cloud project: %w", err)
7378
}
7479
if projectID == "" {
75-
return "", fmt.Errorf("no project ID configured, please use --cloud-project <id> or set a default cloud project in your configuration. Alternatively, you can set the OVH_CLOUD_PROJECT_SERVICE environment variable")
80+
return "", fmt.Errorf("no project ID configured, please use --cloud-project <id> or set a default cloud project in your configuration. Alternatively, you can set the OVH_CLOUD_PROJECT_SERVICE or OS_TENANT_ID environment variable")
7681
}
7782

7883
return url.PathEscape(projectID), nil

0 commit comments

Comments
 (0)