-
Notifications
You must be signed in to change notification settings - Fork 205
doc: Migration guide for mongodbatlas_team.usernames
attribute to the mongodbatlas_cloud_user_team_assignment
resource
#3588
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
Conversation
mongodbatlas_team.usernames
attribute to the mongodbatlas_cloud_user_team_assignment
resourcemongodbatlas_team.usernames
attribute to the mongodbatlas_cloud_user_team_assignment
resource
APIx bot: a message has been sent to Docs Slack channel |
@marcosuma I’m not sure we need an example created specifically for this migration, since we’re not doing anything different to support modules. Do you think it’s worth adding one? |
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 a comprehensive migration guide to help users transition from the deprecated usernames
attribute on the mongodbatlas_team
resource to the new mongodbatlas_cloud_user_team_assignment
resource.
Key changes:
- Added detailed migration documentation with step-by-step instructions
- Provided practical Terraform code examples for each migration step
- Included guidance on handling imports and module considerations
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
||
--- | ||
|
||
### Step 1: User `mongodb_atlas_team` data source to retrieve user IDs |
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.
Typo in heading: 'User' should be 'Use'.
### Step 1: User `mongodb_atlas_team` data source to retrieve user IDs | |
### Step 1: Use `mongodb_atlas_team` data source to retrieve user IDs |
Copilot uses AI. Check for mistakes.
} | ||
|
||
# New resource for each (user, team) assignment | ||
resource "mongodbatlas_cloud_user_team_assignment" "this" { |
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.
Extra space before 'resource' keyword. Should be aligned with other resource blocks.
resource "mongodbatlas_cloud_user_team_assignment" "this" { | |
resource "mongodbatlas_cloud_user_team_assignment" "this" { |
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.
@csanx I would still add an example for modules so it'll be crystal clear to customers what root-level import blocks
means.
|
||
Handling migration in modules | ||
|
||
- Terraform import blocks cannot live inside modules; they must be defined in the root module. See ([Terraform issue](https://github.com/hashicorp/terraform/issues/33474)). |
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.
- Terraform import blocks cannot live inside modules; they must be defined in the root module. See ([Terraform issue](https://github.com/hashicorp/terraform/issues/33474)). | |
- Terraform import blocks cannot live inside modules; See ([Terraform issue](https://github.com/hashicorp/terraform/issues/33474)). |
found this sentence duplicating the one just after
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.
Rewrote it
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.
LGTM
|
||
- `mongodbatlas_team` included a `usernames` argument that allowed assigning users to a team directly inside the resource. This argument is now deprecated. | ||
- New attribute `users` in `mongodbatlas_team` data source can be used to retrieve information about all the users assigned to that team. | ||
- `mongodbatlas_cloud_user_team_assignment` manages the user’s organization membership (pending or active) and exposes both `username` and `user_id`. It supports import using either `ORG_ID/TEAM_ID/USERNAME` or `ORG_ID/TEAM_ID/USER_ID`. |
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 this be "manages the user’s team membership ....."?
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! Changed it
|
||
- `mongodbatlas_team` included a `usernames` argument that allowed assigning users to a team directly inside the resource. This argument is now deprecated. | ||
- New attribute `users` in `mongodbatlas_team` data source can be used to retrieve information about all the users assigned to that team. | ||
- `mongodbatlas_cloud_user_team_assignment` manages the user’s organization membership (pending or active) and exposes both `username` and `user_id`. It supports import using either `ORG_ID/TEAM_ID/USERNAME` or `ORG_ID/TEAM_ID/USER_ID`. |
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.
[q] is there any difference between pending vs active behavior?
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.
There shouldn't be. I've just tried it and it imports both, pending and active users. You can also add a pending user to a team.
|
||
--- | ||
|
||
### Step 1: User `mongodb_atlas_team` data source to retrieve user IDs |
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.
### Step 1: User `mongodb_atlas_team` data source to retrieve user IDs | |
### Step 1: Use `mongodbatlas_team` data source to retrieve user IDs |
resource "mongodbatlas_team" "this" { | ||
org_id = var.org_id | ||
name = "this" | ||
# usernames = local.usernames # Remove this line |
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 see usernames
is not present in configs of step 1 and 2. We should add them there right?
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.
You're right. Included them.
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.
LGTM
examples/migrate_user_team_assignment/module_maintainer/v1/README.md
Outdated
Show resolved
Hide resolved
…DME.md Co-authored-by: maastha <[email protected]>
merging as @csanx addressed all the comments |
Description
Migration guide for
mongodbatlas_team.usernames
attribute to themongodbatlas_cloud_user_team_assignment
resourceLink to any related issue(s): CLOUDP-336760
Type of change:
Required Checklist:
Further comments
Tested the migration paths successfully.