-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: adjust project_api_key to new file structure #1676
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mongodbatlas | ||
package projectapikey | ||
|
||
import ( | ||
"context" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mongodbatlas | ||
package projectapikey | ||
|
||
import ( | ||
"context" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mongodbatlas | ||
package projectapikey | ||
|
||
import ( | ||
"context" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mongodbatlas_test | ||
package projectapikey_test | ||
|
||
import ( | ||
"fmt" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mongodbatlas_test | ||
package projectapikey_test | ||
|
||
import ( | ||
"context" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config" | ||
"github.com/mongodb/terraform-provider-mongodbatlas/internal/service/projectapikey" | ||
|
||
matlas "go.mongodb.org/atlas/mongodbatlas" | ||
) | ||
|
@@ -42,7 +43,7 @@ func dataSourceMongoDBAtlasOrgIDRead(ctx context.Context, d *schema.ResourceData | |
for idx, role := range apiKeyOrgList.APIKey.Roles { | ||
if strings.HasPrefix(role.RoleName, "ORG_") { | ||
if err := d.Set("org_id", apiKeyOrgList.APIKey.Roles[idx].OrgID); err != nil { | ||
return diag.Errorf(ErrorProjectSetting, `org_id`, root.APIKey.ID, err) | ||
return diag.Errorf(projectapikey.ErrorProjectSetting, `org_id`, root.APIKey.ID, err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this error seems to be defined in the wrong package There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah this message was not accurate, adjusted and left a new constant to help with consistency in error messages |
||
} | ||
d.SetId(apiKeyOrgList.APIKey.Roles[idx].OrgID) | ||
return nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit-non-blocking] given the decision on one package per resource and to follow the "don't stutter" general recommendation of go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes sense, will do a followup PR to adjust all of the resources that have already been adjusted to new structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thx