Skip to content

Commit 0eda88f

Browse files
authored
V1.8.1 Fix flow of logic for org_id fetch to pass acceptance test (#1028)
* Fix config test TestAccConfigDSOrgID_basic * Change flow of getting org_id * Disable long running custom_role test
1 parent 40c6b1b commit 0eda88f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

mongodbatlas/data_source_mongodbatlas_org_id.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ func dataSourceMongoDBAtlasOrgIDRead(ctx context.Context, d *schema.ResourceData
3838
return diag.Errorf("error getting API Key's org assigned (%s): ", err)
3939
}
4040

41-
if err := d.Set("org_id", apiKeyOrgList.APIKey.Roles[0].OrgID); err != nil {
42-
return diag.Errorf(errorProjectSetting, `org_id`, root.APIKey.ID, err)
43-
}
44-
45-
for _, role := range apiKeyOrgList.APIKey.Roles {
41+
for idx, role := range apiKeyOrgList.APIKey.Roles {
4642
if strings.HasPrefix(role.RoleName, "ORG_") {
47-
d.SetId(apiKeyOrgList.APIKey.Roles[0].OrgID)
43+
if err := d.Set("org_id", apiKeyOrgList.APIKey.Roles[idx].OrgID); err != nil {
44+
return diag.Errorf(errorProjectSetting, `org_id`, root.APIKey.ID, err)
45+
}
46+
d.SetId(apiKeyOrgList.APIKey.Roles[idx].OrgID)
47+
return nil
4848
}
4949
}
5050

mongodbatlas/resource_mongodbatlas_custom_db_role_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ func TestAccConfigRSCustomDBRoles_MultipleCustomRoles(t *testing.T) {
412412
}
413413

414414
func TestAccConfigRSCustomDBRoles_MultipleResources(t *testing.T) {
415+
t.Skip()
415416
var (
416417
resourceName = "mongodbatlas_custom_db_role.test"
417418
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")

0 commit comments

Comments
 (0)