-
Notifications
You must be signed in to change notification settings - Fork 205
doc: Adds example & documentation for new mongodbatlas_cloud_user_team_assignment
resource
#3578
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
base: CLOUDP-320243-dev-2.0.0
Are you sure you want to change the base?
Conversation
This reverts commit 9f0f5b2.
APIx bot: a message has been sent to Docs Slack channel |
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.
Pull Request Overview
This PR adds comprehensive documentation and examples for the new mongodbatlas_cloud_user_team_assignment
resource and data source, enabling users to assign and manage MongoDB Cloud users within teams.
Key changes:
- Adds documentation templates for both resource and data source
- Creates complete example implementation with Terraform configuration files
- Generates final documentation files with schema details and usage examples
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
File | Description |
---|---|
templates/resources/cloud_user_team_assignment.md.tmpl | Template for resource documentation with import instructions |
templates/data-sources/cloud_user_team_assignment.md.tmpl | Template for data source documentation |
examples/mongodbatlas_cloud_user_team_assignment/*.tf | Complete Terraform example with provider, variables, main config, and outputs |
examples/mongodbatlas_cloud_user_team_assignment/README.md | Example usage documentation |
docs/resources/cloud_user_team_assignment.md | Generated resource documentation with schema |
docs/data-sources/cloud_user_team_assignment.md | Generated data source documentation with schema |
|
||
-> **NOTE**Users with pending invitations created using the deprecated `mongodbatlas_project_invitation` resource or via the deprecated [Invite One MongoDB Cloud User to One Project](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-getorganizationuser#tag/Projects/operation/createProjectInvitation) | ||
endpoint cannot be managed with this resource. See [MongoDB Atlas API](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listteamusers) for details. | ||
To manage such users with this resource, refer to our [migration guide]<link-to-migration-guide>. |
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.
The migration guide link is incomplete with placeholder text '' instead of an actual URL.
To manage such users with this resource, refer to our [migration guide]<link-to-migration-guide>. | |
To manage such users with this resource, refer to our [migration guide](https://www.mongodb.com/docs/atlas/migrate-cloud-user-team-assignment). |
Copilot uses AI. Check for mistakes.
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.
All placeholders will be addressed as part of this ticket CLOUDP-329711
@@ -0,0 +1,17 @@ | |||
resource "mongodbatlas_cloud_user_team_assignment" "example" { |
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.
Should the data sources depend on the resource?
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.
I had the same question earlier but couldn’t find an example where depends_on
is used, only data sources using it when a different resource is needed.
Also, we didn’t include this in cloud_user_org_assignment
docs #3493, so I did not included it here for consistency.
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.
Have you run the example? I suspect it will fail, since the data source will get NOT FOUND until the resource is created. But maybe we are handling that?
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.
Yes, it fails. The cloud_user_org_assignment
example fails for the same reason. Agustin pointed out that the other examples I reviewed without depends_on
implicitly depend on the resource because they reference its attributes, so it’s a different situation.
I’ll update both examples to include a depends_on
@@ -0,0 +1,75 @@ | |||
# Data Source: mongodbatlas_cloud_user_team_assignment |
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.
not related to this PR, but in case you didn't know, you can use https://registry.terraform.io/tools/doc-preview - learned it from @AgustinBettati
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.
it's also in the makefile
terraform-provider-mongodbatlas/Makefile
Line 121 in 8dcf547
@echo "Use this site to preview markdown rendering: https://registry.terraform.io/tools/doc-preview" |
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.
Already used that! It was super helpful for detecting small issues 👍🏻
|
||
-> **NOTE**Users with pending invitations created using the deprecated `mongodbatlas_project_invitation` resource or via the deprecated [Invite One MongoDB Cloud User to One Project](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-getorganizationuser#tag/Projects/operation/createProjectInvitation) | ||
endpoint cannot be managed with this resource. See [MongoDB Atlas API](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listteamusers) for details. | ||
To manage such users with this resource, refer to our [migration guide]<link-to-migration-guide>. |
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.
sweet!
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.
one note: to make sure we really don't forget these placeholder links (<link-to-migration-guide>
) I would probably stay consistent with the same keyword (the one you've used <link-to-migration-guide>
is ok) and then create a CLOUDP ticket to search for all those occurrences.
This is valid if you're planning to merge this PR with that placeholder.
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.
Sure, we already have a ticket CLOUDP-329711
I updated the description to flag that this is the specific keyword.
@@ -0,0 +1,28 @@ | |||
# Example: mongodbatlas_cloud_user_team_assignment |
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.
@maastha @csanx this example is great. Will we have one example created specifically for the migration though? Like we had when we've created mongodbatlas_api_key_assignment
and had to provide a migration path for mongodbatlas_project_api_key
(https://github.com/mongodb/terraform-provider-mongodbatlas/tree/master/examples/mongodbatlas_api_key_assignment/module/old_module)
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.
I think what you are suggesting will be done in the following tickets, that are specifically for designing the migration guides.
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.
perfect!
|
||
Read-Only: | ||
|
||
- `org_roles` (Set of String) One or more organization level roles to assign the MongoDB Cloud user. |
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.
we usually use "list" or "array" in the docs instead of "set". Does the distinction matter here?
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.
Autogenerated
|
||
### Required | ||
|
||
- `org_id` (String) Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access. |
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.
data types here should all be lowercase. i.e. (String) -> (string)
another question here: do we usually add the data type? looking over a smattering of resource and data source examples and I don't see this as a common convention. Is this from the generated schema?
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.
Yes, autogenerated
- `mobile_number` (String) Mobile phone number that belongs to the MongoDB Cloud user. | ||
- `org_membership_status` (String) String enum that indicates whether the MongoDB Cloud user has a pending invitation to join the organization or they are already active in the organization. | ||
- `roles` (Attributes) Organization and project level roles to assign the MongoDB Cloud user within one organization. (see [below for nested schema](#nestedatt--roles)) | ||
- `team_ids` (Set of String) List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs. |
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.
see comment below as well re: set
- `team_ids` (Set of String) List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs. | |
- `team_ids` (set of strings) List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs. |
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.
Autogenerated
- `last_name` (String) Last name, family name, or surname that belongs to the MongoDB Cloud user. | ||
- `mobile_number` (String) Mobile phone number that belongs to the MongoDB Cloud user. | ||
- `org_membership_status` (String) String enum that indicates whether the MongoDB Cloud user has a pending invitation to join the organization or they are already active in the organization. | ||
- `roles` (Attributes) Organization and project level roles to assign the MongoDB Cloud user within one organization. (see [below for nested schema](#nestedatt--roles)) |
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.
we don't often use "attributes" in the docs. Is this an object / list of objects?
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.
Autogenerated
|
||
Read-Only: | ||
|
||
- `org_roles` (Set of String) One or more organization level roles to assign the MongoDB Cloud user. |
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.
string should be plural
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.
Autogenerated
### Required | ||
|
||
- `org_id` (String) Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access. | ||
- `team_id` (String) Unique 24-hexadecimal digit string that identifies the team to which you want to assign the MongoDB Cloud user. Use the [/teams](#tag/Teams/operation/listTeams) endpoint to retrieve all teams to which the authenticated user has access. |
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.
I think this relative link should be replaced with an absolute one
### Required | ||
|
||
- `org_id` (String) Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access. | ||
- `team_id` (String) Unique 24-hexadecimal digit string that identifies the team to which you want to assign the MongoDB Cloud user. Use the [/teams](#tag/Teams/operation/listTeams) endpoint to retrieve all teams to which the authenticated user has access. |
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.
replace relative link with absolute link to API docs. Or should this be updated to link to a terraform construct?
@@ -0,0 +1,82 @@ | |||
# Resource: mongodbatlas_cloud_user_team_assignment | |||
|
|||
`mongodbatlas_cloud_user_team_assignment` provides a Cloud User Team Assignment resource. The resource lets you import, assign, remove, or update a user to a team. |
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.
"update a user to a team" is somewhat uncommon construction. Is there a different verb we could use to better describe the behavior?
Thanks for the review @jwilliams-mongo! Most of your comments refer to autogenerated parts of the documentation, which I can’t change manually. This convention is more recent, so only newer resources follow it (e.g., mongodbatlas_api_key_project_assignment, mongodbatlas_flex_cluster). Generating the documentation automatically will ensure consistency across all docs created from now on. I’ll mark in your suggestions which sections are autogenerated so it’s clear which ones I cannot address. |
Description
Adds example & documentation for new
mongodbatlas_cloud_user_team_assignment
resourceLink to any related issue(s): CLOUDP-333178
Type of change:
Required Checklist:
Further comments